aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-08-02 15:19:44 -0400
committerRuss Cox <rsc@golang.org>2011-08-02 15:19:44 -0400
commit16cdba8572ef96ec51e162fc9c1280df46d9e7d1 (patch)
tree0533e2e3650542d2a39dde76fe89215024317960
parent11e254e62c020e9596d864a6503a4f0db9a6fb83 (diff)
downloadgo-16cdba8572ef96ec51e162fc9c1280df46d9e7d1.tar.gz
go-16cdba8572ef96ec51e162fc9c1280df46d9e7d1.zip
errchk: add -0 flag
R=lvd CC=golang-dev https://golang.org/cl/4837049
-rwxr-xr-xtest/errchk15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/errchk b/test/errchk
index e89d759508..8fdf77a30a 100755
--- a/test/errchk
+++ b/test/errchk
@@ -17,6 +17,13 @@
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";