selftest: Check exit code when listing tests.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 9 Dec 2010 15:48:24 +0000 (16:48 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 10 Dec 2010 02:04:06 +0000 (03:04 +0100)
selftest/selftest.pl

index d8640e0d1ad39d53dc38462990c3c7227520c17e..213954cfbf98df0fc50dae72b6e2225ccba89dae 100755 (executable)
@@ -959,6 +959,17 @@ $envvarstr
                $cmd =~ s/\$LISTOPT/--list/;
 
                system($cmd);
+
+               if ($? == -1) {
+                       die("Unable to run $cmd: $!");
+               } elsif ($? & 127) {
+                       die(snprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127),  ($? & 128) ? 'with' : 'without'));
+               }
+
+               my $exitcode = $? >> 8;
+               if ($exitcode != 0) {
+                       die("$cmd exited with exit code $exitcode");
+               }
        }
 } else {
        foreach (@todo) {