When a test harness program fails, make the testsuite fail.
authorAndrew Bartlett <abartlet@samba.org>
Fri, 25 Apr 2008 14:05:07 +0000 (15:05 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 25 Apr 2008 14:05:07 +0000 (15:05 +0100)
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)

source4/script/harness2subunit.pl

index c14e4730e0099e58377bb1d8058d6f263ca7346b..9f2391ad6c30f4cfc390ed93fe569d7c6639b5ab 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 my $firstline = 1;
-
+my $error = 0;
 while(<STDIN>) {
        if ($firstline) {
                $firstline = 0;
@@ -10,6 +10,7 @@ while(<STDIN>) {
        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";
@@ -22,7 +23,10 @@ while(<STDIN>) {
        } elsif (/^not ok (\d+)$/) {
                print "test: $1\n";
                print "failure: $1\n";
+               $error = 1;
        } else {
                print;
        }
 }
+exit $error;
+