]>
git.saurik.com Git - apple/objc4.git/blob - test/errcheck.pl
dd49a1813d7eb569233cf0a9d944132b9c5fb3f1
5 # Check test output for errors.
6 # usage: test.out | errcheck.pl test [stderr-file]
8 my $testname = shift || die;
9 my $errfile = shift || "$testname.expected-stderr";
13 while (my $line = <>) {
16 push @original_input, $line;
19 # Run result-checking passes, reducing @input each time
22 $bad |= filter_valgrind
() if ($ENV{VALGRIND
});
23 $bad = filter_expected
() if ($bad eq "" && -e
$errfile);
24 $bad = filter_bad
() if ($bad eq "");
26 # OK line should be the only one left
27 $bad = "(output not 'OK: $testname')" if ($bad eq "" && (scalar(@input) != 1 || $input[0] !~ /^OK: $testname/));
30 my $red = "\e[41;37m";
33 print "${red}BAD: /// test '$testname' \\\\\\$def\n";
34 for my $line (@original_input) {
35 print "$red $def$line\n";
37 print "${red}BAD: \\\\\\ test '$testname' ///$def\n";
38 print "${red}FAIL: ## $testname: $bad$def\n";
40 print "PASS: $testname\n";
49 open(my $checkfile, $errfile)
50 || die "can't find $errfile\n";
51 my $check = join('', <$checkfile>);
54 my $input = join("\n", @input) . "\n";
55 if ($input !~ /^$check$/s) {
56 $bad = "(didn't match $errfile)";
57 @input = "BAD: $testname";
59 @input = "OK: $testname"; # pacify later filter
70 for my $line (@input) {
72 if ($line =~ /^BAD: (.*)/) {
75 push @new_input, $line;
88 for my $line (@input) {
89 if ($line =~ /^Approx: do_origins_Dirty\([RW]\): missed \d bytes$/) {
90 # --track-origins warning (harmless)
93 if ($line !~ /^^\.*==\d+==/) {
95 push @new_input, $line;
99 my ($errcount) = ($line =~ /==\d+== ERROR SUMMARY: (\d+) errors/);
100 if (defined $errcount && $errcount > 0) {
104 (my $leakcount) = ($line =~ /==\d+==\s+(?:definitely|possibly) lost:\s+([0-9,]+)/);
105 if (defined $leakcount && $leakcount > 0) {
113 $bad .= "(valgrind errors)" if ($errors);
114 $bad .= "(valgrind leaks)" if ($leaks);