1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00
samba-mirror/source4/script/harness2subunit.pl
Andrew Bartlett ff1ad04300 When a test harness program fails, make the testsuite fail.
The problem fixed here is that pidl tests were not causing the 'number
of tests failing' count to increase, due to the way return codes are
processed on pipelines, in the shell.

By setting an exit code if we print 'failure', we ensure we fail
appropriately.

Andrew Bartlett
(This used to be commit 687e81883d37e3d1f55d3a7a87e20fb860888dde)
2008-04-25 15:05:07 +01:00

33 lines
582 B
Perl
Executable File

#!/usr/bin/perl
my $firstline = 1;
my $error = 0;
while(<STDIN>) {
if ($firstline) {
$firstline = 0;
next;
}
if (/^not ok (\d+) - (.*)$/) {
print "test: $2\n";
print "failure: $2\n";
$error = 1;
} elsif (/^ok (\d+) - (.*)$/) {
print "test: $2\n";
print "success: $2\n";
} elsif (/^ok (\d+)$/) {
print "test: $1\n";
print "success: $1\n";
} elsif (/^ok (\d+) # skip (.*)$/) {
print "test: $1\n";
print "skip: $1 [\n$2\n]\n";
} elsif (/^not ok (\d+)$/) {
print "test: $1\n";
print "failure: $1\n";
$error = 1;
} else {
print;
}
}
exit $error;