6 @EXPORT= qw(&runtests &test_lib);
7 @EXPORT_OK= qw($verbose $switches);
15 my($test,$te,$ok,$next,$max,$totmax, $files,$pct);
19 local($ENV{'PERL5LIB'}) = join(':', @INC); # pass -I flags to children
21 my $t_start = new Benchmark;
22 while ($test = shift(@tests)) {
25 print "$te" . '.' x (20 - length($te));
27 open($fh,"$^X $switches $test|") || (print "can't run. $!\n");
35 if (/^1\.\.([0-9]+)/) {
42 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
43 if (/^ok (.*)/ && $1 == $next) {
49 close($fh); # must close to reap child resource values
51 if ($ok && $next == $max) {
56 print "FAILED on test $next\n";
61 my $t_total = timediff(new Benchmark, $t_start);
65 print "All tests successful.\n";
67 die "FAILED--no tests were run for some reason.\n";
70 $pct = sprintf("%.2f", $good / $total * 100);
72 warn "Failed 1 test, $pct% okay.\n";
74 die "Failed $bad/$total tests, $pct% okay.\n";
77 printf("Files=%d, Tests=%d, %s\n", $files,$totmax, timestr($t_total, 'nop'));