]>
git.saurik.com Git - apple/ld64.git/blob - unit-tests/bin/result-filter.pl
8168e794f181fabaaf4038b9dbd7085c778dc4c8
8 $Data::Dumper
::Terse
= 1;
15 # first match "root: "
17 # a line starting with "cwd:" marks the beginning of a new test case
18 # call process_entry() on each test case
21 if(m/^root:\s+(.*?)$/)
25 elsif(m/^cwd:\s+(.*?)$/)
29 &process_entry
($root, $entry);
39 # don't forget last test case (no cwd: to mark end)
42 &process_entry
($root, $entry);
46 my $percentage = $pass_count * 100 / $total_count;
47 printf " * * * %d of %d unit-tests passed (%.1f percent) * * *\n", $pass_count, $total_count, $percentage;
52 my ($root, $lines) = @_;
54 # build an associative array of keys to value(s)
55 my $lines_seq = [split /\n/, $lines];
56 #print Dumper($lines_seq);
57 my $tbl = { 'root' => $root, 'stdout' => [], 'stderr' => [] };
59 foreach $line (@$lines_seq)
61 if($line =~ m/^(\w+):\s+(.*)$/)
65 if(!exists($$tbl{$key}))
68 if($key eq 'stdout' || $key eq 'stderr') # if type is @array
70 push @{$$tbl{$key}}, $val;
85 my $test_name = $$tbl{cwd
};
86 if ($test_name =~ m
|.*/([a-zA-Z0-9-
+_
]+)$|)
91 #if make failed (exit was non-zero), mark this as a failure
94 printf "%-40s FAIL Makefile failure\n", $test_name;
99 #if there was any output to stderr, mark this as a failure
100 foreach $line (@{$$tbl{stderr
}})
102 printf "%-40s FAIL spurious stderr failure: %s\n", $test_name, $line;
107 # scan all stdout looking for lines that start with PASS or FAIL
109 foreach $line (@{$$tbl{stdout
}})
111 if($line =~ m/^(PASS|XPASS|FAIL|XFAIL).+/)
114 if($line =~ m/^PASS.+/)
120 # only print failure lines
121 printf "%-40s %s\n", $test_name, $line;
128 printf "%-40s AMBIGIOUS missing [X]PASS/[X]FAIL\n", $test_name;