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
"Killed by signal.\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 { bikill
($pid); };
58 my $pass = ($result eq "ok");
61 my $colour = $pass ?
"\e[32;1m" : "\e[31;1m";
62 return "$colour$result\e[0m";
70 my ($name, $result) = @_;
71 return sprintf("! %-65s %s", $name, colourize
($result));
80 if (/^\s*Testing "(.*)" in (.*):\s*$/)
82 my ($sect, $file) = ($1, $2);
85 printf " %s\n", colourize
("ok");
88 printf("! %s %s: ", $file, $sect);
92 elsif (/^!\s*(.*?)\s+(\S+)\s*$/)
94 my ($name, $result) = ($1, $2);
95 my $pass = ($result eq "ok");
98 printf("\n! Startup: ");
102 push @log, resultline
($name, $result);
107 print "\n" . join("\n", @log) . "\n";
122 printf " %s\n", colourize
("ok");
125 my $newpid = waitpid($pid, 0);
126 if ($newpid != $pid) {
127 die("waitpid returned '$newpid', expected '$pid'\n");
131 my $ret = ($code >> 8);
134 print "\n" . join("\n", @log) . "\n";
138 my $gtotal = $gpasses+$gfails;
139 printf("\nWvTest: %d test%s, %d failure%s.\n",
140 $gtotal, $gtotal==1 ?
"" : "s",
141 $gfails, $gfails==1 ?
"" : "s");
142 print STDERR
"\nWvTest result code: $ret\n";
143 exit( $ret ?
$ret : ($gfails ?
125 : 0) );