blob: b8b34f85eb7e238bd28ad67c1ee1f16517e13766 [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 Lyondded4d82016-06-28 18:12:38 +020021my $PASS_PASS = "Still passes [PASS => PASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020022my $PASS_XPASS = "PASS now XPASS [PASS =>XPASS]";
23my $PASS_FAIL = "PASS now FAIL [PASS => FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020024my $PASS_XFAIL = "PASS now XFAIL [PASS =>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020025my $PASS_UNSUPPORTED = "PASS now UNSUPPORTED [PASS =>UNSUP]";
26my $PASS_UNRESOLVED = "PASS now UNRESOLVED [PASS =>UNRES]";
27my $PASS_UNTESTED = "PASS now UNTESTED [PASS =>UNTES]";
Christophe Lyona140aa82015-12-17 22:53:03 +010028my $PASS_DISAPPEARS = "PASS disappears [PASS => ]";
Christophe Lyon71cec962016-06-28 18:27:30 +020029my $PASS_APPEARS = "New PASS [ => PASS]";
30my $PASSED_NOW_TIMEOUTS = "Timeout [PASS =>T.OUT]";
31
32my $XPASS_PASS = "XPASS now PASS [XPASS=> PASS]";
33my $XPASS_XPASS = "Still xpass [XPASS=>XPASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020034my $XPASS_FAIL = "XPASS now FAIL [XPASS=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020035my $XPASS_XFAIL = "XPASS now XFAIL [XPASS=>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020036my $XPASS_UNSUPPORTED = "XPASS now UNSUPPORTED [XPASS=>UNSUP]";
37my $XPASS_UNRESOLVED = "XPASS now UNRESOLVED [XPASS=>UNRES]";
38my $XPASS_UNTESTED = "XPASS now UNTESTED [XPASS=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020039my $XPASS_DISAPPEARS = "XPASS disappears [XPASS=> ]";
40my $XPASS_APPEARS = "XPASS appears [ =>XPASS]";
41
42my $FAIL_PASS = "FAIL now PASS [FAIL => PASS]";
43my $FAIL_XPASS = "FAIL now XPASS [FAIL =>XPASS]";
44my $FAIL_FAIL = "Still fails [FAIL => FAIL]";
45my $FAIL_XFAIL = "FAIL now XFAIL [FAIL =>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020046my $FAIL_UNSUPPORTED = "FAIL now UNSUPPORTED [FAIL =>UNSUP]";
47my $FAIL_UNRESOLVED = "FAIL now UNRESOLVED [FAIL =>UNRES]";
48my $FAIL_UNTESTED = "FAIL now UNTESTED [FAIL =>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020049my $FAIL_DISAPPEARS = "FAIL disappears [FAIL => ]";
50my $FAIL_APPEARS = "FAIL appears [ => FAIL]";
51
52my $XFAIL_PASS = "XFAIL now PASS [XFAIL=> PASS]";
53my $XFAIL_XPASS = "XFAIL now XPASS [XFAIL=>XPASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020054my $XFAIL_FAIL = "XFAIL now FAIL [XFAIL=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020055my $XFAIL_XFAIL = "Still xfail [XFAIL=>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020056my $XFAIL_UNSUPPORTED = "XFAIL now UNSUPPORTED [XFAIL=>UNSUP]";
57my $XFAIL_UNRESOLVED = "XFAIL now UNRESOLVED [XFAIL=>UNRES]";
58my $XFAIL_UNTESTED = "XFAIL now UNTESTED [XFAIL=>UNTES]";
Christophe Lyona140aa82015-12-17 22:53:03 +010059my $XFAIL_DISAPPEARS = "XFAIL disappears [XFAIL=> ]";
Christophe Lyon71cec962016-06-28 18:27:30 +020060my $XFAIL_APPEARS = "XFAIL appears [ =>XFAIL]";
Christophe Lyona140aa82015-12-17 22:53:03 +010061
62my $UNSUPPORTED_PASS = "UNSUPPORTED now PASS [UNSUP=> PASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +020063my $UNSUPPORTED_XPASS = "UNSUPPORTED now XPASS [UNSUP=>XPASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +010064my $UNSUPPORTED_FAIL = "UNSUPPORTED now FAIL [UNSUP=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020065my $UNSUPPORTED_XFAIL = "UNSUPPORTED now XFAIL [UNSUP=>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020066my $UNSUPPORTED_UNSUPPORTED= "UNSUPP now UNSUPP [UNSUP=>UNSUP]";
67my $UNSUPPORTED_UNRESOLVED= "UNSUPP now UNRESOLVED [UNSUP=>UNRES]";
68my $UNSUPPORTED_UNTESTED = "UNSUPP now UNTESTED [UNSUP=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020069my $UNSUPPORTED_DISAPPEARS= "UNSUPPORTED disappears [UNSUP=> ]";
70my $UNSUPPORTED_APPEARS = "UNSUPPORTED appears [ =>UNSUP]";
71
72my $UNTESTED_PASS = "UNTESTED now PASS [UNTES=> PASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +010073my $UNTESTED_XPASS = "UNTESTED now XPASS [UNTES=>XPASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +020074my $UNTESTED_FAIL = "UNTESTED now FAIL [UNTES=> FAIL]";
75my $UNTESTED_XFAIL = "UNTESTED now XFAIL [UNTES=>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020076my $UNTESTED_UNSUPPORTED = "UNTESTED now UNSUPP [UNTES=>UNSUP]";
77my $UNTESTED_UNRESOLVED = "UNTESTED now UNRESOLVED [UNTES=>UNRES]";
78my $UNTESTED_UNTESTED = "UNTESTED now UNTESTED [UNTES=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020079my $UNTESTED_DISAPPEARS = "UNTESTED disappears [UNTES=> ]";
80my $UNTESTED_APPEARS = "UNTESTED appears [ =>UNTES]";
81
82my $UNRESOLVED_PASS = "UNRESOLVED now PASS [UNRES=> PASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +010083my $UNRESOLVED_XPASS = "UNRESOLVED now XPASS [UNRES=>XPASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +020084my $UNRESOLVED_FAIL = "UNRESOLVED now FAIL [UNRES=> FAIL]";
85my $UNRESOLVED_XFAIL = "UNRESOLVED now XFAIL [UNRES=>XFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020086my $UNRESOLVED_UNSUPPORTED= "UNRESOLVED now UNSUPP [UNRES=>UNSUP]";
87my $UNRESOLVED_UNRESOLVED = "UNRESOLVED now UNRESOLVED [UNRES=>UNRES]";
88my $UNRESOLVED_UNTESTED = "UNRESOLVED now UNTESTED [UNRES=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020089my $UNRESOLVED_DISAPPEARS = "UNRESOLVED disappears [UNRES=> ]";
90my $UNRESOLVED_APPEARS = "UNRESOLVED appears [ =>UNRES]";
91
92my $UNHANDLED_CASES = "Unhandled cases [ ..??.. ]";
93my $UNSTABLE_CASES = "Unstable cases, ignored [~RANDOM ]";
Christophe Lyonbff39612015-11-18 16:29:11 +010094
95my @handler_list = (
Christophe Lyondded4d82016-06-28 18:12:38 +020096 {was=>"PASS", is=>"PASS", cat=>$PASS_PASS},
97 {was=>"PASS", is=>"XPASS", cat=>$PASS_XPASS},
Christophe Lyonfdfbd172016-06-28 18:38:55 +020098 {was=>"PASS", is=>"FAIL", handler=>\&handle_pass_fail},
99 {was=>"PASS", is=>"XFAIL", cat=>$PASS_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200100 {was=>"PASS", is=>"UNSUPPORTED",cat=>$PASS_UNSUPPORTED},
101 {was=>"PASS", is=>"UNTESTED", cat=>$PASS_UNTESTED},
102 {was=>"PASS", is=>"UNRESOLVED",cat=>$PASS_UNRESOLVED},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200103 {was=>"PASS", is=>"NO_EXIST", cat=>$PASS_DISAPPEARS},
104 {was=>"NO_EXIST", is=>"PASS", cat=>$PASS_APPEARS},
105
Christophe Lyondded4d82016-06-28 18:12:38 +0200106 {was=>"XPASS", is=>"PASS", cat=>$XPASS_PASS},
107 {was=>"XPASS", is=>"XPASS", cat=>$XPASS_XPASS},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200108 {was=>"XPASS", is=>"FAIL", cat=>$XPASS_FAIL},
Christophe Lyondded4d82016-06-28 18:12:38 +0200109 {was=>"XPASS", is=>"XFAIL", cat=>$XPASS_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200110 {was=>"XPASS", is=>"UNSUPPORTED",cat=>$XPASS_UNSUPPORTED},
111 {was=>"XPASS", is=>"UNTESTED", cat=>$XPASS_UNTESTED},
112 {was=>"XPASS", is=>"UNRESOLVED",cat=>$XPASS_UNRESOLVED},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200113 {was=>"XPASS", is=>"NO_EXIST", cat=>$XPASS_DISAPPEARS},
Christophe Lyona140aa82015-12-17 22:53:03 +0100114 {was=>"NO_EXIST", is=>"XPASS", cat=>$XPASS_APPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +0100115
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200116 {was=>"FAIL", is=>"PASS", cat=>$FAIL_PASS},
117 {was=>"FAIL", is=>"XPASS", cat=>$FAIL_XPASS},
118 {was=>"FAIL", is=>"FAIL", cat=>$FAIL_FAIL},
119 {was=>"FAIL", is=>"XFAIL", cat=>$FAIL_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200120 {was=>"FAIL", is=>"UNSUPPORTED",cat=>$FAIL_UNSUPPORTED},
121 {was=>"FAIL", is=>"UNTESTED", cat=>$FAIL_UNTESTED},
122 {was=>"FAIL", is=>"UNRESOLVED",cat=>$FAIL_UNRESOLVED},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200123 {was=>"FAIL", is=>"NO_EXIST", cat=>$FAIL_DISAPPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +0100124 {was=>"NO_EXIST", is=>"FAIL", cat=>$FAIL_APPEARS},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200125
126 {was=>"XFAIL", is=>"PASS", cat=>$XFAIL_PASS},
127 {was=>"XFAIL", is=>"XPASS", cat=>$XFAIL_XPASS},
128 {was=>"XFAIL", is=>"FAIL", cat=>$XFAIL_FAIL},
129 {was=>"XFAIL", is=>"XFAIL", cat=>$XFAIL_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200130 {was=>"XFAIL", is=>"UNSUPPORTED",cat=>$XFAIL_UNSUPPORTED},
131 {was=>"XFAIL", is=>"UNTESTED", cat=>$XFAIL_UNTESTED},
132 {was=>"XFAIL", is=>"UNRESOLVED",cat=>$XFAIL_UNRESOLVED},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200133 {was=>"XFAIL", is=>"NO_EXIST", cat=>$XFAIL_DISAPPEARS},
Christophe Lyonbff39612015-11-18 16:29:11 +0100134 {was=>"NO_EXIST", is=>"XFAIL", cat=>$XFAIL_APPEARS},
135
Christophe Lyon9dde3332016-06-28 23:00:00 +0200136 {was=>"UNSUPPORTED", is=>"PASS", cat=>$UNSUPPORTED_PASS},
Christophe Lyona140aa82015-12-17 22:53:03 +0100137 {was=>"UNSUPPORTED", is=>"XPASS", cat=>$UNSUPPORTED_XPASS},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200138 {was=>"UNSUPPORTED", is=>"FAIL", cat=>$UNSUPPORTED_FAIL},
Christophe Lyona140aa82015-12-17 22:53:03 +0100139 {was=>"UNSUPPORTED", is=>"XFAIL", cat=>$UNSUPPORTED_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200140 {was=>"UNSUPPORTED", is=>"UNSUPPORTED",cat=>$UNSUPPORTED_UNSUPPORTED},
141 {was=>"UNSUPPORTED", is=>"UNTESTED", cat=>$UNSUPPORTED_UNTESTED},
142 {was=>"UNSUPPORTED", is=>"UNRESOLVED",cat=>$UNSUPPORTED_UNRESOLVED},
Christophe Lyona140aa82015-12-17 22:53:03 +0100143 {was=>"UNSUPPORTED", is=>"NO_EXIST", cat=>$UNSUPPORTED_DISAPPEARS},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200144 {was=>"NO_EXIST", is=>"UNSUPPORTED", cat=>$UNSUPPORTED_APPEARS},
Christophe Lyona140aa82015-12-17 22:53:03 +0100145
146 {was=>"UNTESTED", is=>"PASS", cat=>$UNTESTED_PASS},
147 {was=>"UNTESTED", is=>"XPASS", cat=>$UNTESTED_XPASS},
148 {was=>"UNTESTED", is=>"FAIL", cat=>$UNTESTED_FAIL},
149 {was=>"UNTESTED", is=>"XFAIL", cat=>$UNTESTED_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200150 {was=>"UNTESTED", is=>"UNSUPPORTED",cat=>$UNTESTED_UNSUPPORTED},
151 {was=>"UNTESTED", is=>"UNTESTED", cat=>$UNTESTED_UNTESTED},
152 {was=>"UNTESTED", is=>"UNRESOLVED",cat=>$UNTESTED_UNRESOLVED},
Christophe Lyona140aa82015-12-17 22:53:03 +0100153 {was=>"UNTESTED", is=>"NO_EXIST", cat=>$UNTESTED_DISAPPEARS},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200154 {was=>"NO_EXIST", is=>"UNTESTED", cat=>$UNTESTED_APPEARS},
Christophe Lyona140aa82015-12-17 22:53:03 +0100155
156 {was=>"UNRESOLVED", is=>"PASS", cat=>$UNRESOLVED_PASS},
157 {was=>"UNRESOLVED", is=>"XPASS", cat=>$UNRESOLVED_XPASS},
158 {was=>"UNRESOLVED", is=>"FAIL", cat=>$UNRESOLVED_FAIL},
159 {was=>"UNRESOLVED", is=>"XFAIL", cat=>$UNRESOLVED_XFAIL},
Christophe Lyon9dde3332016-06-28 23:00:00 +0200160 {was=>"UNRESOLVED", is=>"UNSUPPORTED",cat=>$UNRESOLVED_UNSUPPORTED},
161 {was=>"UNRESOLVED", is=>"UNTESTED", cat=>$UNRESOLVED_UNTESTED},
162 {was=>"UNRESOLVED", is=>"UNRESOLVED",cat=>$UNRESOLVED_UNRESOLVED},
Christophe Lyona140aa82015-12-17 22:53:03 +0100163 {was=>"UNRESOLVED", is=>"NO_EXIST", cat=>$UNRESOLVED_DISAPPEARS},
Christophe Lyondc66fc52016-04-05 17:38:07 +0200164 {was=>"NO_EXIST", is=>"UNRESOLVED", cat=>$UNRESOLVED_APPEARS},
Christophe Lyondc66fc52016-04-05 17:38:07 +0200165
Christophe Lyonbff39612015-11-18 16:29:11 +0100166# {was=>"NO_EXIST", is=>"NO_EXIST", handler=>\&handle_not_yet_supported}
167);
168
169######################################################
170# TREAT ARGUMENTS
171
172my $verbose=0;
173my $quiet=0;
174my $long=0;
175my $short=0;
176my $debug=0;
177my ($testroot, $basename);
178my ($ref_file_name, $res_file_name);
179my $nounstable=0;
180my $unstablefile=0;
181my @unstable_markers=();
182
183GetOptions ("l" => \$long,
184 "s" => \$short,
185 "q" => \$quiet,
186 "v" => \$verbose,
187 "dbg" => \$debug,
188 "testroot=s" => \$testroot,
189 "basename=s" => \$basename,
190 "no-unstable" => \$nounstable,
191 "unstable-tests=s" => \$unstablefile,
192 "unstable-marker=s" => \@unstable_markers);
193
194$ref_file_name = $ARGV[0] if ($#ARGV == 1);
195$res_file_name = $ARGV[1] if ($#ARGV == 1);
196
197$ref_file_name = $testroot."/expected_results/".$basename if ($testroot and $basename);
198$res_file_name = $testroot."/testing/run/".$basename if ($testroot and $basename);
199&usage if (not $ref_file_name or not $res_file_name);
200
201my ($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
202 = ("\033[31;1m","\033[31;3m","\033[32;1m","\033[32;3m","\033[35;1m","\033[35;2m","\033[0m");
203($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
204 = ("","","","","","","") if (not I_am_interactive());
205
206######################################################
207# MAIN PROGRAM
208# print "comparing $ref_file_name $res_file_name\n";
209
210# If none of the 2 .sum exists, nothing to compare: exit early.
211exit 0 if ( (! -e $ref_file_name) && (! -e $res_file_name ));
212
213my $ref = read_sum($ref_file_name) ;
214my $res = read_sum($res_file_name) ;
215my @unstablelist = ();
216
217@unstablelist = read_unstable($unstablefile) if ($unstablefile ne 0);
218
219compare_results($ref, $res);
220
221my $final_result = print_compare_results_summary($ref, $res);
222
223exit $final_result;
224
225######################################################
226# UTILITIES
227
228sub empty_result()
229{
230 my %empty_result;# = {PASS=>0, FAIL=>0, XPASS=>0, XFAIL=>0, UNSUPPORTED=>0, UNTESTED=>0, UNRESOLVED=>0};
231 $empty_result{PASS}=$empty_result{FAIL}=$empty_result{XPASS}=$empty_result{XFAIL}=0;
232 $empty_result{UNSUPPORTED}=$empty_result{UNTESTED}=$empty_result{UNRESOLVED}=$empty_result{NO_EXIST}=0;
233 return \%empty_result;
234}
235sub I_am_interactive {
236 return -t STDIN && -t STDOUT;
237}
238sub usage()
239{
240 print "Usage : $app <ref_file.sum> <result_file.sum>\n";
241 exit 1;
242}
243
244
245######################################################
246# PARSING
247sub read_sum($)
248{
249 my ($sum_file) = @_;
250 my $res = empty_result();
251 my %testcases;
252 my %unsupported;
253 $res->{testcases} = \%testcases;
254 my $pending_timeout=0;
255
Christophe Lyonad8c7242016-02-03 13:04:28 +0100256 $res->{EXEC}->{PASS} = 0;
257 $res->{EXEC}->{FAIL} = 0;
258
Christophe Lyonbff39612015-11-18 16:29:11 +0100259 open SUMFILE, $sum_file or die $!;
260 while (<SUMFILE>)
261 {
262 if (m/^(PASS|XPASS|FAIL|XFAIL|UNSUPPORTED|UNTESTED|UNRESOLVED): (.*)/)
263 {
264 my ($diag,$tc) = ($1,$2);
265 my %tcresult;
266 $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./;
267 $testcases{$tc} = empty_result() if (not exists $testcases{$tc});
268 $testcases{$tc}->{$diag}++;
269 $testcases{$tc}->{HAS_TIMED_OUT} = $pending_timeout;
270 $pending_timeout = 0;
271 $res->{$diag}++;
Christophe Lyonad8c7242016-02-03 13:04:28 +0100272 # Count execution tests, for a sanity check
273 if ($tc =~ /execution/)
274 {
275 $res->{EXEC}->{$diag}++;
276 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100277 }
278 elsif (m/WARNING: program timed out/)
279 {
280 $pending_timeout = 1;
281 }
282 elsif (m/^(# of expected passes|# of unexpected failures|# of expected failures|# of known failures|# of unsupported tests|# of untested testcases)\s+(.*)/)
283 {
284 $res->{"summary - "."$1"} = $2;
285 }
286 elsif (m/^\/.*\/([^\/]+)\s+version\s+(.*)/)
287 {
288 $res->{tool} = $1;
289 $res->{version} = $2;
290 $res->{version} =~ s/ [-(].*//;
291 }
292 }
293 close SUMFILE;
294 return $res;
295}
296
297# Parse list on unstable tests
298sub read_unstable($)
299{
300 my ($unstable_file) = @_;
301 my @unstable_tests = ();
302
303 open UNSTABLEFILE, $unstable_file or die $!;
304 while (<UNSTABLEFILE>)
305 {
306 # Skip lines starting with '#', or with spaces only
307 if ((/^#/) || (/^[ ]*$/))
308 {
309 }
310 else
311 {
312 chomp;
313
314 my $test = $_;
315
316 # Check if line is of type: target:testname
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100317 if (/^(.*?):/)
Christophe Lyonbff39612015-11-18 16:29:11 +0100318 {
319 foreach my $unstable_marker (@unstable_markers)
320 {
321 if ($unstable_marker eq $1) {
322 # If target matches the one supplied as script
323 # argument, add the testname to the list
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100324 $test =~ s/.*?://;
Christophe Lyonbff39612015-11-18 16:29:11 +0100325 push @unstable_tests, $test;
326 }
327 }
328 } else {
329 push @unstable_tests, $test;
330 }
331 }
332 }
333 close UNSTABLEFILE;
334 return @unstable_tests;
335}
336
337######################################################
338# DIFFING
339sub handle_pass_fail($$$$)
340{
341 my ($ref, $res, $diag_diag, $tc) = @_;
342 if ($res->{testcases}->{$tc}->{HAS_TIMED_OUT})
343 {
344 push @{$res->{$PASSED_NOW_TIMEOUTS}}, $tc;
345 }
346 else
347 {
Christophe Lyondded4d82016-06-28 18:12:38 +0200348 push @{$res->{$PASS_FAIL}}, $tc;
Christophe Lyonbff39612015-11-18 16:29:11 +0100349 }
350}
351
352sub compare_results($$)
353{
354 my ($ref, $res) = @_;
355
Christophe Lyondded4d82016-06-28 18:12:38 +0200356 @{$res->{$PASS_PASS}} = ();
Christophe Lyondded4d82016-06-28 18:12:38 +0200357 @{$res->{$PASS_XPASS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200358 @{$res->{$PASS_FAIL}} = ();
359 @{$res->{$PASS_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200360 @{$res->{$PASS_UNSUPPORTED}} = ();
361 @{$res->{$PASS_UNTESTED}} = ();
362 @{$res->{$PASS_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200363 @{$res->{$PASS_DISAPPEARS}} = ();
364 @{$res->{$PASS_APPEARS}} = ();
365 @{$res->{$PASSED_NOW_TIMEOUTS}} = ();
366
Christophe Lyondded4d82016-06-28 18:12:38 +0200367 @{$res->{$XPASS_PASS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200368 @{$res->{$XPASS_XPASS}} = ();
369 @{$res->{$XPASS_FAIL}} = ();
370 @{$res->{$XPASS_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200371 @{$res->{$XPASS_UNSUPPORTED}} = ();
372 @{$res->{$XPASS_UNTESTED}} = ();
373 @{$res->{$XPASS_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200374 @{$res->{$XPASS_DISAPPEARS}} = ();
375 @{$res->{$XPASS_APPEARS}} = ();
376
377 @{$res->{$FAIL_PASS}} = ();
378 @{$res->{$FAIL_XPASS}} = ();
379 @{$res->{$FAIL_FAIL}} = ();
380 @{$res->{$FAIL_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200381 @{$res->{$FAIL_UNSUPPORTED}} = ();
382 @{$res->{$FAIL_UNTESTED}} = ();
383 @{$res->{$FAIL_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200384 @{$res->{$FAIL_DISAPPEARS}} = ();
385 @{$res->{$FAIL_APPEARS}} = ();
386
Christophe Lyondded4d82016-06-28 18:12:38 +0200387 @{$res->{$XFAIL_PASS}} = ();
388 @{$res->{$XFAIL_XPASS}} = ();
389 @{$res->{$XFAIL_FAIL}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200390 @{$res->{$XFAIL_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200391 @{$res->{$XFAIL_UNSUPPORTED}} = ();
392 @{$res->{$XFAIL_UNTESTED}} = ();
393 @{$res->{$XFAIL_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200394 @{$res->{$XFAIL_DISAPPEARS}} = ();
395 @{$res->{$XFAIL_APPEARS}} = ();
396
Christophe Lyona140aa82015-12-17 22:53:03 +0100397 @{$res->{$UNSUPPORTED_PASS}} = ();
398 @{$res->{$UNSUPPORTED_XPASS}} = ();
399 @{$res->{$UNSUPPORTED_FAIL}} = ();
400 @{$res->{$UNSUPPORTED_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200401 @{$res->{$UNSUPPORTED_UNSUPPORTED}} = ();
402 @{$res->{$UNSUPPORTED_UNTESTED}} = ();
403 @{$res->{$UNSUPPORTED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100404 @{$res->{$UNSUPPORTED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200405 @{$res->{$UNSUPPORTED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200406
Christophe Lyona140aa82015-12-17 22:53:03 +0100407 @{$res->{$UNTESTED_PASS}} = ();
408 @{$res->{$UNTESTED_XPASS}} = ();
409 @{$res->{$UNTESTED_FAIL}} = ();
410 @{$res->{$UNTESTED_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200411 @{$res->{$UNTESTED_UNSUPPORTED}} = ();
412 @{$res->{$UNTESTED_UNTESTED}} = ();
413 @{$res->{$UNTESTED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100414 @{$res->{$UNTESTED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200415 @{$res->{$UNTESTED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200416
Christophe Lyona140aa82015-12-17 22:53:03 +0100417 @{$res->{$UNRESOLVED_PASS}} = ();
418 @{$res->{$UNRESOLVED_XPASS}} = ();
419 @{$res->{$UNRESOLVED_FAIL}} = ();
420 @{$res->{$UNRESOLVED_XFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200421 @{$res->{$UNRESOLVED_UNSUPPORTED}} = ();
422 @{$res->{$UNRESOLVED_UNTESTED}} = ();
423 @{$res->{$UNRESOLVED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100424 @{$res->{$UNRESOLVED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200425 @{$res->{$UNRESOLVED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200426
Christophe Lyonbff39612015-11-18 16:29:11 +0100427 @{$res->{$UNHANDLED_CASES}} = ();
428 @{$res->{$UNSTABLE_CASES}} = ();
429
430 #### MERGE REF AND RES
431 foreach my $key (sort (keys %{$res->{testcases}}))
432 {
433 if (not exists $ref->{testcases}->{$key}) {
434 $ref->{testcases}->{$key} = empty_result();
435 $ref->{testcases}->{$key}->{NO_EXIST} = 1;
436 }
437 }
438 foreach my $key (keys %{$ref->{testcases}})
439 {
440 if (not exists $res->{testcases}->{$key})
441 {
442 $res->{testcases}->{$key} = empty_result();
443 $res->{testcases}->{$key}->{NO_EXIST} = 1;
444 }
445 }
446
447 #### ACTIONS FOR EACH CASES
448 my %unstable_found;
449
450 foreach my $key (sort (keys %{$ref->{testcases}}))
451 {
452 foreach my $diag_diag (@handler_list)
453 {
454 if ($ref->{testcases}->{$key}->{$diag_diag->{was}} != $res->{testcases}->{$key}->{$diag_diag->{was}}
455 and $res->{testcases}->{$key}->{$diag_diag->{is}})
456 {
Christophe Lyondc66fc52016-04-05 17:38:07 +0200457 print "$key ref was:$ref->{testcases}->{$key}->{$diag_diag->{was}}, res was:$res->{testcases}->{$key}->{$diag_diag->{was}}, res is:$res->{testcases}->{$key}->{$diag_diag->{is}} \n" if ($debug);
Christophe Lyonbff39612015-11-18 16:29:11 +0100458 # If testcase is listed as 'unstable' mark it as
459 # such and skip other processing.
460 {
461 if (grep { (index $key,$_)!=-1} @unstablelist)
462 {
463 print "[unstable] $key\n" if ($debug);
464 $unstable_found{$key}=1;
465 }
466 else {
467 print "[$diag_diag->{was} => $diag_diag->{is}] $key\n" if ($debug);
468 if ($diag_diag->{handler})
469 {
470 $diag_diag->{handler} ($ref, $res, $diag_diag, $key);
471 }
472 else
473 {
474 push @{$res->{$diag_diag->{cat}}}, $key;
475 }
476 }
477 }
478 }
479 }
480 }
481 push @{$res->{$UNSTABLE_CASES}}, (sort (keys (%unstable_found))) if ($nounstable == 0);
482
483}
484
485######################################################
486# PRINTING
487sub print_tclist($@)
488{
489 my ($cat, @tclist) = @_;
490 print " - ".$cat.":\n\n ". join("\n ",@tclist) . "\n\n" if (scalar(@tclist));
491}
492
493sub print_compare_results_summary($$)
494{
495 my ($ref, $res) = @_;
496 my $return_value=0;
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100497 my $total_better = 0;
Christophe Lyonbff39612015-11-18 16:29:11 +0100498 my $rtotal = 0;
499 my $quiet_reg = $quiet;
Christophe Lyond618f662016-02-02 19:07:58 +0100500 my $ref_ratio = 0;
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200501 my $ref_total = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100502 my $res_ratio = 0;
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200503 my $res_total = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100504 my $ratio_thresh = 0.95; # Warn if pass ratio is below this threshold
Christophe Lyonad8c7242016-02-03 13:04:28 +0100505 my $ignore_exec = 0;
506 my $ref_has_exec_tests = 0;
507 my $res_has_exec_tests = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100508
509 # Compute the pass ratio as a sanity check
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200510 $ref_total = $ref->{PASS} +
511 $ref->{XFAIL} +
512 $ref->{XPASS} +
513 $ref->{FAIL} +
514 $ref->{UNRESOLVED} +
515 $ref->{UNSUPPORTED} +
516 $ref->{UNTESTED};
517
518 # It is possible that no test is executed at all (for instance if
519 # RUNTESTFLAGS was too restrictive). Avoid division by 0.
520 if ($ref_total > 0) {
521 $ref_ratio = ($ref->{PASS} + $ref->{XFAIL}) /
522 $ref_total;
523 }
524
525 $res_total = $res->{PASS} +
526 $res->{XFAIL} +
527 $res->{XPASS} +
528 $res->{FAIL} +
529 $res->{UNRESOLVED} +
530 $res->{UNSUPPORTED} +
531 $res->{UNTESTED};
532
533 if ($res_total > 0) {
534 $res_ratio = ($res->{PASS} + $res->{XFAIL}) /
535 $res_total;
536 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100537
538 if (not $quiet)
539 {
540 printf "Comparing:\n";
541 printf "REFERENCE:$ref_file_name\n";
542 printf "CURRENT: $res_file_name\n\n";
543 }
544
545 #### TESTS STATUS
546 if (not $quiet and not $short)
547 {
548 printf " ` +---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100549 printf "o RUN STATUS: | REF | RES |\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100550 printf " +------------------------------------------+---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100551 printf " | %-40s | %7d | %7d |\n", "Passes [PASS]", $ref->{PASS}, $res->{PASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100552 printf " | %-40s | %7d | %7d |\n", "Unexpected fails [FAIL]", $ref->{FAIL}, $res->{FAIL};
Christophe Lyona140aa82015-12-17 22:53:03 +0100553 printf " | %-40s | %7d | %7d |\n", "Unexpected passes [XPASS]", $ref->{XPASS}, $res->{XPASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100554 printf " | %-40s | %7d | %7d |\n", "Expected fails [XFAIL]", $ref->{XFAIL}, $res->{XFAIL};
555 printf " | %-40s | %7d | %7d |\n", "Unresolved [UNRESOLVED]", $ref->{UNRESOLVED}, $res->{UNRESOLVED};
Christophe Lyona140aa82015-12-17 22:53:03 +0100556 printf " | %-40s | %7d | %7d |\n", "Unsupported [UNSUPPORTED]", $ref->{UNSUPPORTED}, $res->{UNSUPPORTED};
557 printf " | %-40s | %7d | %7d |\n", "Untested [UNTESTED]", $ref->{UNTESTED}, $res->{UNTESTED};
Christophe Lyonbff39612015-11-18 16:29:11 +0100558 printf " +------------------------------------------+---------+---------+\n";
559 printf "\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100560
Christophe Lyon3d195c22016-04-06 16:00:25 +0200561 printf " REF PASS ratio: %f\n", $ref_ratio;
562 printf " RES PASS ratio: %f\n", $res_ratio;
Christophe Lyond618f662016-02-02 19:07:58 +0100563 if ($ref_ratio < $ratio_thresh)
564 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100565 printf " ***** ERROR: REF PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100566 }
567 if ($res_ratio < $ratio_thresh)
568 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100569 printf " ***** ERROR: RES PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100570 }
571
Christophe Lyonad8c7242016-02-03 13:04:28 +0100572 # If both PASS and FAIL EXEC tests are zero, assume there is no
573 # execution test for this tool, and do not warn.
574 $ref_has_exec_tests = ($ref->{EXEC}->{PASS} + $ref->{EXEC}->{FAIL}) != 0;
575 if ($ref_has_exec_tests)
576 {
577 printf " ***** ERROR: No REF execution test PASSed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{PASS} == 0);
578 printf " ***** WARNING: No REF execution test FAILed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{FAIL} == 0);
579 }
580
581 $res_has_exec_tests = ($res->{EXEC}->{PASS} + $res->{EXEC}->{FAIL}) != 0;
582 if ($res_has_exec_tests)
583 {
584 printf " ***** ERROR: No RES execution test PASSed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{PASS} == 0);
585 printf " ***** WARNING: No RES execution test FAILed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{FAIL} == 0);
586 }
587
588 # Ignore number of execution tests when computing the return
589 # value, if both REF and RES have no execution test.
590 $ignore_exec = !$ref_has_exec_tests && !$res_has_exec_tests;
Christophe Lyonbff39612015-11-18 16:29:11 +0100591 }
592
593 #### REGRESSIONS ?
Christophe Lyon9dde3332016-06-28 23:00:00 +0200594 $rtotal = scalar(@{$res->{$PASS_XPASS}})
595 +scalar(@{$res->{$PASS_FAIL}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200596 +scalar(@{$res->{$PASS_UNRESOLVED}})
597 +scalar(@{$res->{$PASSED_NOW_TIMEOUTS}})
598 +scalar(@{$res->{$XPASS_FAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100599 +scalar(@{$res->{$XPASS_APPEARS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200600 +scalar(@{$res->{$XPASS_UNRESOLVED}})
601 +scalar(@{$res->{$FAIL_APPEARS}})
602 +scalar(@{$res->{$FAIL_UNRESOLVED}})
Christophe Lyondded4d82016-06-28 18:12:38 +0200603 +scalar(@{$res->{$XFAIL_FAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100604 +scalar(@{$res->{$XFAIL_DISAPPEARS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200605 +scalar(@{$res->{$XFAIL_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100606 +scalar(@{$res->{$UNSUPPORTED_FAIL}})
607 +scalar(@{$res->{$UNSUPPORTED_XPASS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200608 +scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100609 +scalar(@{$res->{$UNTESTED_FAIL}})
610 +scalar(@{$res->{$UNTESTED_XPASS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200611 +scalar(@{$res->{$UNTESTED_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100612 +scalar(@{$res->{$UNRESOLVED_FAIL}})
613 +scalar(@{$res->{$UNRESOLVED_XPASS}})
Christophe Lyon31279df2016-07-04 17:02:12 +0200614 +scalar(@{$res->{$UNRESOLVED_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100615
616 $quiet_reg=1 if ($short and not $rtotal);
Christophe Lyonbff39612015-11-18 16:29:11 +0100617
618 if (not $quiet_reg)
619 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100620 printf "\n$col_red"."o REGRESSIONS:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100621 printf " +------------------------------------------+---------+\n";
Christophe Lyondded4d82016-06-28 18:12:38 +0200622 printf " | %-40s | %7d |\n", $PASS_XPASS, scalar(@{$res->{$PASS_XPASS}}) if (scalar(@{$res->{$PASS_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200623 printf " | %-40s | %7d |\n", $PASS_FAIL, scalar(@{$res->{$PASS_FAIL}}) if (scalar(@{$res->{$PASS_FAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200624 printf " | %-40s | %7d |\n", $PASS_UNRESOLVED, scalar(@{$res->{$PASS_UNRESOLVED}}) if (scalar(@{$res->{$PASS_UNRESOLVED}}));
625 printf " | %-40s | %7d |\n", $PASSED_NOW_TIMEOUTS, scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}) if (scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}));
626 printf " | %-40s | %7d |\n", $XPASS_FAIL, scalar(@{$res->{$XPASS_FAIL}}) if (scalar(@{$res->{$XPASS_FAIL}}));
627 printf " | %-40s | %7d |\n", $XPASS_APPEARS, scalar(@{$res->{$XPASS_APPEARS}}) if (scalar(@{$res->{$XPASS_APPEARS}}));
628 printf " | %-40s | %7d |\n", $XPASS_UNRESOLVED, scalar(@{$res->{$XPASS_UNRESOLVED}}) if (scalar(@{$res->{$XPASS_UNRESOLVED}}));
629 printf " | %-40s | %7d |\n", $FAIL_APPEARS, scalar(@{$res->{$FAIL_APPEARS}}) if (scalar(@{$res->{$FAIL_APPEARS}}));
630 printf " | %-40s | %7d |\n", $FAIL_UNRESOLVED, scalar(@{$res->{$FAIL_UNRESOLVED}}) if (scalar(@{$res->{$FAIL_UNRESOLVED}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200631 printf " | %-40s | %7d |\n", $XFAIL_FAIL, scalar(@{$res->{$XFAIL_FAIL}}) if (scalar(@{$res->{$XFAIL_FAIL}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100632 printf " | %-40s | %7d |\n", $XFAIL_DISAPPEARS, scalar(@{$res->{$XFAIL_DISAPPEARS}}) if (scalar(@{$res->{$XFAIL_DISAPPEARS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200633 printf " | %-40s | %7d |\n", $XFAIL_UNRESOLVED, scalar(@{$res->{$XFAIL_UNRESOLVED}}) if (scalar(@{$res->{$XFAIL_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100634 printf " | %-40s | %7d |\n", $UNSUPPORTED_FAIL, scalar(@{$res->{$UNSUPPORTED_FAIL}}) if (scalar(@{$res->{$UNSUPPORTED_FAIL}}));
635 printf " | %-40s | %7d |\n", $UNSUPPORTED_XPASS, scalar(@{$res->{$UNSUPPORTED_XPASS}}) if (scalar(@{$res->{$UNSUPPORTED_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200636 printf " | %-40s | %7d |\n", $UNSUPPORTED_UNRESOLVED, scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}}) if (scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100637 printf " | %-40s | %7d |\n", $UNTESTED_FAIL, scalar(@{$res->{$UNTESTED_FAIL}}) if (scalar(@{$res->{$UNTESTED_FAIL}}));
638 printf " | %-40s | %7d |\n", $UNTESTED_XPASS, scalar(@{$res->{$UNTESTED_XPASS}}) if (scalar(@{$res->{$UNTESTED_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200639 printf " | %-40s | %7d |\n", $UNTESTED_UNRESOLVED, scalar(@{$res->{$UNTESTED_UNRESOLVED}}) if (scalar(@{$res->{$UNTESTED_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100640 printf " | %-40s | %7d |\n", $UNRESOLVED_FAIL, scalar(@{$res->{$UNRESOLVED_FAIL}}) if (scalar(@{$res->{$UNRESOLVED_FAIL}}));
641 printf " | %-40s | %7d |\n", $UNRESOLVED_XPASS, scalar(@{$res->{$UNRESOLVED_XPASS}}) if (scalar(@{$res->{$UNRESOLVED_XPASS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200642 printf " | %-40s | %7d |\n", $UNRESOLVED_APPEARS, scalar(@{$res->{$UNRESOLVED_APPEARS}}) if (scalar(@{$res->{$UNRESOLVED_APPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100643 printf " +------------------------------------------+---------+\n";
644 printf " | %-40s | %7d |\n", "TOTAL_REGRESSIONS", $rtotal;
645 printf " +------------------------------------------+---------+\n";
646 printf "\n";
647
648 if ($long)
649 {
Christophe Lyondded4d82016-06-28 18:12:38 +0200650 print_tclist($PASS_XPASS, @{$res->{$PASS_XPASS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200651 print_tclist($PASS_FAIL, @{$res->{$PASS_FAIL}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200652 print_tclist($PASS_UNRESOLVED, @{$res->{$PASS_UNRESOLVED}});
653 print_tclist($PASSED_NOW_TIMEOUTS, @{$res->{$PASSED_NOW_TIMEOUTS}});
654 print_tclist($XPASS_FAIL, @{$res->{$XPASS_FAIL}});
655 print_tclist($XPASS_APPEARS, @{$res->{$XPASS_APPEARS}});
656 print_tclist($XPASS_UNRESOLVED, @{$res->{$XPASS_UNRESOLVED}});
657 print_tclist($FAIL_APPEARS, @{$res->{$FAIL_APPEARS}});
658 print_tclist($FAIL_UNRESOLVED, @{$res->{$FAIL_UNRESOLVED}});
Christophe Lyondded4d82016-06-28 18:12:38 +0200659 print_tclist($XFAIL_FAIL, @{$res->{$XFAIL_FAIL}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100660 print_tclist($XFAIL_DISAPPEARS, @{$res->{$XFAIL_DISAPPEARS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200661 print_tclist($XFAIL_UNRESOLVED, @{$res->{$XFAIL_UNRESOLVED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100662 print_tclist($UNSUPPORTED_FAIL, @{$res->{$UNSUPPORTED_FAIL}});
663 print_tclist($UNSUPPORTED_XPASS, @{$res->{$UNSUPPORTED_XPASS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200664 print_tclist($UNSUPPORTED_UNRESOLVED, @{$res->{$UNSUPPORTED_UNRESOLVED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100665 print_tclist($UNTESTED_FAIL, @{$res->{$UNTESTED_FAIL}});
666 print_tclist($UNTESTED_XPASS, @{$res->{$UNTESTED_XPASS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200667 print_tclist($UNTESTED_UNRESOLVED, @{$res->{$UNTESTED_UNRESOLVED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100668 print_tclist($UNRESOLVED_FAIL, @{$res->{$UNRESOLVED_FAIL}});
669 print_tclist($UNRESOLVED_XPASS, @{$res->{$UNRESOLVED_XPASS}});
Christophe Lyondc66fc52016-04-05 17:38:07 +0200670 print_tclist($UNRESOLVED_APPEARS, @{$res->{$UNRESOLVED_APPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100671 }
672 printf "$col_reset\n";
673 }
674
675 #### MINOR TO BE CHECKED ?
676 if (not $quiet and not $short)
677 {
Christophe Lyon9dde3332016-06-28 23:00:00 +0200678 $total_better =
Christophe Lyon31279df2016-07-04 17:02:12 +0200679 scalar(@{$res->{$PASS_DISAPPEARS}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200680 scalar(@{$res->{$PASS_XFAIL}})+
681 scalar(@{$res->{$PASS_APPEARS}})+
682 scalar(@{$res->{$PASS_UNSUPPORTED}})+
683 scalar(@{$res->{$PASS_UNTESTED}})+
684 scalar(@{$res->{$XPASS_PASS}})+
685 scalar(@{$res->{$XPASS_XFAIL}})+
686 scalar(@{$res->{$XPASS_UNSUPPORTED}})+
687 scalar(@{$res->{$XPASS_UNTESTED}})+
688 scalar(@{$res->{$XPASS_DISAPPEARS}})+
Christophe Lyondded4d82016-06-28 18:12:38 +0200689 scalar(@{$res->{$FAIL_PASS}})+
690 scalar(@{$res->{$FAIL_XPASS}})+
Christophe Lyondded4d82016-06-28 18:12:38 +0200691 scalar(@{$res->{$FAIL_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200692 scalar(@{$res->{$FAIL_UNSUPPORTED}})+
693 scalar(@{$res->{$FAIL_UNTESTED}})+
694 scalar(@{$res->{$FAIL_DISAPPEARS}})+
695 scalar(@{$res->{$XFAIL_PASS}})+
696 scalar(@{$res->{$XFAIL_XPASS}})+
697 scalar(@{$res->{$XFAIL_UNSUPPORTED}})+
698 scalar(@{$res->{$XFAIL_UNTESTED}})+
699 scalar(@{$res->{$XFAIL_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100700 scalar(@{$res->{$UNSUPPORTED_PASS}})+
701 scalar(@{$res->{$UNSUPPORTED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200702 scalar(@{$res->{$UNSUPPORTED_UNTESTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100703 scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}})+
Christophe Lyondc66fc52016-04-05 17:38:07 +0200704 scalar(@{$res->{$UNSUPPORTED_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100705 scalar(@{$res->{$UNTESTED_PASS}})+
706 scalar(@{$res->{$UNTESTED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200707 scalar(@{$res->{$UNTESTED_UNSUPPORTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100708 scalar(@{$res->{$UNTESTED_DISAPPEARS}})+
Christophe Lyondc66fc52016-04-05 17:38:07 +0200709 scalar(@{$res->{$UNTESTED_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100710 scalar(@{$res->{$UNRESOLVED_PASS}})+
711 scalar(@{$res->{$UNRESOLVED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200712 scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}})+
713 scalar(@{$res->{$UNRESOLVED_UNTESTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100714 scalar(@{$res->{$UNRESOLVED_DISAPPEARS}})+
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100715 scalar(@{$res->{$UNHANDLED_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100716
Christophe Lyona140aa82015-12-17 22:53:03 +0100717 printf "$col_pink"."o MINOR TO BE CHECKED:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100718 printf " +------------------------------------------+---------+\n";
Christophe Lyon31279df2016-07-04 17:02:12 +0200719 printf " | %-40s | %7d |\n", $PASS_DISAPPEARS, scalar(@{$res->{$PASS_DISAPPEARS}}) if (scalar(@{$res->{$PASS_DISAPPEARS}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200720 printf " | %-40s | %7d |\n", $PASS_XFAIL, scalar(@{$res->{$PASS_XFAIL}}) if (scalar(@{$res->{$PASS_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200721 printf " | %-40s | %7d |\n", $PASS_APPEARS, scalar(@{$res->{$PASS_APPEARS}}) if (scalar(@{$res->{$PASS_APPEARS}}));
722 printf " | %-40s | %7d |\n", $PASS_UNSUPPORTED, scalar(@{$res->{$PASS_UNSUPPORTED}}) if (scalar(@{$res->{$PASS_UNSUPPORTED}}));
723 printf " | %-40s | %7d |\n", $PASS_UNTESTED, scalar(@{$res->{$PASS_UNTESTED}}) if (scalar(@{$res->{$PASS_UNTESTED}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200724 printf " | %-40s | %7d |\n", $XPASS_PASS, scalar(@{$res->{$XPASS_PASS}}) if (scalar(@{$res->{$XPASS_PASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200725 printf " | %-40s | %7d |\n", $XPASS_XFAIL, scalar(@{$res->{$XPASS_XFAIL}}) if (scalar(@{$res->{$XPASS_XFAIL}}));
726 printf " | %-40s | %7d |\n", $XPASS_UNSUPPORTED, scalar(@{$res->{$XPASS_UNSUPPORTED}}) if (scalar(@{$res->{$XPASS_UNSUPPORTED}}));
727 printf " | %-40s | %7d |\n", $XPASS_UNTESTED, scalar(@{$res->{$XPASS_UNTESTED}}) if (scalar(@{$res->{$XPASS_UNTESTED}}));
728 printf " | %-40s | %7d |\n", $XPASS_DISAPPEARS, scalar(@{$res->{$XPASS_DISAPPEARS}}) if (scalar(@{$res->{$XPASS_DISAPPEARS}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200729 printf " | %-40s | %7d |\n", $FAIL_PASS, scalar(@{$res->{$FAIL_PASS}}) if (scalar(@{$res->{$FAIL_PASS}}));
730 printf " | %-40s | %7d |\n", $FAIL_XPASS, scalar(@{$res->{$FAIL_XPASS}}) if (scalar(@{$res->{$FAIL_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200731 printf " | %-40s | %7d |\n", $FAIL_XFAIL, scalar(@{$res->{$FAIL_XFAIL}}) if (scalar(@{$res->{$FAIL_XFAIL}}));
732 printf " | %-40s | %7d |\n", $FAIL_UNSUPPORTED, scalar(@{$res->{$FAIL_UNSUPPORTED}}) if (scalar(@{$res->{$FAIL_UNSUPPORTED}}));
733 printf " | %-40s | %7d |\n", $FAIL_UNTESTED, scalar(@{$res->{$FAIL_UNTESTED}}) if (scalar(@{$res->{$FAIL_UNTESTED}}));
734 printf " | %-40s | %7d |\n", $FAIL_DISAPPEARS, scalar(@{$res->{$FAIL_DISAPPEARS}}) if (scalar(@{$res->{$FAIL_DISAPPEARS}}));
735 printf " | %-40s | %7d |\n", $XFAIL_PASS, scalar(@{$res->{$XFAIL_PASS}}) if (scalar(@{$res->{$XFAIL_PASS}}));
736 printf " | %-40s | %7d |\n", $XFAIL_XPASS, scalar(@{$res->{$XFAIL_XPASS}}) if (scalar(@{$res->{$XFAIL_XPASS}}));
737 printf " | %-40s | %7d |\n", $XFAIL_UNSUPPORTED, scalar(@{$res->{$XFAIL_UNSUPPORTED}}) if (scalar(@{$res->{$XFAIL_UNSUPPORTED}}));
738 printf " | %-40s | %7d |\n", $XFAIL_UNTESTED, scalar(@{$res->{$XFAIL_UNTESTED}}) if (scalar(@{$res->{$XFAIL_UNTESTED}}));
739 printf " | %-40s | %7d |\n", $XFAIL_APPEARS, scalar(@{$res->{$XFAIL_APPEARS}}) if (scalar(@{$res->{$XFAIL_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100740 printf " | %-40s | %7d |\n", $UNSUPPORTED_PASS, scalar(@{$res->{$UNSUPPORTED_PASS}}) if (scalar(@{$res->{$UNSUPPORTED_PASS}}));
741 printf " | %-40s | %7d |\n", $UNSUPPORTED_XFAIL, scalar(@{$res->{$UNSUPPORTED_XFAIL}}) if (scalar(@{$res->{$UNSUPPORTED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200742 printf " | %-40s | %7d |\n", $UNSUPPORTED_UNTESTED, scalar(@{$res->{$UNSUPPORTED_UNTESTED}}) if (scalar(@{$res->{$UNSUPPORTED_UNTESTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100743 printf " | %-40s | %7d |\n", $UNSUPPORTED_DISAPPEARS, scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200744 printf " | %-40s | %7d |\n", $UNSUPPORTED_APPEARS, scalar(@{$res->{$UNSUPPORTED_APPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100745 printf " | %-40s | %7d |\n", $UNTESTED_PASS, scalar(@{$res->{$UNTESTED_PASS}}) if (scalar(@{$res->{$UNTESTED_PASS}}));
746 printf " | %-40s | %7d |\n", $UNTESTED_XFAIL, scalar(@{$res->{$UNTESTED_XFAIL}}) if (scalar(@{$res->{$UNTESTED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200747 printf " | %-40s | %7d |\n", $UNTESTED_UNSUPPORTED, scalar(@{$res->{$UNTESTED_UNSUPPORTED}}) if (scalar(@{$res->{$UNTESTED_UNSUPPORTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100748 printf " | %-40s | %7d |\n", $UNTESTED_DISAPPEARS, scalar(@{$res->{$UNTESTED_DISAPPEARS}}) if (scalar(@{$res->{$UNTESTED_DISAPPEARS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200749 printf " | %-40s | %7d |\n", $UNTESTED_APPEARS, scalar(@{$res->{$UNTESTED_APPEARS}}) if (scalar(@{$res->{$UNTESTED_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100750 printf " | %-40s | %7d |\n", $UNRESOLVED_PASS, scalar(@{$res->{$UNRESOLVED_PASS}}) if (scalar(@{$res->{$UNRESOLVED_PASS}}));
751 printf " | %-40s | %7d |\n", $UNRESOLVED_XFAIL, scalar(@{$res->{$UNRESOLVED_XFAIL}}) if (scalar(@{$res->{$UNRESOLVED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200752 printf " | %-40s | %7d |\n", $UNRESOLVED_UNSUPPORTED, scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}}) if (scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}}));
753 printf " | %-40s | %7d |\n", $UNRESOLVED_UNTESTED, scalar(@{$res->{$UNRESOLVED_UNTESTED}}) if (scalar(@{$res->{$UNRESOLVED_UNTESTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100754 printf " | %-40s | %7d |\n", $UNRESOLVED_DISAPPEARS, scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}) if (scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100755 printf " | %-40s | %7d |\n", $UNHANDLED_CASES, scalar(@{$res->{$UNHANDLED_CASES}}) if (scalar(@{$res->{$UNHANDLED_CASES}}));
756 printf " | %-40s | %7d |\n", $UNSTABLE_CASES, scalar(@{$res->{$UNSTABLE_CASES}}) if (scalar(@{$res->{$UNSTABLE_CASES}}));
757 printf " +------------------------------------------+---------+\n";
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100758 printf " | %-40s | %7d |\n", "TOTAL_MINOR_TO_BE_CHECKED", $total_better + scalar(@{$res->{$UNSTABLE_CASES}});;
Christophe Lyonbff39612015-11-18 16:29:11 +0100759 printf " +------------------------------------------+---------+\n";
760 printf "\n";
761
762 if ($long)
763 {
Christophe Lyon31279df2016-07-04 17:02:12 +0200764 print_tclist($PASS_DISAPPEARS, @{$res->{$PASS_DISAPPEARS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200765 print_tclist($PASS_XFAIL, @{$res->{$PASS_XFAIL}});
766 print_tclist($PASS_APPEARS, @{$res->{$PASS_APPEARS}});
767 print_tclist($PASS_UNSUPPORTED, @{$res->{$PASS_UNSUPPORTED}});
768 print_tclist($PASS_UNTESTED, @{$res->{$PASS_UNTESTED}});
Christophe Lyondded4d82016-06-28 18:12:38 +0200769 print_tclist($XPASS_PASS, @{$res->{$XPASS_PASS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200770 print_tclist($XPASS_XFAIL, @{$res->{$XPASS_XFAIL}});
771 print_tclist($XPASS_UNSUPPORTED, @{$res->{$XPASS_UNSUPPORTED}});
772 print_tclist($XPASS_UNTESTED, @{$res->{$XPASS_UNTESTED}});
773 print_tclist($XPASS_DISAPPEARS, @{$res->{$XPASS_DISAPPEARS}});
Christophe Lyondded4d82016-06-28 18:12:38 +0200774 print_tclist($XFAIL_PASS, @{$res->{$XFAIL_PASS}});
775 print_tclist($XFAIL_XPASS, @{$res->{$XFAIL_XPASS}});
776 print_tclist($FAIL_PASS, @{$res->{$FAIL_PASS}});
777 print_tclist($FAIL_XPASS, @{$res->{$FAIL_XPASS}});
Christophe Lyondded4d82016-06-28 18:12:38 +0200778 print_tclist($FAIL_XFAIL, @{$res->{$FAIL_XFAIL}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200779 print_tclist($FAIL_UNSUPPORTED, @{$res->{$FAIL_UNSUPPORTED}});
780 print_tclist($FAIL_UNTESTED, @{$res->{$FAIL_UNTESTED}});
781 print_tclist($FAIL_DISAPPEARS, @{$res->{$FAIL_DISAPPEARS}});
782 print_tclist($XFAIL_PASS, @{$res->{$XFAIL_PASS}});
783 print_tclist($XFAIL_XPASS, @{$res->{$XFAIL_XPASS}});
784 print_tclist($XFAIL_UNSUPPORTED, @{$res->{$XFAIL_UNSUPPORTED}});
785 print_tclist($XFAIL_UNTESTED, @{$res->{$XFAIL_UNTESTED}});
786 print_tclist($XFAIL_APPEARS, @{$res->{$XFAIL_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100787 print_tclist($UNSUPPORTED_PASS, @{$res->{$UNSUPPORTED_PASS}});
788 print_tclist($UNSUPPORTED_XFAIL, @{$res->{$UNSUPPORTED_XFAIL}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200789 print_tclist($UNSUPPORTED_UNTESTED, @{$res->{$UNSUPPORTED_UNTESTED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100790 print_tclist($UNSUPPORTED_DISAPPEARS, @{$res->{$UNSUPPORTED_DISAPPEARS}});
Christophe Lyondc66fc52016-04-05 17:38:07 +0200791 print_tclist($UNSUPPORTED_APPEARS, @{$res->{$UNSUPPORTED_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100792 print_tclist($UNTESTED_PASS, @{$res->{$UNTESTED_PASS}});
793 print_tclist($UNTESTED_XFAIL, @{$res->{$UNTESTED_XFAIL}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200794 print_tclist($UNTESTED_UNSUPPORTED, @{$res->{$UNTESTED_UNSUPPORTED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100795 print_tclist($UNTESTED_DISAPPEARS, @{$res->{$UNTESTED_DISAPPEARS}});
Christophe Lyondc66fc52016-04-05 17:38:07 +0200796 print_tclist($UNTESTED_APPEARS, @{$res->{$UNTESTED_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100797 print_tclist($UNRESOLVED_PASS, @{$res->{$UNRESOLVED_PASS}});
798 print_tclist($UNRESOLVED_XFAIL, @{$res->{$UNRESOLVED_XFAIL}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200799 print_tclist($UNRESOLVED_UNSUPPORTED, @{$res->{$UNRESOLVED_UNSUPPORTED}});
800 print_tclist($UNRESOLVED_UNTESTED, @{$res->{$UNRESOLVED_UNTESTED}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100801 print_tclist($UNRESOLVED_DISAPPEARS, @{$res->{$UNRESOLVED_DISAPPEARS}});
Christophe Lyon9dde3332016-06-28 23:00:00 +0200802 print_tclist($UNHANDLED_CASES, @{$res->{$UNHANDLED_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100803 print_tclist($UNSTABLE_CASES, @{$res->{$UNSTABLE_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100804 }
805 printf "$col_reset\n";
806 }
807
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100808 $return_value = 1 if ($total_better);
Christophe Lyonbff39612015-11-18 16:29:11 +0100809
810 $return_value = 2 if ($rtotal);
811
Christophe Lyond618f662016-02-02 19:07:58 +0100812 # Error if there was no PASS (eg when sth went wrong and no .sum was generated)
813 $return_value = 2 if (($res->{PASS} + $res->{XFAIL}) == 0);
814
815 # Error if every test passed, or the ratio was too low. This
816 # generally means the simulator is not configured well.
817 $return_value = 2 if (($ref_ratio == 100) || ($ref_ratio < $ratio_thresh));
818 $return_value = 2 if (($res_ratio == 100) || ($res_ratio < $ratio_thresh));
Christophe Lyonbff39612015-11-18 16:29:11 +0100819
Christophe Lyonad8c7242016-02-03 13:04:28 +0100820 # Error if no execution test passed.
821 # It is possible that no execution test fails, though.
822 $return_value = 2 if (($ignore_exec == 0)
823 && (($ref->{EXEC}->{PASS} == 0)
824 || ($res->{EXEC}->{PASS} == 0)));
825
Christophe Lyonbff39612015-11-18 16:29:11 +0100826 return $return_value;
827}