Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | use File::Glob; |
| 6 | use Getopt::Long; |
| 7 | use Term::ANSIColor qw(:constants); |
| 8 | use File::Basename; |
| 9 | use Cwd; |
| 10 | |
| 11 | my $app = $0; |
| 12 | |
| 13 | sub read_sum($); |
| 14 | sub read_unstable($); |
| 15 | sub dump_result($); |
| 16 | sub compare_results($$); |
| 17 | sub usage(); |
| 18 | sub print_compare_results_summary($$); |
| 19 | sub nothing($$$$); |
| 20 | |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 21 | # OK |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 22 | my $STILL_PASSES = "Still passes [PASS => PASS]"; |
| 23 | my $STILL_FAILS = "Still fails [FAIL => FAIL]"; |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 24 | my $STILL_XPASS = "Still xpass [XPASS=>XPASS]"; |
| 25 | my $STILL_XFAIL = "Still xfail [XFAIL=>XFAIL]"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 26 | |
| 27 | # TO BE CHECKED |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 28 | my $PASS_NOW_XFAIL = "PASS now XFAIL [PASS =>XFAIL]"; |
| 29 | my $XFAIL_APPEARS = "XFAIL appears [ =>XFAIL]"; |
| 30 | my $FAIL_NOW_XFAIL = "FAIL now XFAIL [FAIL =>XFAIL]"; |
| 31 | my $XPASS_NOW_XFAIL = "XPASS now XFAIL [XPASS=>XFAIL]"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 32 | my $PASSED_NOW_TIMEOUTS = "Timeout [PASS =>T.OUT]"; |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 33 | my $FAIL_DISAPPEARS = "FAIL disappears [FAIL => ]"; |
| 34 | my $XPASS_NOW_PASSES = "XPASS now PASS [XPASS=> PASS]"; |
| 35 | my $XFAIL_NOW_PASSES = "XFAIL now PASS [XFAIL=> PASS]"; |
| 36 | my $XFAIL_NOW_XPASS = "XFAIL now XPASS [XFAIL=>XPASS]"; |
| 37 | my $FAIL_NOW_PASSES = "FAIL now PASS [FAIL => PASS]"; |
| 38 | my $FAIL_NOW_XPASS = "FAIL now XPASS [FAIL =>XPASS]"; |
| 39 | my $NEW_PASSES = "New PASS [ => PASS]"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 40 | my $UNHANDLED_CASES = "Unhandled cases [ ..??.. ]"; |
| 41 | my $UNSTABLE_CASES = "Unstable cases, ignored [~RANDOM ]"; |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 42 | my $UNSUPPORTED_XPASS = "UNSUPPORTED now XPASS [UNSUP=>XPASS]"; |
| 43 | my $UNSUPPORTED_XFAIL = "UNSUPPORTED now XFAIL [UNSUP=>XFAIL]"; |
| 44 | my $UNSUPPORTED_DISAPPEARS= "UNSUPPORTED disappears [UNSUP=> ]"; |
| 45 | my $UNTESTED_PASS = "UNTESTED now PASS [UNTES=> PASS]"; |
| 46 | my $UNTESTED_XFAIL = "UNTESTED now XFAIL [UNTES=>XFAIL]"; |
| 47 | my $UNTESTED_DISAPPEARS = "UNTESTED disappears [UNTES=> ]"; |
| 48 | my $UNRESOLVED_PASS = "UNRESOLVED now PASS [UNRES=> PASS]"; |
| 49 | my $UNRESOLVED_XFAIL = "UNRESOLVED now XFAIL [UNRES=>XFAIL]"; |
| 50 | my $UNRESOLVED_DISAPPEARS = "UNRESOLVED disappears [UNRES=> ]"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 51 | |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 52 | # REGRESSIONS |
| 53 | my $PASS_NOW_XPASS = "PASS now XPASS [PASS =>XPASS]"; |
| 54 | my $PASSED_NOW_FAILS = "PASS now FAIL [PASS => FAIL]"; |
| 55 | my $PASS_DISAPPEARS = "PASS disappears [PASS => ]"; |
| 56 | my $XPASS_DISAPPEARS = "XPASS disappears [XPASS=> ]"; |
| 57 | my $FAIL_APPEARS = "FAIL appears [ => FAIL]"; |
| 58 | my $XPASS_APPEARS = "XPASS appears [ =>XPASS]"; |
| 59 | my $XPASS_NOW_FAIL = "XPASS now FAIL [XPASS=> FAIL]"; |
| 60 | my $XFAIL_NOW_FAIL = "XFAIL now FAIL [XFAIL=> FAIL]"; |
| 61 | my $XFAIL_DISAPPEARS = "XFAIL disappears [XFAIL=> ]"; |
| 62 | |
| 63 | my $UNSUPPORTED_PASS = "UNSUPPORTED now PASS [UNSUP=> PASS]"; |
| 64 | my $UNSUPPORTED_FAIL = "UNSUPPORTED now FAIL [UNSUP=> FAIL]"; |
| 65 | my $UNTESTED_FAIL = "UNTESTED now FAIL [UNTES=> FAIL]"; |
| 66 | my $UNTESTED_XPASS = "UNTESTED now XPASS [UNTES=>XPASS]"; |
| 67 | my $UNRESOLVED_FAIL = "UNRESOLVED now FAIL [UNRES=> FAIL]"; |
| 68 | my $UNRESOLVED_XPASS = "UNRESOLVED now XPASS [UNRES=>XPASS]"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 69 | |
| 70 | my @handler_list = ( |
| 71 | {was=>"PASS", is=>"PASS", cat=>$STILL_PASSES}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 72 | {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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 75 | {was=>"FAIL", is=>"FAIL", cat=>$STILL_FAILS}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 76 | {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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 79 | |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 80 | {was=>"XPASS", is=>"XFAIL", cat=>$XPASS_NOW_XFAIL}, |
| 81 | {was=>"PASS", is=>"XFAIL", cat=>$PASS_NOW_XFAIL}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 82 | {was=>"FAIL", is=>"NO_EXIST", cat=>$FAIL_DISAPPEARS}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 83 | {was=>"XFAIL", is=>"NO_EXIST", cat=>$XFAIL_DISAPPEARS}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 84 | {was=>"XFAIL", is=>"PASS", cat=>$XFAIL_NOW_PASSES}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 85 | {was=>"XFAIL", is=>"XPASS", cat=>$XFAIL_NOW_XPASS}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 86 | {was=>"FAIL", is=>"PASS", cat=>$FAIL_NOW_PASSES}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 87 | {was=>"FAIL", is=>"XPASS", cat=>$FAIL_NOW_XPASS}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 88 | {was=>"NO_EXIST", is=>"PASS", cat=>$NEW_PASSES}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 89 | {was=>"NO_EXIST", is=>"XPASS", cat=>$XPASS_APPEARS}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 90 | |
| 91 | {was=>"PASS", is=>"FAIL", handler=>\&handle_pass_fail}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 92 | {was=>"XPASS", is=>"FAIL", cat=>$XPASS_NOW_FAIL}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 93 | {was=>"PASS", is=>"NO_EXIST", cat=>$PASS_DISAPPEARS}, |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 94 | {was=>"XPASS", is=>"NO_EXIST", cat=>$XPASS_DISAPPEARS}, |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 95 | {was=>"NO_EXIST", is=>"FAIL", cat=>$FAIL_APPEARS}, |
| 96 | {was=>"NO_EXIST", is=>"XFAIL", cat=>$XFAIL_APPEARS}, |
| 97 | |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 98 | {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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 116 | # {was=>"NO_EXIST", is=>"NO_EXIST", handler=>\&handle_not_yet_supported} |
| 117 | ); |
| 118 | |
| 119 | ###################################################### |
| 120 | # TREAT ARGUMENTS |
| 121 | |
| 122 | my $verbose=0; |
| 123 | my $quiet=0; |
| 124 | my $long=0; |
| 125 | my $short=0; |
| 126 | my $debug=0; |
| 127 | my ($testroot, $basename); |
| 128 | my ($ref_file_name, $res_file_name); |
| 129 | my $nounstable=0; |
| 130 | my $unstablefile=0; |
| 131 | my @unstable_markers=(); |
| 132 | |
| 133 | GetOptions ("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 | |
| 151 | my ($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. |
| 161 | exit 0 if ( (! -e $ref_file_name) && (! -e $res_file_name )); |
| 162 | |
| 163 | my $ref = read_sum($ref_file_name) ; |
| 164 | my $res = read_sum($res_file_name) ; |
| 165 | my @unstablelist = (); |
| 166 | |
| 167 | @unstablelist = read_unstable($unstablefile) if ($unstablefile ne 0); |
| 168 | |
| 169 | compare_results($ref, $res); |
| 170 | |
| 171 | my $final_result = print_compare_results_summary($ref, $res); |
| 172 | |
| 173 | exit $final_result; |
| 174 | |
| 175 | ###################################################### |
| 176 | # UTILITIES |
| 177 | |
| 178 | sub 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 | } |
| 185 | sub I_am_interactive { |
| 186 | return -t STDIN && -t STDOUT; |
| 187 | } |
| 188 | sub usage() |
| 189 | { |
| 190 | print "Usage : $app <ref_file.sum> <result_file.sum>\n"; |
| 191 | exit 1; |
| 192 | } |
| 193 | |
| 194 | |
| 195 | ###################################################### |
| 196 | # PARSING |
| 197 | sub 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 Lyon | ad8c724 | 2016-02-03 13:04:28 +0100 | [diff] [blame] | 206 | $res->{EXEC}->{PASS} = 0; |
| 207 | $res->{EXEC}->{FAIL} = 0; |
| 208 | |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 209 | 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 Lyon | ad8c724 | 2016-02-03 13:04:28 +0100 | [diff] [blame] | 222 | # Count execution tests, for a sanity check |
| 223 | if ($tc =~ /execution/) |
| 224 | { |
| 225 | $res->{EXEC}->{$diag}++; |
| 226 | } |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 227 | } |
| 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 |
| 248 | sub 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 Lyon | 5e7241c | 2015-12-04 12:57:27 +0100 | [diff] [blame] | 267 | if (/^(.*?):/) |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 268 | { |
| 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 Lyon | 5e7241c | 2015-12-04 12:57:27 +0100 | [diff] [blame] | 274 | $test =~ s/.*?://; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 275 | 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 |
| 289 | sub 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 | |
| 302 | sub compare_results($$) |
| 303 | { |
| 304 | my ($ref, $res) = @_; |
| 305 | |
| 306 | @{$res->{$STILL_PASSES}} = (); |
| 307 | @{$res->{$STILL_FAILS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 308 | @{$res->{$STILL_XPASS}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 309 | @{$res->{$PASSED_NOW_FAILS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 310 | @{$res->{$XPASS_NOW_FAIL}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 311 | @{$res->{$PASS_DISAPPEARS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 312 | @{$res->{$XPASS_DISAPPEARS}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 313 | @{$res->{$FAIL_APPEARS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 314 | @{$res->{$XPASS_APPEARS}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 315 | @{$res->{$NEW_PASSES}} = (); |
| 316 | @{$res->{$FAIL_DISAPPEARS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 317 | @{$res->{$XFAIL_DISAPPEARS}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 318 | @{$res->{$XFAIL_APPEARS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 319 | @{$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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 325 | @{$res->{$XFAIL_NOW_PASSES}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 326 | @{$res->{$XFAIL_NOW_XPASS}} = (); |
| 327 | @{$res->{$XFAIL_NOW_FAIL}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 328 | @{$res->{$FAIL_NOW_PASSES}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 329 | @{$res->{$FAIL_NOW_XPASS}} = (); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 330 | @{$res->{$PASSED_NOW_TIMEOUTS}} = (); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 331 | @{$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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 346 | @{$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 |
| 405 | sub print_tclist($@) |
| 406 | { |
| 407 | my ($cat, @tclist) = @_; |
| 408 | print " - ".$cat.":\n\n ". join("\n ",@tclist) . "\n\n" if (scalar(@tclist)); |
| 409 | } |
| 410 | |
| 411 | sub print_compare_results_summary($$) |
| 412 | { |
| 413 | my ($ref, $res) = @_; |
| 414 | my $return_value=0; |
Christophe Lyon | f5aeb34 | 2015-12-08 14:47:16 +0100 | [diff] [blame] | 415 | my $total_better = 0; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 416 | my $rtotal = 0; |
| 417 | my $quiet_reg = $quiet; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 418 | my $ref_ratio = 0; |
Christophe Lyon | 5469620 | 2016-04-06 10:39:58 +0200 | [diff] [blame] | 419 | my $ref_total = 0; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 420 | my $res_ratio = 0; |
Christophe Lyon | 5469620 | 2016-04-06 10:39:58 +0200 | [diff] [blame] | 421 | my $res_total = 0; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 422 | my $ratio_thresh = 0.95; # Warn if pass ratio is below this threshold |
Christophe Lyon | ad8c724 | 2016-02-03 13:04:28 +0100 | [diff] [blame] | 423 | my $ignore_exec = 0; |
| 424 | my $ref_has_exec_tests = 0; |
| 425 | my $res_has_exec_tests = 0; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 426 | |
| 427 | # Compute the pass ratio as a sanity check |
Christophe Lyon | 5469620 | 2016-04-06 10:39:58 +0200 | [diff] [blame] | 428 | $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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 455 | |
| 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 Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 467 | printf "o RUN STATUS: | REF | RES |\n"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 468 | printf " +------------------------------------------+---------+---------+\n"; |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 469 | printf " | %-40s | %7d | %7d |\n", "Passes [PASS]", $ref->{PASS}, $res->{PASS}; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 470 | printf " | %-40s | %7d | %7d |\n", "Unexpected fails [FAIL]", $ref->{FAIL}, $res->{FAIL}; |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 471 | printf " | %-40s | %7d | %7d |\n", "Unexpected passes [XPASS]", $ref->{XPASS}, $res->{XPASS}; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 472 | 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 Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 474 | printf " | %-40s | %7d | %7d |\n", "Unsupported [UNSUPPORTED]", $ref->{UNSUPPORTED}, $res->{UNSUPPORTED}; |
| 475 | printf " | %-40s | %7d | %7d |\n", "Untested [UNTESTED]", $ref->{UNTESTED}, $res->{UNTESTED}; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 476 | printf " +------------------------------------------+---------+---------+\n"; |
| 477 | printf "\n"; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 478 | |
| 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 Lyon | 1176f96 | 2016-03-03 18:01:10 +0100 | [diff] [blame] | 483 | printf " ***** ERROR: REF PASS ratio is abnormally low *****\n"; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 484 | } |
| 485 | if ($res_ratio < $ratio_thresh) |
| 486 | { |
Christophe Lyon | 1176f96 | 2016-03-03 18:01:10 +0100 | [diff] [blame] | 487 | printf " ***** ERROR: RES PASS ratio is abnormally low *****\n"; |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 488 | } |
| 489 | |
Christophe Lyon | ad8c724 | 2016-02-03 13:04:28 +0100 | [diff] [blame] | 490 | # 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | #### REGRESSIONS ? |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 512 | $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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 530 | |
| 531 | if (not $quiet_reg) |
| 532 | { |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 533 | printf "\n$col_red"."o REGRESSIONS:\n"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 534 | printf " +------------------------------------------+---------+\n"; |
| 535 | printf " | %-40s | %7d |\n", $PASSED_NOW_FAILS, scalar(@{$res->{$PASSED_NOW_FAILS}}) if (scalar(@{$res->{$PASSED_NOW_FAILS}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 536 | printf " | %-40s | %7d |\n", $XPASS_NOW_FAIL, scalar(@{$res->{$XPASS_NOW_FAIL}}) if (scalar(@{$res->{$XPASS_NOW_FAIL}})); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 537 | printf " | %-40s | %7d |\n", $PASS_DISAPPEARS, scalar(@{$res->{$PASS_DISAPPEARS}}) if (scalar(@{$res->{$PASS_DISAPPEARS}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 538 | printf " | %-40s | %7d |\n", $XPASS_DISAPPEARS, scalar(@{$res->{$XPASS_DISAPPEARS}}) if (scalar(@{$res->{$XPASS_DISAPPEARS}})); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 539 | printf " | %-40s | %7d |\n", $FAIL_APPEARS, scalar(@{$res->{$FAIL_APPEARS}}) if (scalar(@{$res->{$FAIL_APPEARS}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 540 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 551 | 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 Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 559 | print_tclist($XPASS_NOW_FAIL, @{$res->{$XPASS_NOW_FAIL}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 560 | print_tclist($PASS_DISAPPEARS, @{$res->{$PASS_DISAPPEARS}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 561 | print_tclist($XPASS_DISAPPEARS, @{$res->{$XPASS_DISAPPEARS}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 562 | print_tclist($FAIL_APPEARS, @{$res->{$FAIL_APPEARS}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 563 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 574 | } |
| 575 | printf "$col_reset\n"; |
| 576 | } |
| 577 | |
| 578 | #### MINOR TO BE CHECKED ? |
| 579 | if (not $quiet and not $short) |
| 580 | { |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 581 | $total_better = scalar(@{$res->{$XPASS_NOW_PASSES}})+ |
| 582 | scalar(@{$res->{$XFAIL_NOW_PASSES}})+ |
| 583 | scalar(@{$res->{$XFAIL_NOW_XPASS}})+ |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 584 | scalar(@{$res->{$FAIL_NOW_PASSES}})+ |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 585 | scalar(@{$res->{$FAIL_NOW_XPASS}})+ |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 586 | scalar(@{$res->{$NEW_PASSES}})+ |
| 587 | scalar(@{$res->{$FAIL_DISAPPEARS}})+ |
| 588 | scalar(@{$res->{$XFAIL_APPEARS}})+ |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 589 | 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 Lyon | f5aeb34 | 2015-12-08 14:47:16 +0100 | [diff] [blame] | 601 | scalar(@{$res->{$UNHANDLED_CASES}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 602 | |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 603 | printf "$col_pink"."o MINOR TO BE CHECKED:\n"; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 604 | printf " +------------------------------------------+---------+\n"; |
| 605 | printf " | %-40s | %7d |\n", $XFAIL_APPEARS, scalar(@{$res->{$XFAIL_APPEARS}}) if (scalar(@{$res->{$XFAIL_APPEARS}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 606 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 609 | printf " | %-40s | %7d |\n", $FAIL_DISAPPEARS, scalar(@{$res->{$FAIL_DISAPPEARS}}) if (scalar(@{$res->{$FAIL_DISAPPEARS}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 610 | printf " | %-40s | %7d |\n", $XPASS_NOW_PASSES, scalar(@{$res->{$XPASS_NOW_PASSES}}) if (scalar(@{$res->{$XPASS_NOW_PASSES}})); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 611 | printf " | %-40s | %7d |\n", $XFAIL_NOW_PASSES, scalar(@{$res->{$XFAIL_NOW_PASSES}}) if (scalar(@{$res->{$XFAIL_NOW_PASSES}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 612 | printf " | %-40s | %7d |\n", $XFAIL_NOW_XPASS, scalar(@{$res->{$XFAIL_NOW_XPASS}}) if (scalar(@{$res->{$XFAIL_NOW_XPASS}})); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 613 | printf " | %-40s | %7d |\n", $FAIL_NOW_PASSES, scalar(@{$res->{$FAIL_NOW_PASSES}}) if (scalar(@{$res->{$FAIL_NOW_PASSES}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 614 | printf " | %-40s | %7d |\n", $FAIL_NOW_XPASS, scalar(@{$res->{$FAIL_NOW_XPASS}}) if (scalar(@{$res->{$FAIL_NOW_XPASS}})); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 615 | printf " | %-40s | %7d |\n", $NEW_PASSES, scalar(@{$res->{$NEW_PASSES}}) if (scalar(@{$res->{$NEW_PASSES}})); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 616 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 625 | 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 Lyon | f5aeb34 | 2015-12-08 14:47:16 +0100 | [diff] [blame] | 628 | printf " | %-40s | %7d |\n", "TOTAL_MINOR_TO_BE_CHECKED", $total_better + scalar(@{$res->{$UNSTABLE_CASES}});; |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 629 | printf " +------------------------------------------+---------+\n"; |
| 630 | printf "\n"; |
| 631 | |
| 632 | if ($long) |
| 633 | { |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 634 | print_tclist($XPASS_NOW_PASSES, @{$res->{$XPASS_NOW_PASSES}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 635 | print_tclist($XFAIL_NOW_PASSES, @{$res->{$XFAIL_NOW_PASSES}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 636 | print_tclist($XFAIL_NOW_XPASS, @{$res->{$XFAIL_NOW_XPASS}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 637 | print_tclist($FAIL_NOW_PASSES, @{$res->{$FAIL_NOW_PASSES}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 638 | print_tclist($FAIL_NOW_XPASS, @{$res->{$FAIL_NOW_XPASS}}); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 639 | print_tclist($FAIL_DISAPPEARS, @{$res->{$FAIL_DISAPPEARS}}); |
| 640 | print_tclist($XFAIL_APPEARS, @{$res->{$XFAIL_APPEARS}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 641 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 644 | print_tclist($UNHANDLED_CASES, @{$res->{$UNHANDLED_CASES}}); |
Christophe Lyon | a140aa8 | 2015-12-17 22:53:03 +0100 | [diff] [blame] | 645 | 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 654 | print_tclist($UNSTABLE_CASES, @{$res->{$UNSTABLE_CASES}}); |
| 655 | print_tclist($NEW_PASSES, @{$res->{$NEW_PASSES}}); |
| 656 | } |
| 657 | printf "$col_reset\n"; |
| 658 | } |
| 659 | |
Christophe Lyon | f5aeb34 | 2015-12-08 14:47:16 +0100 | [diff] [blame] | 660 | $return_value = 1 if ($total_better); |
Christophe Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 661 | |
| 662 | $return_value = 2 if ($rtotal); |
| 663 | |
Christophe Lyon | d618f66 | 2016-02-02 19:07:58 +0100 | [diff] [blame] | 664 | # 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 671 | |
Christophe Lyon | ad8c724 | 2016-02-03 13:04:28 +0100 | [diff] [blame] | 672 | # 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 Lyon | bff3961 | 2015-11-18 16:29:11 +0100 | [diff] [blame] | 678 | return $return_value; |
| 679 | } |