8 print STDERR
"Usage: $0 <command line...>\n";
12 print STDERR
"Testing \"all\" in @ARGV:\n";
14 my $pid = open(my $fh, "-|");
18 open STDERR
, '>&STDOUT' or die("Can't dup stdout: $!\n");
20 exit 126; # just in case
23 my $istty = -t STDOUT
;
25 my ($gpasses, $gfails) = (0,0);
32 print "\n" . join("\n", @log) . "\n";
35 print STDERR
"\n! Killed by signal FAILED\n";
37 ($pid > 0) || die("pid is '$pid'?!\n");
39 local $SIG{CHLD
} = sub { }; # this will wake us from sleep() faster
52 local $SIG{INT
} = sub { bigkill
($pid); };
53 local $SIG{TERM
} = sub { bigkill
($pid); };
54 local $SIG{ALRM
} = sub {
55 print STDERR
"Alarm timed out! No test results for too long.\n";
62 my $pass = ($result eq "ok");
65 my $colour = $pass ?
"\e[32;1m" : "\e[31;1m";
66 return "$colour$result\e[0m";
74 my ($name, $result) = @_;
75 return sprintf("! %-65s %s", $name, colourize
($result));
85 if (/^\s*Testing "(.*)" in (.*):\s*$/)
89 my ($sect, $file) = ($1, $2);
92 printf " %s\n", colourize
("ok");
95 printf("! %s %s: ", $file, $sect);
99 elsif (/^!\s*(.*?)\s+(\S+)\s*$/)
103 my ($name, $result) = ($1, $2);
104 my $pass = ($result eq "ok");
107 printf("\n! Startup: ");
111 push @log, resultline
($name, $result);
116 print "\n" . join("\n", @log) . "\n";
131 printf " %s\n", colourize
("ok");
134 my $newpid = waitpid($pid, 0);
135 if ($newpid != $pid) {
136 die("waitpid returned '$newpid', expected '$pid'\n");
140 my $ret = ($code >> 8);
143 print "\n" . join("\n", @log) . "\n";
147 my $gtotal = $gpasses+$gfails;
148 printf("\nWvTest: %d test%s, %d failure%s.\n",
149 $gtotal, $gtotal==1 ?
"" : "s",
150 $gfails, $gfails==1 ?
"" : "s");
151 print STDERR
"\nWvTest result code: $ret\n";
152 exit( $ret ?
$ret : ($gfails ?
125 : 0) );