]>
git.saurik.com Git - apple/ld64.git/blob - unit-tests/bin/result-filter.pl
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;
97 #foreach $line1 (@{$$tbl{stdout}})
99 # printf "stdout: %s\n", $line1;
101 #foreach $line1 (@{$$tbl{stderr}})
103 # printf "stderr: %s\n", $line1;
108 #if there was any output to stderr, mark this as a failure
109 foreach $line (@{$$tbl{stderr
}})
111 printf "%-40s FAIL spurious stderr failure: %s\n", $test_name, $line;
116 # scan all stdout looking for lines that start with PASS or FAIL
118 foreach $line (@{$$tbl{stdout
}})
120 if($line =~ m/^(PASS|XPASS|FAIL|XFAIL).+/)
123 if($line =~ m/^PASS.+/)
129 # only print failure lines
130 printf "%-40s %s\n", $test_name, $line;
137 printf "%-40s AMBIGIOUS missing [X]PASS/[X]FAIL\n", $test_name;
140 #foreach $line1 (@{$$tbl{stdout}})
142 # printf "stdout: %s\n", $line1;
144 #foreach $line1 (@{$$tbl{stderr}})
146 # printf "stderr: %s\n", $line1;