blob: c8b166c32f7abb584d4d06a51b38d1c43537d716 [file] [log] [blame]
Christophe Lyonbff39612015-11-18 16:29:11 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4
5use File::Glob;
6use Getopt::Long;
7use Term::ANSIColor qw(:constants);
8use File::Basename;
9use Cwd;
10
11my $app = $0;
12
13sub read_sum($);
14sub read_unstable($);
15sub dump_result($);
16sub compare_results($$);
17sub usage();
18sub print_compare_results_summary($$);
19sub nothing($$$$);
20
Christophe Lyona140aa82015-12-17 22:53:03 +010021# OK
Christophe Lyonbff39612015-11-18 16:29:11 +010022my $STILL_PASSES = "Still passes [PASS => PASS]";
23my $STILL_FAILS = "Still fails [FAIL => FAIL]";
Christophe Lyona140aa82015-12-17 22:53:03 +010024my $STILL_XPASS = "Still xpass [XPASS=>XPASS]";
25my $STILL_XFAIL = "Still xfail [XFAIL=>XFAIL]";
Christophe Lyonbff39612015-11-18 16:29:11 +010026
27# TO BE CHECKED
Christophe Lyona140aa82015-12-17 22:53:03 +010028my $PASS_NOW_XFAIL = "PASS now XFAIL [PASS =>XFAIL]";
29my $XFAIL_APPEARS = "XFAIL appears [ =>XFAIL]";
30my $FAIL_NOW_XFAIL = "FAIL now XFAIL [FAIL =>XFAIL]";
31my $XPASS_NOW_XFAIL = "XPASS now XFAIL [XPASS=>XFAIL]";
Christophe Lyonbff39612015-11-18 16:29:11 +010032my $PASSED_NOW_TIMEOUTS = "Timeout [PASS =>T.OUT]";
Christophe Lyona140aa82015-12-17 22:53:03 +010033my $FAIL_DISAPPEARS = "FAIL disappears [FAIL => ]";
34my $XPASS_NOW_PASSES = "XPASS now PASS [XPASS=> PASS]";
35my $XFAIL_NOW_PASSES = "XFAIL now PASS [XFAIL=> PASS]";
36my $XFAIL_NOW_XPASS = "XFAIL now XPASS [XFAIL=>XPASS]";
37my $FAIL_NOW_PASSES = "FAIL now PASS [FAIL => PASS]";
38my $FAIL_NOW_XPASS = "FAIL now XPASS [FAIL =>XPASS]";
39my $NEW_PASSES = "New PASS [ => PASS]";
Christophe Lyonbff39612015-11-18 16:29:11 +010040my $UNHANDLED_CASES = "Unhandled cases [ ..??.. ]";
41my $UNSTABLE_CASES = "Unstable cases, ignored [~RANDOM ]";
Christophe Lyona140aa82015-12-17 22:53:03 +010042my $UNSUPPORTED_XPASS = "UNSUPPORTED now XPASS [UNSUP=>XPASS]";
43my $UNSUPPORTED_XFAIL = "UNSUPPORTED now XFAIL [UNSUP=>XFAIL]";
44my $UNSUPPORTED_DISAPPEARS= "UNSUPPORTED disappears [UNSUP=> ]";
45my $UNTESTED_PASS = "UNTESTED now PASS [UNTES=> PASS]";
46my $UNTESTED_XFAIL = "UNTESTED now XFAIL [UNTES=>XFAIL]";
47my $UNTESTED_DISAPPEARS = "UNTESTED disappears [UNTES=> ]";
48my $UNRESOLVED_PASS = "UNRESOLVED now PASS [UNRES=> PASS]";
49my $UNRESOLVED_XFAIL = "UNRESOLVED now XFAIL [UNRES=>XFAIL]";
50my $UNRESOLVED_DISAPPEARS = "UNRESOLVED disappears [UNRES=> ]";
Christophe Lyonbff39612015-11-18 16:29:11 +010051
Christophe Lyona140aa82015-12-17 22:53:03 +010052# REGRESSIONS
53my $PASS_NOW_XPASS = "PASS now XPASS [PASS =>XPASS]";
54my $PASSED_NOW_FAILS = "PASS now FAIL [PASS => FAIL]";
55my $PASS_DISAPPEARS = "PASS disappears [PASS => ]";
56my $XPASS_DISAPPEARS = "XPASS disappears [XPASS=> ]";
57my $FAIL_APPEARS = "FAIL appears [ => FAIL]";
58my $XPASS_APPEARS = "XPASS appears [ =>XPASS]";
59my $XPASS_NOW_FAIL = "XPASS now FAIL [XPASS=> FAIL]";
60my $XFAIL_NOW_FAIL = "XFAIL now FAIL [XFAIL=> FAIL]";
61my $XFAIL_DISAPPEARS = "XFAIL disappears [XFAIL=> ]";
62
63my $UNSUPPORTED_PASS = "UNSUPPORTED now PASS [UNSUP=> PASS]";
64my $UNSUPPORTED_FAIL = "UNSUPPORTED now FAIL [UNSUP=> FAIL]";
65my $UNTESTED_FAIL = "UNTESTED now FAIL [UNTES=> FAIL]";
66my $UNTESTED_XPASS = "UNTESTED now XPASS [UNTES=>XPASS]";
67my $UNRESOLVED_FAIL = "UNRESOLVED now FAIL [UNRES=> FAIL]";
68my $UNRESOLVED_XPASS = "UNRESOLVED now XPASS [UNRES=>XPASS]";
Christophe Lyonbff39612015-11-18 16:29:11 +010069
70my @handler_list = (
71 {was=>"PASS", is=>"PASS", cat=>$STILL_PASSES},
Christophe Lyona140aa82015-12-17 22:53:03 +010072 {was=>"PASS", is=>"XPASS", cat=>$PASS_NOW_XPASS},
73 {was=>"XPASS", is=>"PASS", cat=>$XPASS_NOW_PASSES},
74 {was=>"XPASS", is=>"XPASS", cat=>$STILL_XPASS},
Christophe Lyonbff39612015-11-18 16:29:11 +010075 {was=>"FAIL", is=>"FAIL", cat=>$STILL_FAILS},
Christophe Lyona140aa82015-12-17 22:53:03 +010076 {was=>"FAIL", is=>"XFAIL", cat=>$FAIL_NOW_XFAIL},
77 {was=>"XFAIL", is=>"FAIL", cat=>$XFAIL_NOW_FAIL},
78 {was=>"XFAIL", is=>"XFAIL", cat=>$STILL_XFAIL},
Christophe Lyonbff39612015-11-18 16:29:11 +010079
Christophe Lyona140aa82015-12-17 22:53:03 +010080 {was=>"XPASS", is=>"XFAIL", cat=>$XPASS_NOW_XFAIL},
81 {was=>"PASS", is=>"XFAIL", cat=>$PASS_NOW_XFAIL},
Christophe Lyonbff39612015-11-18 16:29:11 +010082 {was=>"FAIL", is=>"NO_EXIST", cat=>$FAIL_DISAPPEARS},
Christophe Lyona140aa82015-12-17 22:53:03 +010083 {was=>"XFAIL", is=>"NO_EXIST", cat=>$XFAIL_DISAPPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +010084 {was=>"XFAIL", is=>"PASS", cat=>$XFAIL_NOW_PASSES},
Christophe Lyona140aa82015-12-17 22:53:03 +010085 {was=>"XFAIL", is=>"XPASS", cat=>$XFAIL_NOW_XPASS},
Christophe Lyonbff39612015-11-18 16:29:11 +010086 {was=>"FAIL", is=>"PASS", cat=>$FAIL_NOW_PASSES},
Christophe Lyona140aa82015-12-17 22:53:03 +010087 {was=>"FAIL", is=>"XPASS", cat=>$FAIL_NOW_XPASS},
Christophe Lyonbff39612015-11-18 16:29:11 +010088 {was=>"NO_EXIST", is=>"PASS", cat=>$NEW_PASSES},
Christophe Lyona140aa82015-12-17 22:53:03 +010089 {was=>"NO_EXIST", is=>"XPASS", cat=>$XPASS_APPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +010090
91 {was=>"PASS", is=>"FAIL", handler=>\&handle_pass_fail},
Christophe Lyona140aa82015-12-17 22:53:03 +010092 {was=>"XPASS", is=>"FAIL", cat=>$XPASS_NOW_FAIL},
Christophe Lyonbff39612015-11-18 16:29:11 +010093 {was=>"PASS", is=>"NO_EXIST", cat=>$PASS_DISAPPEARS},
Christophe Lyona140aa82015-12-17 22:53:03 +010094 {was=>"XPASS", is=>"NO_EXIST", cat=>$XPASS_DISAPPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +010095 {was=>"NO_EXIST", is=>"FAIL", cat=>$FAIL_APPEARS},
96 {was=>"NO_EXIST", is=>"XFAIL", cat=>$XFAIL_APPEARS},
97
Christophe Lyona140aa82015-12-17 22:53:03 +010098 {was=>"UNSUPPORTED", is=>"PASS", cat=>$UNSUPPORTED_PASS},
99 {was=>"UNSUPPORTED", is=>"XPASS", cat=>$UNSUPPORTED_XPASS},
100 {was=>"UNSUPPORTED", is=>"FAIL", cat=>$UNSUPPORTED_FAIL},
101 {was=>"UNSUPPORTED", is=>"XFAIL", cat=>$UNSUPPORTED_XFAIL},
102 {was=>"UNSUPPORTED", is=>"NO_EXIST", cat=>$UNSUPPORTED_DISAPPEARS},
103
104 {was=>"UNTESTED", is=>"PASS", cat=>$UNTESTED_PASS},
105 {was=>"UNTESTED", is=>"XPASS", cat=>$UNTESTED_XPASS},
106 {was=>"UNTESTED", is=>"FAIL", cat=>$UNTESTED_FAIL},
107 {was=>"UNTESTED", is=>"XFAIL", cat=>$UNTESTED_XFAIL},
108 {was=>"UNTESTED", is=>"NO_EXIST", cat=>$UNTESTED_DISAPPEARS},
109
110 {was=>"UNRESOLVED", is=>"PASS", cat=>$UNRESOLVED_PASS},
111 {was=>"UNRESOLVED", is=>"XPASS", cat=>$UNRESOLVED_XPASS},
112 {was=>"UNRESOLVED", is=>"FAIL", cat=>$UNRESOLVED_FAIL},
113 {was=>"UNRESOLVED", is=>"XFAIL", cat=>$UNRESOLVED_XFAIL},
114 {was=>"UNRESOLVED", is=>"NO_EXIST", cat=>$UNRESOLVED_DISAPPEARS},
115
Christophe Lyonbff39612015-11-18 16:29:11 +0100116# {was=>"NO_EXIST", is=>"NO_EXIST", handler=>\&handle_not_yet_supported}
117);
118
119######################################################
120# TREAT ARGUMENTS
121
122my $verbose=0;
123my $quiet=0;
124my $long=0;
125my $short=0;
126my $debug=0;
127my ($testroot, $basename);
128my ($ref_file_name, $res_file_name);
129my $nounstable=0;
130my $unstablefile=0;
131my @unstable_markers=();
132
133GetOptions ("l" => \$long,
134 "s" => \$short,
135 "q" => \$quiet,
136 "v" => \$verbose,
137 "dbg" => \$debug,
138 "testroot=s" => \$testroot,
139 "basename=s" => \$basename,
140 "no-unstable" => \$nounstable,
141 "unstable-tests=s" => \$unstablefile,
142 "unstable-marker=s" => \@unstable_markers);
143
144$ref_file_name = $ARGV[0] if ($#ARGV == 1);
145$res_file_name = $ARGV[1] if ($#ARGV == 1);
146
147$ref_file_name = $testroot."/expected_results/".$basename if ($testroot and $basename);
148$res_file_name = $testroot."/testing/run/".$basename if ($testroot and $basename);
149&usage if (not $ref_file_name or not $res_file_name);
150
151my ($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
152 = ("\033[31;1m","\033[31;3m","\033[32;1m","\033[32;3m","\033[35;1m","\033[35;2m","\033[0m");
153($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
154 = ("","","","","","","") if (not I_am_interactive());
155
156######################################################
157# MAIN PROGRAM
158# print "comparing $ref_file_name $res_file_name\n";
159
160# If none of the 2 .sum exists, nothing to compare: exit early.
161exit 0 if ( (! -e $ref_file_name) && (! -e $res_file_name ));
162
163my $ref = read_sum($ref_file_name) ;
164my $res = read_sum($res_file_name) ;
165my @unstablelist = ();
166
167@unstablelist = read_unstable($unstablefile) if ($unstablefile ne 0);
168
169compare_results($ref, $res);
170
171my $final_result = print_compare_results_summary($ref, $res);
172
173exit $final_result;
174
175######################################################
176# UTILITIES
177
178sub empty_result()
179{
180 my %empty_result;# = {PASS=>0, FAIL=>0, XPASS=>0, XFAIL=>0, UNSUPPORTED=>0, UNTESTED=>0, UNRESOLVED=>0};
181 $empty_result{PASS}=$empty_result{FAIL}=$empty_result{XPASS}=$empty_result{XFAIL}=0;
182 $empty_result{UNSUPPORTED}=$empty_result{UNTESTED}=$empty_result{UNRESOLVED}=$empty_result{NO_EXIST}=0;
183 return \%empty_result;
184}
185sub I_am_interactive {
186 return -t STDIN && -t STDOUT;
187}
188sub usage()
189{
190 print "Usage : $app <ref_file.sum> <result_file.sum>\n";
191 exit 1;
192}
193
194
195######################################################
196# PARSING
197sub read_sum($)
198{
199 my ($sum_file) = @_;
200 my $res = empty_result();
201 my %testcases;
202 my %unsupported;
203 $res->{testcases} = \%testcases;
204 my $pending_timeout=0;
205
206 open SUMFILE, $sum_file or die $!;
207 while (<SUMFILE>)
208 {
209 if (m/^(PASS|XPASS|FAIL|XFAIL|UNSUPPORTED|UNTESTED|UNRESOLVED): (.*)/)
210 {
211 my ($diag,$tc) = ($1,$2);
212 my %tcresult;
213 $tc =~ s/==[0-9]+== Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly./==<pid>== Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly./;
214 $testcases{$tc} = empty_result() if (not exists $testcases{$tc});
215 $testcases{$tc}->{$diag}++;
216 $testcases{$tc}->{HAS_TIMED_OUT} = $pending_timeout;
217 $pending_timeout = 0;
218 $res->{$diag}++;
219 }
220 elsif (m/WARNING: program timed out/)
221 {
222 $pending_timeout = 1;
223 }
224 elsif (m/^(# of expected passes|# of unexpected failures|# of expected failures|# of known failures|# of unsupported tests|# of untested testcases)\s+(.*)/)
225 {
226 $res->{"summary - "."$1"} = $2;
227 }
228 elsif (m/^\/.*\/([^\/]+)\s+version\s+(.*)/)
229 {
230 $res->{tool} = $1;
231 $res->{version} = $2;
232 $res->{version} =~ s/ [-(].*//;
233 }
234 }
235 close SUMFILE;
236 return $res;
237}
238
239# Parse list on unstable tests
240sub read_unstable($)
241{
242 my ($unstable_file) = @_;
243 my @unstable_tests = ();
244
245 open UNSTABLEFILE, $unstable_file or die $!;
246 while (<UNSTABLEFILE>)
247 {
248 # Skip lines starting with '#', or with spaces only
249 if ((/^#/) || (/^[ ]*$/))
250 {
251 }
252 else
253 {
254 chomp;
255
256 my $test = $_;
257
258 # Check if line is of type: target:testname
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100259 if (/^(.*?):/)
Christophe Lyonbff39612015-11-18 16:29:11 +0100260 {
261 foreach my $unstable_marker (@unstable_markers)
262 {
263 if ($unstable_marker eq $1) {
264 # If target matches the one supplied as script
265 # argument, add the testname to the list
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100266 $test =~ s/.*?://;
Christophe Lyonbff39612015-11-18 16:29:11 +0100267 push @unstable_tests, $test;
268 }
269 }
270 } else {
271 push @unstable_tests, $test;
272 }
273 }
274 }
275 close UNSTABLEFILE;
276 return @unstable_tests;
277}
278
279######################################################
280# DIFFING
281sub handle_pass_fail($$$$)
282{
283 my ($ref, $res, $diag_diag, $tc) = @_;
284 if ($res->{testcases}->{$tc}->{HAS_TIMED_OUT})
285 {
286 push @{$res->{$PASSED_NOW_TIMEOUTS}}, $tc;
287 }
288 else
289 {
290 push @{$res->{$PASSED_NOW_FAILS}}, $tc;
291 }
292}
293
294sub compare_results($$)
295{
296 my ($ref, $res) = @_;
297
298 @{$res->{$STILL_PASSES}} = ();
299 @{$res->{$STILL_FAILS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100300 @{$res->{$STILL_XPASS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100301 @{$res->{$PASSED_NOW_FAILS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100302 @{$res->{$XPASS_NOW_FAIL}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100303 @{$res->{$PASS_DISAPPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100304 @{$res->{$XPASS_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100305 @{$res->{$FAIL_APPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100306 @{$res->{$XPASS_APPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100307 @{$res->{$NEW_PASSES}} = ();
308 @{$res->{$FAIL_DISAPPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100309 @{$res->{$XFAIL_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100310 @{$res->{$XFAIL_APPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100311 @{$res->{$FAIL_NOW_XFAIL}} = ();
312 @{$res->{$PASS_NOW_XFAIL}} = ();
313 @{$res->{$XPASS_NOW_XFAIL}} = ();
314 @{$res->{$XPASS_APPEARS}} = ();
315 @{$res->{$PASS_NOW_XPASS}} = ();
316 @{$res->{$XPASS_NOW_PASSES}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100317 @{$res->{$XFAIL_NOW_PASSES}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100318 @{$res->{$XFAIL_NOW_XPASS}} = ();
319 @{$res->{$XFAIL_NOW_FAIL}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100320 @{$res->{$FAIL_NOW_PASSES}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100321 @{$res->{$FAIL_NOW_XPASS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100322 @{$res->{$PASSED_NOW_TIMEOUTS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100323 @{$res->{$UNSUPPORTED_PASS}} = ();
324 @{$res->{$UNSUPPORTED_XPASS}} = ();
325 @{$res->{$UNSUPPORTED_FAIL}} = ();
326 @{$res->{$UNSUPPORTED_XFAIL}} = ();
327 @{$res->{$UNSUPPORTED_DISAPPEARS}} = ();
328 @{$res->{$UNTESTED_PASS}} = ();
329 @{$res->{$UNTESTED_XPASS}} = ();
330 @{$res->{$UNTESTED_FAIL}} = ();
331 @{$res->{$UNTESTED_XFAIL}} = ();
332 @{$res->{$UNTESTED_DISAPPEARS}} = ();
333 @{$res->{$UNRESOLVED_PASS}} = ();
334 @{$res->{$UNRESOLVED_XPASS}} = ();
335 @{$res->{$UNRESOLVED_FAIL}} = ();
336 @{$res->{$UNRESOLVED_XFAIL}} = ();
337 @{$res->{$UNRESOLVED_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100338 @{$res->{$UNHANDLED_CASES}} = ();
339 @{$res->{$UNSTABLE_CASES}} = ();
340
341 #### MERGE REF AND RES
342 foreach my $key (sort (keys %{$res->{testcases}}))
343 {
344 if (not exists $ref->{testcases}->{$key}) {
345 $ref->{testcases}->{$key} = empty_result();
346 $ref->{testcases}->{$key}->{NO_EXIST} = 1;
347 }
348 }
349 foreach my $key (keys %{$ref->{testcases}})
350 {
351 if (not exists $res->{testcases}->{$key})
352 {
353 $res->{testcases}->{$key} = empty_result();
354 $res->{testcases}->{$key}->{NO_EXIST} = 1;
355 }
356 }
357
358 #### ACTIONS FOR EACH CASES
359 my %unstable_found;
360
361 foreach my $key (sort (keys %{$ref->{testcases}}))
362 {
363 foreach my $diag_diag (@handler_list)
364 {
365 if ($ref->{testcases}->{$key}->{$diag_diag->{was}} != $res->{testcases}->{$key}->{$diag_diag->{was}}
366 and $res->{testcases}->{$key}->{$diag_diag->{is}})
367 {
368 # If testcase is listed as 'unstable' mark it as
369 # such and skip other processing.
370 {
371 if (grep { (index $key,$_)!=-1} @unstablelist)
372 {
373 print "[unstable] $key\n" if ($debug);
374 $unstable_found{$key}=1;
375 }
376 else {
377 print "[$diag_diag->{was} => $diag_diag->{is}] $key\n" if ($debug);
378 if ($diag_diag->{handler})
379 {
380 $diag_diag->{handler} ($ref, $res, $diag_diag, $key);
381 }
382 else
383 {
384 push @{$res->{$diag_diag->{cat}}}, $key;
385 }
386 }
387 }
388 }
389 }
390 }
391 push @{$res->{$UNSTABLE_CASES}}, (sort (keys (%unstable_found))) if ($nounstable == 0);
392
393}
394
395######################################################
396# PRINTING
397sub print_tclist($@)
398{
399 my ($cat, @tclist) = @_;
400 print " - ".$cat.":\n\n ". join("\n ",@tclist) . "\n\n" if (scalar(@tclist));
401}
402
403sub print_compare_results_summary($$)
404{
405 my ($ref, $res) = @_;
406 my $return_value=0;
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100407 my $total_better = 0;
Christophe Lyonbff39612015-11-18 16:29:11 +0100408 my $rtotal = 0;
409 my $quiet_reg = $quiet;
410
411 if (not $quiet)
412 {
413 printf "Comparing:\n";
414 printf "REFERENCE:$ref_file_name\n";
415 printf "CURRENT: $res_file_name\n\n";
416 }
417
418 #### TESTS STATUS
419 if (not $quiet and not $short)
420 {
421 printf " ` +---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100422 printf "o RUN STATUS: | REF | RES |\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100423 printf " +------------------------------------------+---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100424 printf " | %-40s | %7d | %7d |\n", "Passes [PASS]", $ref->{PASS}, $res->{PASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100425 printf " | %-40s | %7d | %7d |\n", "Unexpected fails [FAIL]", $ref->{FAIL}, $res->{FAIL};
Christophe Lyona140aa82015-12-17 22:53:03 +0100426 printf " | %-40s | %7d | %7d |\n", "Unexpected passes [XPASS]", $ref->{XPASS}, $res->{XPASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100427 printf " | %-40s | %7d | %7d |\n", "Expected fails [XFAIL]", $ref->{XFAIL}, $res->{XFAIL};
428 printf " | %-40s | %7d | %7d |\n", "Unresolved [UNRESOLVED]", $ref->{UNRESOLVED}, $res->{UNRESOLVED};
Christophe Lyona140aa82015-12-17 22:53:03 +0100429 printf " | %-40s | %7d | %7d |\n", "Unsupported [UNSUPPORTED]", $ref->{UNSUPPORTED}, $res->{UNSUPPORTED};
430 printf " | %-40s | %7d | %7d |\n", "Untested [UNTESTED]", $ref->{UNTESTED}, $res->{UNTESTED};
Christophe Lyonbff39612015-11-18 16:29:11 +0100431 printf " +------------------------------------------+---------+---------+\n";
432 printf "\n";
433 }
434
435 #### REGRESSIONS ?
Christophe Lyona140aa82015-12-17 22:53:03 +0100436 $rtotal = scalar(@{$res->{$PASSED_NOW_FAILS}})
437 +scalar(@{$res->{$XPASS_NOW_FAIL}})
438 +scalar(@{$res->{$PASS_DISAPPEARS}})
439 +scalar(@{$res->{$XPASS_DISAPPEARS}})
440 +scalar(@{$res->{$FAIL_APPEARS}})
441 +scalar(@{$res->{$XPASS_APPEARS}})
442 +scalar(@{$res->{$PASS_NOW_XPASS}})
443 +scalar(@{$res->{$XFAIL_NOW_FAIL}})
444 +scalar(@{$res->{$XFAIL_DISAPPEARS}})
445 +scalar(@{$res->{$UNSUPPORTED_FAIL}})
446 +scalar(@{$res->{$UNSUPPORTED_XPASS}})
447 +scalar(@{$res->{$UNTESTED_FAIL}})
448 +scalar(@{$res->{$UNTESTED_XPASS}})
449 +scalar(@{$res->{$UNRESOLVED_FAIL}})
450 +scalar(@{$res->{$UNRESOLVED_XPASS}})
451 +scalar(@{$res->{$PASSED_NOW_TIMEOUTS}});
452
453 $quiet_reg=1 if ($short and not $rtotal);
Christophe Lyonbff39612015-11-18 16:29:11 +0100454
455 if (not $quiet_reg)
456 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100457 printf "\n$col_red"."o REGRESSIONS:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100458 printf " +------------------------------------------+---------+\n";
459 printf " | %-40s | %7d |\n", $PASSED_NOW_FAILS, scalar(@{$res->{$PASSED_NOW_FAILS}}) if (scalar(@{$res->{$PASSED_NOW_FAILS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100460 printf " | %-40s | %7d |\n", $XPASS_NOW_FAIL, scalar(@{$res->{$XPASS_NOW_FAIL}}) if (scalar(@{$res->{$XPASS_NOW_FAIL}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100461 printf " | %-40s | %7d |\n", $PASS_DISAPPEARS, scalar(@{$res->{$PASS_DISAPPEARS}}) if (scalar(@{$res->{$PASS_DISAPPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100462 printf " | %-40s | %7d |\n", $XPASS_DISAPPEARS, scalar(@{$res->{$XPASS_DISAPPEARS}}) if (scalar(@{$res->{$XPASS_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100463 printf " | %-40s | %7d |\n", $FAIL_APPEARS, scalar(@{$res->{$FAIL_APPEARS}}) if (scalar(@{$res->{$FAIL_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100464 printf " | %-40s | %7d |\n", $XPASS_APPEARS, scalar(@{$res->{$XPASS_APPEARS}}) if (scalar(@{$res->{$XPASS_APPEARS}}));
465 printf " | %-40s | %7d |\n", $PASS_NOW_XPASS, scalar(@{$res->{$PASS_NOW_XPASS}}) if (scalar(@{$res->{$PASS_NOW_XPASS}}));
466 printf " | %-40s | %7d |\n", $XFAIL_NOW_FAIL, scalar(@{$res->{$XFAIL_NOW_FAIL}}) if (scalar(@{$res->{$XFAIL_NOW_FAIL}}));
467 printf " | %-40s | %7d |\n", $XFAIL_DISAPPEARS, scalar(@{$res->{$XFAIL_DISAPPEARS}}) if (scalar(@{$res->{$XFAIL_DISAPPEARS}}));
468 printf " | %-40s | %7d |\n", $UNSUPPORTED_FAIL, scalar(@{$res->{$UNSUPPORTED_FAIL}}) if (scalar(@{$res->{$UNSUPPORTED_FAIL}}));
469 printf " | %-40s | %7d |\n", $UNSUPPORTED_XPASS, scalar(@{$res->{$UNSUPPORTED_XPASS}}) if (scalar(@{$res->{$UNSUPPORTED_XPASS}}));
470 printf " | %-40s | %7d |\n", $UNTESTED_FAIL, scalar(@{$res->{$UNTESTED_FAIL}}) if (scalar(@{$res->{$UNTESTED_FAIL}}));
471 printf " | %-40s | %7d |\n", $UNTESTED_XPASS, scalar(@{$res->{$UNTESTED_XPASS}}) if (scalar(@{$res->{$UNTESTED_XPASS}}));
472 printf " | %-40s | %7d |\n", $UNRESOLVED_FAIL, scalar(@{$res->{$UNRESOLVED_FAIL}}) if (scalar(@{$res->{$UNRESOLVED_FAIL}}));
473 printf " | %-40s | %7d |\n", $UNRESOLVED_XPASS, scalar(@{$res->{$UNRESOLVED_XPASS}}) if (scalar(@{$res->{$UNRESOLVED_XPASS}}));
474 printf " | %-40s | %7d |\n", $PASSED_NOW_TIMEOUTS, scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}) if (scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100475 printf " +------------------------------------------+---------+\n";
476 printf " | %-40s | %7d |\n", "TOTAL_REGRESSIONS", $rtotal;
477 printf " +------------------------------------------+---------+\n";
478 printf "\n";
479
480 if ($long)
481 {
482 print_tclist($PASSED_NOW_FAILS, @{$res->{$PASSED_NOW_FAILS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100483 print_tclist($XPASS_NOW_FAIL, @{$res->{$XPASS_NOW_FAIL}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100484 print_tclist($PASS_DISAPPEARS, @{$res->{$PASS_DISAPPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100485 print_tclist($XPASS_DISAPPEARS, @{$res->{$XPASS_DISAPPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100486 print_tclist($FAIL_APPEARS, @{$res->{$FAIL_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100487 print_tclist($XPASS_APPEARS, @{$res->{$XPASS_APPEARS}});
488 print_tclist($PASS_NOW_XPASS, @{$res->{$PASS_NOW_XPASS}});
489 print_tclist($XFAIL_NOW_FAIL, @{$res->{$XFAIL_NOW_FAIL}});
490 print_tclist($XFAIL_DISAPPEARS, @{$res->{$XFAIL_DISAPPEARS}});
491 print_tclist($UNSUPPORTED_FAIL, @{$res->{$UNSUPPORTED_FAIL}});
492 print_tclist($UNSUPPORTED_XPASS, @{$res->{$UNSUPPORTED_XPASS}});
493 print_tclist($UNTESTED_FAIL, @{$res->{$UNTESTED_FAIL}});
494 print_tclist($UNTESTED_XPASS, @{$res->{$UNTESTED_XPASS}});
495 print_tclist($UNRESOLVED_FAIL, @{$res->{$UNRESOLVED_FAIL}});
496 print_tclist($UNRESOLVED_XPASS, @{$res->{$UNRESOLVED_XPASS}});
497 print_tclist($PASSED_NOW_TIMEOUTS, @{$res->{$PASSED_NOW_TIMEOUTS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100498 }
499 printf "$col_reset\n";
500 }
501
502 #### MINOR TO BE CHECKED ?
503 if (not $quiet and not $short)
504 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100505 $total_better = scalar(@{$res->{$XPASS_NOW_PASSES}})+
506 scalar(@{$res->{$XFAIL_NOW_PASSES}})+
507 scalar(@{$res->{$XFAIL_NOW_XPASS}})+
Christophe Lyonbff39612015-11-18 16:29:11 +0100508 scalar(@{$res->{$FAIL_NOW_PASSES}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100509 scalar(@{$res->{$FAIL_NOW_XPASS}})+
Christophe Lyonbff39612015-11-18 16:29:11 +0100510 scalar(@{$res->{$NEW_PASSES}})+
511 scalar(@{$res->{$FAIL_DISAPPEARS}})+
512 scalar(@{$res->{$XFAIL_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100513 scalar(@{$res->{$FAIL_NOW_XFAIL}})+
514 scalar(@{$res->{$PASS_NOW_XFAIL}})+
515 scalar(@{$res->{$XPASS_NOW_XFAIL}})+
516 scalar(@{$res->{$UNSUPPORTED_PASS}})+
517 scalar(@{$res->{$UNSUPPORTED_XFAIL}})+
518 scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}})+
519 scalar(@{$res->{$UNTESTED_PASS}})+
520 scalar(@{$res->{$UNTESTED_XFAIL}})+
521 scalar(@{$res->{$UNTESTED_DISAPPEARS}})+
522 scalar(@{$res->{$UNRESOLVED_PASS}})+
523 scalar(@{$res->{$UNRESOLVED_XFAIL}})+
524 scalar(@{$res->{$UNRESOLVED_DISAPPEARS}})+
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100525 scalar(@{$res->{$UNHANDLED_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100526
Christophe Lyona140aa82015-12-17 22:53:03 +0100527 printf "$col_pink"."o MINOR TO BE CHECKED:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100528 printf " +------------------------------------------+---------+\n";
529 printf " | %-40s | %7d |\n", $XFAIL_APPEARS, scalar(@{$res->{$XFAIL_APPEARS}}) if (scalar(@{$res->{$XFAIL_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100530 printf " | %-40s | %7d |\n", $FAIL_NOW_XFAIL, scalar(@{$res->{$FAIL_NOW_XFAIL}}) if (scalar(@{$res->{$FAIL_NOW_XFAIL}}));
531 printf " | %-40s | %7d |\n", $PASS_NOW_XFAIL, scalar(@{$res->{$PASS_NOW_XFAIL}}) if (scalar(@{$res->{$PASS_NOW_XFAIL}}));
532 printf " | %-40s | %7d |\n", $XPASS_NOW_XFAIL, scalar(@{$res->{$XPASS_NOW_XFAIL}}) if (scalar(@{$res->{$XPASS_NOW_XFAIL}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100533 printf " | %-40s | %7d |\n", $FAIL_DISAPPEARS, scalar(@{$res->{$FAIL_DISAPPEARS}}) if (scalar(@{$res->{$FAIL_DISAPPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100534 printf " | %-40s | %7d |\n", $XPASS_NOW_PASSES, scalar(@{$res->{$XPASS_NOW_PASSES}}) if (scalar(@{$res->{$XPASS_NOW_PASSES}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100535 printf " | %-40s | %7d |\n", $XFAIL_NOW_PASSES, scalar(@{$res->{$XFAIL_NOW_PASSES}}) if (scalar(@{$res->{$XFAIL_NOW_PASSES}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100536 printf " | %-40s | %7d |\n", $XFAIL_NOW_XPASS, scalar(@{$res->{$XFAIL_NOW_XPASS}}) if (scalar(@{$res->{$XFAIL_NOW_XPASS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100537 printf " | %-40s | %7d |\n", $FAIL_NOW_PASSES, scalar(@{$res->{$FAIL_NOW_PASSES}}) if (scalar(@{$res->{$FAIL_NOW_PASSES}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100538 printf " | %-40s | %7d |\n", $FAIL_NOW_XPASS, scalar(@{$res->{$FAIL_NOW_XPASS}}) if (scalar(@{$res->{$FAIL_NOW_XPASS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100539 printf " | %-40s | %7d |\n", $NEW_PASSES, scalar(@{$res->{$NEW_PASSES}}) if (scalar(@{$res->{$NEW_PASSES}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100540 printf " | %-40s | %7d |\n", $UNSUPPORTED_PASS, scalar(@{$res->{$UNSUPPORTED_PASS}}) if (scalar(@{$res->{$UNSUPPORTED_PASS}}));
541 printf " | %-40s | %7d |\n", $UNSUPPORTED_XFAIL, scalar(@{$res->{$UNSUPPORTED_XFAIL}}) if (scalar(@{$res->{$UNSUPPORTED_XFAIL}}));
542 printf " | %-40s | %7d |\n", $UNSUPPORTED_DISAPPEARS, scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}));
543 printf " | %-40s | %7d |\n", $UNTESTED_PASS, scalar(@{$res->{$UNTESTED_PASS}}) if (scalar(@{$res->{$UNTESTED_PASS}}));
544 printf " | %-40s | %7d |\n", $UNTESTED_XFAIL, scalar(@{$res->{$UNTESTED_XFAIL}}) if (scalar(@{$res->{$UNTESTED_XFAIL}}));
545 printf " | %-40s | %7d |\n", $UNTESTED_DISAPPEARS, scalar(@{$res->{$UNTESTED_DISAPPEARS}}) if (scalar(@{$res->{$UNTESTED_DISAPPEARS}}));
546 printf " | %-40s | %7d |\n", $UNRESOLVED_PASS, scalar(@{$res->{$UNRESOLVED_PASS}}) if (scalar(@{$res->{$UNRESOLVED_PASS}}));
547 printf " | %-40s | %7d |\n", $UNRESOLVED_XFAIL, scalar(@{$res->{$UNRESOLVED_XFAIL}}) if (scalar(@{$res->{$UNRESOLVED_XFAIL}}));
548 printf " | %-40s | %7d |\n", $UNRESOLVED_DISAPPEARS, scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}) if (scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100549 printf " | %-40s | %7d |\n", $UNHANDLED_CASES, scalar(@{$res->{$UNHANDLED_CASES}}) if (scalar(@{$res->{$UNHANDLED_CASES}}));
550 printf " | %-40s | %7d |\n", $UNSTABLE_CASES, scalar(@{$res->{$UNSTABLE_CASES}}) if (scalar(@{$res->{$UNSTABLE_CASES}}));
551 printf " +------------------------------------------+---------+\n";
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100552 printf " | %-40s | %7d |\n", "TOTAL_MINOR_TO_BE_CHECKED", $total_better + scalar(@{$res->{$UNSTABLE_CASES}});;
Christophe Lyonbff39612015-11-18 16:29:11 +0100553 printf " +------------------------------------------+---------+\n";
554 printf "\n";
555
556 if ($long)
557 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100558 print_tclist($XPASS_NOW_PASSES, @{$res->{$XPASS_NOW_PASSES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100559 print_tclist($XFAIL_NOW_PASSES, @{$res->{$XFAIL_NOW_PASSES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100560 print_tclist($XFAIL_NOW_XPASS, @{$res->{$XFAIL_NOW_XPASS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100561 print_tclist($FAIL_NOW_PASSES, @{$res->{$FAIL_NOW_PASSES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100562 print_tclist($FAIL_NOW_XPASS, @{$res->{$FAIL_NOW_XPASS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100563 print_tclist($FAIL_DISAPPEARS, @{$res->{$FAIL_DISAPPEARS}});
564 print_tclist($XFAIL_APPEARS, @{$res->{$XFAIL_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100565 print_tclist($FAIL_NOW_XFAIL, @{$res->{$FAIL_NOW_XFAIL}});
566 print_tclist($PASS_NOW_XFAIL, @{$res->{$PASS_NOW_XFAIL}});
567 print_tclist($XPASS_NOW_XFAIL, @{$res->{$XPASS_NOW_XFAIL}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100568 print_tclist($UNHANDLED_CASES, @{$res->{$UNHANDLED_CASES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100569 print_tclist($UNSUPPORTED_PASS, @{$res->{$UNSUPPORTED_PASS}});
570 print_tclist($UNSUPPORTED_XFAIL, @{$res->{$UNSUPPORTED_XFAIL}});
571 print_tclist($UNSUPPORTED_DISAPPEARS, @{$res->{$UNSUPPORTED_DISAPPEARS}});
572 print_tclist($UNTESTED_PASS, @{$res->{$UNTESTED_PASS}});
573 print_tclist($UNTESTED_XFAIL, @{$res->{$UNTESTED_XFAIL}});
574 print_tclist($UNTESTED_DISAPPEARS, @{$res->{$UNTESTED_DISAPPEARS}});
575 print_tclist($UNRESOLVED_PASS, @{$res->{$UNRESOLVED_PASS}});
576 print_tclist($UNRESOLVED_XFAIL, @{$res->{$UNRESOLVED_XFAIL}});
577 print_tclist($UNRESOLVED_DISAPPEARS, @{$res->{$UNRESOLVED_DISAPPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100578 print_tclist($UNSTABLE_CASES, @{$res->{$UNSTABLE_CASES}});
579 print_tclist($NEW_PASSES, @{$res->{$NEW_PASSES}});
580 }
581 printf "$col_reset\n";
582 }
583
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100584 $return_value = 1 if ($total_better);
Christophe Lyonbff39612015-11-18 16:29:11 +0100585
586 $return_value = 2 if ($rtotal);
587
588 # Error if there was no PASS (eg when sth went wrong and no .sum was generated
589 $return_value = 2 if (($res->{PASS} + $res->{XPASS}) == 0);
590
591 return $return_value;
592}