]> Cypherpunks repositories - gostls13.git/commitdiff
errchk: add -0 flag
authorRuss Cox <rsc@golang.org>
Tue, 2 Aug 2011 19:19:44 +0000 (15:19 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 2 Aug 2011 19:19:44 +0000 (15:19 -0400)
R=lvd
CC=golang-dev
https://golang.org/cl/4837049

test/errchk

index e89d759508819a9f05e64cc7b2ac45e358da9802..8fdf77a30a35e8b6d5bb9004abae76854ed27e9f 100755 (executable)
 
 use POSIX;
 
+my $exitcode = 1;
+
+if(@ARGV >= 1 && $ARGV[0] eq "-0") {
+       $exitcode = 0;
+       shift;
+}
+
 if(@ARGV < 1) {
        print STDERR "Usage: errchk COMPILER [OPTS] SOURCEFILES\n";
        exit 1;
@@ -47,12 +54,18 @@ $out = join('', <CMD>);
 
 close CMD;
 
-if($? == 0) {
+if($exitcode != 0 && $? == 0) {
        print STDERR "BUG: errchk: command succeeded unexpectedly\n";
        print STDERR @out;
        exit 0;
 }
 
+if($exitcode == 0 && $? != 0) {
+       print STDERR "BUG: errchk: command failed unexpectedly\n";
+       print STDERR @out;
+       exit 0;
+}
+
 if(!WIFEXITED($?)) {
        print STDERR "BUG: errchk: compiler crashed\n";
        print STDERR @out, "\n";