blob: 0c49bd5e82a1660caa92b4a3cb4d3b6a522356f6 [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
Christophe Lyonad8c7242016-02-03 13:04:28 +0100206 $res->{EXEC}->{PASS} = 0;
207 $res->{EXEC}->{FAIL} = 0;
208
Christophe Lyonbff39612015-11-18 16:29:11 +0100209 open SUMFILE, $sum_file or die $!;
210 while (<SUMFILE>)
211 {
212 if (m/^(PASS|XPASS|FAIL|XFAIL|UNSUPPORTED|UNTESTED|UNRESOLVED): (.*)/)
213 {
214 my ($diag,$tc) = ($1,$2);
215 my %tcresult;
216 $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./;
217 $testcases{$tc} = empty_result() if (not exists $testcases{$tc});
218 $testcases{$tc}->{$diag}++;
219 $testcases{$tc}->{HAS_TIMED_OUT} = $pending_timeout;
220 $pending_timeout = 0;
221 $res->{$diag}++;
Christophe Lyonad8c7242016-02-03 13:04:28 +0100222 # Count execution tests, for a sanity check
223 if ($tc =~ /execution/)
224 {
225 $res->{EXEC}->{$diag}++;
226 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100227 }
228 elsif (m/WARNING: program timed out/)
229 {
230 $pending_timeout = 1;
231 }
232 elsif (m/^(# of expected passes|# of unexpected failures|# of expected failures|# of known failures|# of unsupported tests|# of untested testcases)\s+(.*)/)
233 {
234 $res->{"summary - "."$1"} = $2;
235 }
236 elsif (m/^\/.*\/([^\/]+)\s+version\s+(.*)/)
237 {
238 $res->{tool} = $1;
239 $res->{version} = $2;
240 $res->{version} =~ s/ [-(].*//;
241 }
242 }
243 close SUMFILE;
244 return $res;
245}
246
247# Parse list on unstable tests
248sub read_unstable($)
249{
250 my ($unstable_file) = @_;
251 my @unstable_tests = ();
252
253 open UNSTABLEFILE, $unstable_file or die $!;
254 while (<UNSTABLEFILE>)
255 {
256 # Skip lines starting with '#', or with spaces only
257 if ((/^#/) || (/^[ ]*$/))
258 {
259 }
260 else
261 {
262 chomp;
263
264 my $test = $_;
265
266 # Check if line is of type: target:testname
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100267 if (/^(.*?):/)
Christophe Lyonbff39612015-11-18 16:29:11 +0100268 {
269 foreach my $unstable_marker (@unstable_markers)
270 {
271 if ($unstable_marker eq $1) {
272 # If target matches the one supplied as script
273 # argument, add the testname to the list
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100274 $test =~ s/.*?://;
Christophe Lyonbff39612015-11-18 16:29:11 +0100275 push @unstable_tests, $test;
276 }
277 }
278 } else {
279 push @unstable_tests, $test;
280 }
281 }
282 }
283 close UNSTABLEFILE;
284 return @unstable_tests;
285}
286
287######################################################
288# DIFFING
289sub handle_pass_fail($$$$)
290{
291 my ($ref, $res, $diag_diag, $tc) = @_;
292 if ($res->{testcases}->{$tc}->{HAS_TIMED_OUT})
293 {
294 push @{$res->{$PASSED_NOW_TIMEOUTS}}, $tc;
295 }
296 else
297 {
298 push @{$res->{$PASSED_NOW_FAILS}}, $tc;
299 }
300}
301
302sub compare_results($$)
303{
304 my ($ref, $res) = @_;
305
306 @{$res->{$STILL_PASSES}} = ();
307 @{$res->{$STILL_FAILS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100308 @{$res->{$STILL_XPASS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100309 @{$res->{$PASSED_NOW_FAILS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100310 @{$res->{$XPASS_NOW_FAIL}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100311 @{$res->{$PASS_DISAPPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100312 @{$res->{$XPASS_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100313 @{$res->{$FAIL_APPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100314 @{$res->{$XPASS_APPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100315 @{$res->{$NEW_PASSES}} = ();
316 @{$res->{$FAIL_DISAPPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100317 @{$res->{$XFAIL_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100318 @{$res->{$XFAIL_APPEARS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100319 @{$res->{$FAIL_NOW_XFAIL}} = ();
320 @{$res->{$PASS_NOW_XFAIL}} = ();
321 @{$res->{$XPASS_NOW_XFAIL}} = ();
322 @{$res->{$XPASS_APPEARS}} = ();
323 @{$res->{$PASS_NOW_XPASS}} = ();
324 @{$res->{$XPASS_NOW_PASSES}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100325 @{$res->{$XFAIL_NOW_PASSES}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100326 @{$res->{$XFAIL_NOW_XPASS}} = ();
327 @{$res->{$XFAIL_NOW_FAIL}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100328 @{$res->{$FAIL_NOW_PASSES}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100329 @{$res->{$FAIL_NOW_XPASS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100330 @{$res->{$PASSED_NOW_TIMEOUTS}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100331 @{$res->{$UNSUPPORTED_PASS}} = ();
332 @{$res->{$UNSUPPORTED_XPASS}} = ();
333 @{$res->{$UNSUPPORTED_FAIL}} = ();
334 @{$res->{$UNSUPPORTED_XFAIL}} = ();
335 @{$res->{$UNSUPPORTED_DISAPPEARS}} = ();
336 @{$res->{$UNTESTED_PASS}} = ();
337 @{$res->{$UNTESTED_XPASS}} = ();
338 @{$res->{$UNTESTED_FAIL}} = ();
339 @{$res->{$UNTESTED_XFAIL}} = ();
340 @{$res->{$UNTESTED_DISAPPEARS}} = ();
341 @{$res->{$UNRESOLVED_PASS}} = ();
342 @{$res->{$UNRESOLVED_XPASS}} = ();
343 @{$res->{$UNRESOLVED_FAIL}} = ();
344 @{$res->{$UNRESOLVED_XFAIL}} = ();
345 @{$res->{$UNRESOLVED_DISAPPEARS}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100346 @{$res->{$UNHANDLED_CASES}} = ();
347 @{$res->{$UNSTABLE_CASES}} = ();
348
349 #### MERGE REF AND RES
350 foreach my $key (sort (keys %{$res->{testcases}}))
351 {
352 if (not exists $ref->{testcases}->{$key}) {
353 $ref->{testcases}->{$key} = empty_result();
354 $ref->{testcases}->{$key}->{NO_EXIST} = 1;
355 }
356 }
357 foreach my $key (keys %{$ref->{testcases}})
358 {
359 if (not exists $res->{testcases}->{$key})
360 {
361 $res->{testcases}->{$key} = empty_result();
362 $res->{testcases}->{$key}->{NO_EXIST} = 1;
363 }
364 }
365
366 #### ACTIONS FOR EACH CASES
367 my %unstable_found;
368
369 foreach my $key (sort (keys %{$ref->{testcases}}))
370 {
371 foreach my $diag_diag (@handler_list)
372 {
373 if ($ref->{testcases}->{$key}->{$diag_diag->{was}} != $res->{testcases}->{$key}->{$diag_diag->{was}}
374 and $res->{testcases}->{$key}->{$diag_diag->{is}})
375 {
376 # If testcase is listed as 'unstable' mark it as
377 # such and skip other processing.
378 {
379 if (grep { (index $key,$_)!=-1} @unstablelist)
380 {
381 print "[unstable] $key\n" if ($debug);
382 $unstable_found{$key}=1;
383 }
384 else {
385 print "[$diag_diag->{was} => $diag_diag->{is}] $key\n" if ($debug);
386 if ($diag_diag->{handler})
387 {
388 $diag_diag->{handler} ($ref, $res, $diag_diag, $key);
389 }
390 else
391 {
392 push @{$res->{$diag_diag->{cat}}}, $key;
393 }
394 }
395 }
396 }
397 }
398 }
399 push @{$res->{$UNSTABLE_CASES}}, (sort (keys (%unstable_found))) if ($nounstable == 0);
400
401}
402
403######################################################
404# PRINTING
405sub print_tclist($@)
406{
407 my ($cat, @tclist) = @_;
408 print " - ".$cat.":\n\n ". join("\n ",@tclist) . "\n\n" if (scalar(@tclist));
409}
410
411sub print_compare_results_summary($$)
412{
413 my ($ref, $res) = @_;
414 my $return_value=0;
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100415 my $total_better = 0;
Christophe Lyonbff39612015-11-18 16:29:11 +0100416 my $rtotal = 0;
417 my $quiet_reg = $quiet;
Christophe Lyond618f662016-02-02 19:07:58 +0100418 my $ref_ratio = 0;
Christophe Lyon54696202016-04-06 10:39:58 +0200419 my $ref_total = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100420 my $res_ratio = 0;
Christophe Lyon54696202016-04-06 10:39:58 +0200421 my $res_total = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100422 my $ratio_thresh = 0.95; # Warn if pass ratio is below this threshold
Christophe Lyonad8c7242016-02-03 13:04:28 +0100423 my $ignore_exec = 0;
424 my $ref_has_exec_tests = 0;
425 my $res_has_exec_tests = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100426
427 # Compute the pass ratio as a sanity check
Christophe Lyon54696202016-04-06 10:39:58 +0200428 $ref_total = $ref->{PASS} +
429 $ref->{XFAIL} +
430 $ref->{XPASS} +
431 $ref->{FAIL} +
432 $ref->{UNRESOLVED} +
433 $ref->{UNSUPPORTED} +
434 $ref->{UNTESTED};
435
436 # It is possible that no test is executed at all (for instance if
437 # RUNTESTFLAGS was too restrictive). Avoid division by 0.
438 if ($ref_total > 0) {
439 $ref_ratio = ($ref->{PASS} + $ref->{XFAIL}) /
440 $ref_total;
441 }
442
443 $res_total = $res->{PASS} +
444 $res->{XFAIL} +
445 $res->{XPASS} +
446 $res->{FAIL} +
447 $res->{UNRESOLVED} +
448 $res->{UNSUPPORTED} +
449 $res->{UNTESTED};
450
451 if ($res_total > 0) {
452 $res_ratio = ($res->{PASS} + $res->{XFAIL}) /
453 $res_total;
454 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100455
456 if (not $quiet)
457 {
458 printf "Comparing:\n";
459 printf "REFERENCE:$ref_file_name\n";
460 printf "CURRENT: $res_file_name\n\n";
461 }
462
463 #### TESTS STATUS
464 if (not $quiet and not $short)
465 {
466 printf " ` +---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100467 printf "o RUN STATUS: | REF | RES |\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100468 printf " +------------------------------------------+---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100469 printf " | %-40s | %7d | %7d |\n", "Passes [PASS]", $ref->{PASS}, $res->{PASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100470 printf " | %-40s | %7d | %7d |\n", "Unexpected fails [FAIL]", $ref->{FAIL}, $res->{FAIL};
Christophe Lyona140aa82015-12-17 22:53:03 +0100471 printf " | %-40s | %7d | %7d |\n", "Unexpected passes [XPASS]", $ref->{XPASS}, $res->{XPASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100472 printf " | %-40s | %7d | %7d |\n", "Expected fails [XFAIL]", $ref->{XFAIL}, $res->{XFAIL};
473 printf " | %-40s | %7d | %7d |\n", "Unresolved [UNRESOLVED]", $ref->{UNRESOLVED}, $res->{UNRESOLVED};
Christophe Lyona140aa82015-12-17 22:53:03 +0100474 printf " | %-40s | %7d | %7d |\n", "Unsupported [UNSUPPORTED]", $ref->{UNSUPPORTED}, $res->{UNSUPPORTED};
475 printf " | %-40s | %7d | %7d |\n", "Untested [UNTESTED]", $ref->{UNTESTED}, $res->{UNTESTED};
Christophe Lyonbff39612015-11-18 16:29:11 +0100476 printf " +------------------------------------------+---------+---------+\n";
477 printf "\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100478
479 printf " REF PASS ratio: %.2f\n", $ref_ratio;
480 printf " RES PASS ratio: %.2f\n", $res_ratio;
481 if ($ref_ratio < $ratio_thresh)
482 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100483 printf " ***** ERROR: REF PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100484 }
485 if ($res_ratio < $ratio_thresh)
486 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100487 printf " ***** ERROR: RES PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100488 }
489
Christophe Lyonad8c7242016-02-03 13:04:28 +0100490 # If both PASS and FAIL EXEC tests are zero, assume there is no
491 # execution test for this tool, and do not warn.
492 $ref_has_exec_tests = ($ref->{EXEC}->{PASS} + $ref->{EXEC}->{FAIL}) != 0;
493 if ($ref_has_exec_tests)
494 {
495 printf " ***** ERROR: No REF execution test PASSed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{PASS} == 0);
496 printf " ***** WARNING: No REF execution test FAILed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{FAIL} == 0);
497 }
498
499 $res_has_exec_tests = ($res->{EXEC}->{PASS} + $res->{EXEC}->{FAIL}) != 0;
500 if ($res_has_exec_tests)
501 {
502 printf " ***** ERROR: No RES execution test PASSed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{PASS} == 0);
503 printf " ***** WARNING: No RES execution test FAILed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{FAIL} == 0);
504 }
505
506 # Ignore number of execution tests when computing the return
507 # value, if both REF and RES have no execution test.
508 $ignore_exec = !$ref_has_exec_tests && !$res_has_exec_tests;
Christophe Lyonbff39612015-11-18 16:29:11 +0100509 }
510
511 #### REGRESSIONS ?
Christophe Lyona140aa82015-12-17 22:53:03 +0100512 $rtotal = scalar(@{$res->{$PASSED_NOW_FAILS}})
513 +scalar(@{$res->{$XPASS_NOW_FAIL}})
514 +scalar(@{$res->{$PASS_DISAPPEARS}})
515 +scalar(@{$res->{$XPASS_DISAPPEARS}})
516 +scalar(@{$res->{$FAIL_APPEARS}})
517 +scalar(@{$res->{$XPASS_APPEARS}})
518 +scalar(@{$res->{$PASS_NOW_XPASS}})
519 +scalar(@{$res->{$XFAIL_NOW_FAIL}})
520 +scalar(@{$res->{$XFAIL_DISAPPEARS}})
521 +scalar(@{$res->{$UNSUPPORTED_FAIL}})
522 +scalar(@{$res->{$UNSUPPORTED_XPASS}})
523 +scalar(@{$res->{$UNTESTED_FAIL}})
524 +scalar(@{$res->{$UNTESTED_XPASS}})
525 +scalar(@{$res->{$UNRESOLVED_FAIL}})
526 +scalar(@{$res->{$UNRESOLVED_XPASS}})
527 +scalar(@{$res->{$PASSED_NOW_TIMEOUTS}});
528
529 $quiet_reg=1 if ($short and not $rtotal);
Christophe Lyonbff39612015-11-18 16:29:11 +0100530
531 if (not $quiet_reg)
532 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100533 printf "\n$col_red"."o REGRESSIONS:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100534 printf " +------------------------------------------+---------+\n";
535 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 +0100536 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 +0100537 printf " | %-40s | %7d |\n", $PASS_DISAPPEARS, scalar(@{$res->{$PASS_DISAPPEARS}}) if (scalar(@{$res->{$PASS_DISAPPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100538 printf " | %-40s | %7d |\n", $XPASS_DISAPPEARS, scalar(@{$res->{$XPASS_DISAPPEARS}}) if (scalar(@{$res->{$XPASS_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100539 printf " | %-40s | %7d |\n", $FAIL_APPEARS, scalar(@{$res->{$FAIL_APPEARS}}) if (scalar(@{$res->{$FAIL_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100540 printf " | %-40s | %7d |\n", $XPASS_APPEARS, scalar(@{$res->{$XPASS_APPEARS}}) if (scalar(@{$res->{$XPASS_APPEARS}}));
541 printf " | %-40s | %7d |\n", $PASS_NOW_XPASS, scalar(@{$res->{$PASS_NOW_XPASS}}) if (scalar(@{$res->{$PASS_NOW_XPASS}}));
542 printf " | %-40s | %7d |\n", $XFAIL_NOW_FAIL, scalar(@{$res->{$XFAIL_NOW_FAIL}}) if (scalar(@{$res->{$XFAIL_NOW_FAIL}}));
543 printf " | %-40s | %7d |\n", $XFAIL_DISAPPEARS, scalar(@{$res->{$XFAIL_DISAPPEARS}}) if (scalar(@{$res->{$XFAIL_DISAPPEARS}}));
544 printf " | %-40s | %7d |\n", $UNSUPPORTED_FAIL, scalar(@{$res->{$UNSUPPORTED_FAIL}}) if (scalar(@{$res->{$UNSUPPORTED_FAIL}}));
545 printf " | %-40s | %7d |\n", $UNSUPPORTED_XPASS, scalar(@{$res->{$UNSUPPORTED_XPASS}}) if (scalar(@{$res->{$UNSUPPORTED_XPASS}}));
546 printf " | %-40s | %7d |\n", $UNTESTED_FAIL, scalar(@{$res->{$UNTESTED_FAIL}}) if (scalar(@{$res->{$UNTESTED_FAIL}}));
547 printf " | %-40s | %7d |\n", $UNTESTED_XPASS, scalar(@{$res->{$UNTESTED_XPASS}}) if (scalar(@{$res->{$UNTESTED_XPASS}}));
548 printf " | %-40s | %7d |\n", $UNRESOLVED_FAIL, scalar(@{$res->{$UNRESOLVED_FAIL}}) if (scalar(@{$res->{$UNRESOLVED_FAIL}}));
549 printf " | %-40s | %7d |\n", $UNRESOLVED_XPASS, scalar(@{$res->{$UNRESOLVED_XPASS}}) if (scalar(@{$res->{$UNRESOLVED_XPASS}}));
550 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 +0100551 printf " +------------------------------------------+---------+\n";
552 printf " | %-40s | %7d |\n", "TOTAL_REGRESSIONS", $rtotal;
553 printf " +------------------------------------------+---------+\n";
554 printf "\n";
555
556 if ($long)
557 {
558 print_tclist($PASSED_NOW_FAILS, @{$res->{$PASSED_NOW_FAILS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100559 print_tclist($XPASS_NOW_FAIL, @{$res->{$XPASS_NOW_FAIL}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100560 print_tclist($PASS_DISAPPEARS, @{$res->{$PASS_DISAPPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100561 print_tclist($XPASS_DISAPPEARS, @{$res->{$XPASS_DISAPPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100562 print_tclist($FAIL_APPEARS, @{$res->{$FAIL_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100563 print_tclist($XPASS_APPEARS, @{$res->{$XPASS_APPEARS}});
564 print_tclist($PASS_NOW_XPASS, @{$res->{$PASS_NOW_XPASS}});
565 print_tclist($XFAIL_NOW_FAIL, @{$res->{$XFAIL_NOW_FAIL}});
566 print_tclist($XFAIL_DISAPPEARS, @{$res->{$XFAIL_DISAPPEARS}});
567 print_tclist($UNSUPPORTED_FAIL, @{$res->{$UNSUPPORTED_FAIL}});
568 print_tclist($UNSUPPORTED_XPASS, @{$res->{$UNSUPPORTED_XPASS}});
569 print_tclist($UNTESTED_FAIL, @{$res->{$UNTESTED_FAIL}});
570 print_tclist($UNTESTED_XPASS, @{$res->{$UNTESTED_XPASS}});
571 print_tclist($UNRESOLVED_FAIL, @{$res->{$UNRESOLVED_FAIL}});
572 print_tclist($UNRESOLVED_XPASS, @{$res->{$UNRESOLVED_XPASS}});
573 print_tclist($PASSED_NOW_TIMEOUTS, @{$res->{$PASSED_NOW_TIMEOUTS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100574 }
575 printf "$col_reset\n";
576 }
577
578 #### MINOR TO BE CHECKED ?
579 if (not $quiet and not $short)
580 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100581 $total_better = scalar(@{$res->{$XPASS_NOW_PASSES}})+
582 scalar(@{$res->{$XFAIL_NOW_PASSES}})+
583 scalar(@{$res->{$XFAIL_NOW_XPASS}})+
Christophe Lyonbff39612015-11-18 16:29:11 +0100584 scalar(@{$res->{$FAIL_NOW_PASSES}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100585 scalar(@{$res->{$FAIL_NOW_XPASS}})+
Christophe Lyonbff39612015-11-18 16:29:11 +0100586 scalar(@{$res->{$NEW_PASSES}})+
587 scalar(@{$res->{$FAIL_DISAPPEARS}})+
588 scalar(@{$res->{$XFAIL_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100589 scalar(@{$res->{$FAIL_NOW_XFAIL}})+
590 scalar(@{$res->{$PASS_NOW_XFAIL}})+
591 scalar(@{$res->{$XPASS_NOW_XFAIL}})+
592 scalar(@{$res->{$UNSUPPORTED_PASS}})+
593 scalar(@{$res->{$UNSUPPORTED_XFAIL}})+
594 scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}})+
595 scalar(@{$res->{$UNTESTED_PASS}})+
596 scalar(@{$res->{$UNTESTED_XFAIL}})+
597 scalar(@{$res->{$UNTESTED_DISAPPEARS}})+
598 scalar(@{$res->{$UNRESOLVED_PASS}})+
599 scalar(@{$res->{$UNRESOLVED_XFAIL}})+
600 scalar(@{$res->{$UNRESOLVED_DISAPPEARS}})+
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100601 scalar(@{$res->{$UNHANDLED_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100602
Christophe Lyona140aa82015-12-17 22:53:03 +0100603 printf "$col_pink"."o MINOR TO BE CHECKED:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100604 printf " +------------------------------------------+---------+\n";
605 printf " | %-40s | %7d |\n", $XFAIL_APPEARS, scalar(@{$res->{$XFAIL_APPEARS}}) if (scalar(@{$res->{$XFAIL_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100606 printf " | %-40s | %7d |\n", $FAIL_NOW_XFAIL, scalar(@{$res->{$FAIL_NOW_XFAIL}}) if (scalar(@{$res->{$FAIL_NOW_XFAIL}}));
607 printf " | %-40s | %7d |\n", $PASS_NOW_XFAIL, scalar(@{$res->{$PASS_NOW_XFAIL}}) if (scalar(@{$res->{$PASS_NOW_XFAIL}}));
608 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 +0100609 printf " | %-40s | %7d |\n", $FAIL_DISAPPEARS, scalar(@{$res->{$FAIL_DISAPPEARS}}) if (scalar(@{$res->{$FAIL_DISAPPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100610 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 +0100611 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 +0100612 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 +0100613 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 +0100614 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 +0100615 printf " | %-40s | %7d |\n", $NEW_PASSES, scalar(@{$res->{$NEW_PASSES}}) if (scalar(@{$res->{$NEW_PASSES}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100616 printf " | %-40s | %7d |\n", $UNSUPPORTED_PASS, scalar(@{$res->{$UNSUPPORTED_PASS}}) if (scalar(@{$res->{$UNSUPPORTED_PASS}}));
617 printf " | %-40s | %7d |\n", $UNSUPPORTED_XFAIL, scalar(@{$res->{$UNSUPPORTED_XFAIL}}) if (scalar(@{$res->{$UNSUPPORTED_XFAIL}}));
618 printf " | %-40s | %7d |\n", $UNSUPPORTED_DISAPPEARS, scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}));
619 printf " | %-40s | %7d |\n", $UNTESTED_PASS, scalar(@{$res->{$UNTESTED_PASS}}) if (scalar(@{$res->{$UNTESTED_PASS}}));
620 printf " | %-40s | %7d |\n", $UNTESTED_XFAIL, scalar(@{$res->{$UNTESTED_XFAIL}}) if (scalar(@{$res->{$UNTESTED_XFAIL}}));
621 printf " | %-40s | %7d |\n", $UNTESTED_DISAPPEARS, scalar(@{$res->{$UNTESTED_DISAPPEARS}}) if (scalar(@{$res->{$UNTESTED_DISAPPEARS}}));
622 printf " | %-40s | %7d |\n", $UNRESOLVED_PASS, scalar(@{$res->{$UNRESOLVED_PASS}}) if (scalar(@{$res->{$UNRESOLVED_PASS}}));
623 printf " | %-40s | %7d |\n", $UNRESOLVED_XFAIL, scalar(@{$res->{$UNRESOLVED_XFAIL}}) if (scalar(@{$res->{$UNRESOLVED_XFAIL}}));
624 printf " | %-40s | %7d |\n", $UNRESOLVED_DISAPPEARS, scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}) if (scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100625 printf " | %-40s | %7d |\n", $UNHANDLED_CASES, scalar(@{$res->{$UNHANDLED_CASES}}) if (scalar(@{$res->{$UNHANDLED_CASES}}));
626 printf " | %-40s | %7d |\n", $UNSTABLE_CASES, scalar(@{$res->{$UNSTABLE_CASES}}) if (scalar(@{$res->{$UNSTABLE_CASES}}));
627 printf " +------------------------------------------+---------+\n";
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100628 printf " | %-40s | %7d |\n", "TOTAL_MINOR_TO_BE_CHECKED", $total_better + scalar(@{$res->{$UNSTABLE_CASES}});;
Christophe Lyonbff39612015-11-18 16:29:11 +0100629 printf " +------------------------------------------+---------+\n";
630 printf "\n";
631
632 if ($long)
633 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100634 print_tclist($XPASS_NOW_PASSES, @{$res->{$XPASS_NOW_PASSES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100635 print_tclist($XFAIL_NOW_PASSES, @{$res->{$XFAIL_NOW_PASSES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100636 print_tclist($XFAIL_NOW_XPASS, @{$res->{$XFAIL_NOW_XPASS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100637 print_tclist($FAIL_NOW_PASSES, @{$res->{$FAIL_NOW_PASSES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100638 print_tclist($FAIL_NOW_XPASS, @{$res->{$FAIL_NOW_XPASS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100639 print_tclist($FAIL_DISAPPEARS, @{$res->{$FAIL_DISAPPEARS}});
640 print_tclist($XFAIL_APPEARS, @{$res->{$XFAIL_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100641 print_tclist($FAIL_NOW_XFAIL, @{$res->{$FAIL_NOW_XFAIL}});
642 print_tclist($PASS_NOW_XFAIL, @{$res->{$PASS_NOW_XFAIL}});
643 print_tclist($XPASS_NOW_XFAIL, @{$res->{$XPASS_NOW_XFAIL}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100644 print_tclist($UNHANDLED_CASES, @{$res->{$UNHANDLED_CASES}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100645 print_tclist($UNSUPPORTED_PASS, @{$res->{$UNSUPPORTED_PASS}});
646 print_tclist($UNSUPPORTED_XFAIL, @{$res->{$UNSUPPORTED_XFAIL}});
647 print_tclist($UNSUPPORTED_DISAPPEARS, @{$res->{$UNSUPPORTED_DISAPPEARS}});
648 print_tclist($UNTESTED_PASS, @{$res->{$UNTESTED_PASS}});
649 print_tclist($UNTESTED_XFAIL, @{$res->{$UNTESTED_XFAIL}});
650 print_tclist($UNTESTED_DISAPPEARS, @{$res->{$UNTESTED_DISAPPEARS}});
651 print_tclist($UNRESOLVED_PASS, @{$res->{$UNRESOLVED_PASS}});
652 print_tclist($UNRESOLVED_XFAIL, @{$res->{$UNRESOLVED_XFAIL}});
653 print_tclist($UNRESOLVED_DISAPPEARS, @{$res->{$UNRESOLVED_DISAPPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100654 print_tclist($UNSTABLE_CASES, @{$res->{$UNSTABLE_CASES}});
655 print_tclist($NEW_PASSES, @{$res->{$NEW_PASSES}});
656 }
657 printf "$col_reset\n";
658 }
659
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100660 $return_value = 1 if ($total_better);
Christophe Lyonbff39612015-11-18 16:29:11 +0100661
662 $return_value = 2 if ($rtotal);
663
Christophe Lyond618f662016-02-02 19:07:58 +0100664 # Error if there was no PASS (eg when sth went wrong and no .sum was generated)
665 $return_value = 2 if (($res->{PASS} + $res->{XFAIL}) == 0);
666
667 # Error if every test passed, or the ratio was too low. This
668 # generally means the simulator is not configured well.
669 $return_value = 2 if (($ref_ratio == 100) || ($ref_ratio < $ratio_thresh));
670 $return_value = 2 if (($res_ratio == 100) || ($res_ratio < $ratio_thresh));
Christophe Lyonbff39612015-11-18 16:29:11 +0100671
Christophe Lyonad8c7242016-02-03 13:04:28 +0100672 # Error if no execution test passed.
673 # It is possible that no execution test fails, though.
674 $return_value = 2 if (($ignore_exec == 0)
675 && (($ref->{EXEC}->{PASS} == 0)
676 || ($res->{EXEC}->{PASS} == 0)));
677
Christophe Lyonbff39612015-11-18 16:29:11 +0100678 return $return_value;
679}