blob: dba648e542e87b38500759bff305e3d13c6f83d2 [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($$$$);
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +000020sub merge($$@);
Christophe Lyonbff39612015-11-18 16:29:11 +010021
Christophe Lyondded4d82016-06-28 18:12:38 +020022my $PASS_PASS = "Still passes [PASS => PASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020023my $PASS_XPASS = "PASS now XPASS [PASS =>XPASS]";
24my $PASS_FAIL = "PASS now FAIL [PASS => FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020025my $PASS_XFAIL = "PASS now XFAIL [PASS =>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000026my $PASS_KFAIL = "PASS now KFAIL [PASS =>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020027my $PASS_UNSUPPORTED = "PASS now UNSUPPORTED [PASS =>UNSUP]";
28my $PASS_UNRESOLVED = "PASS now UNRESOLVED [PASS =>UNRES]";
29my $PASS_UNTESTED = "PASS now UNTESTED [PASS =>UNTES]";
Christophe Lyona140aa82015-12-17 22:53:03 +010030my $PASS_DISAPPEARS = "PASS disappears [PASS => ]";
Christophe Lyon71cec962016-06-28 18:27:30 +020031my $PASS_APPEARS = "New PASS [ => PASS]";
32my $PASSED_NOW_TIMEOUTS = "Timeout [PASS =>T.OUT]";
33
34my $XPASS_PASS = "XPASS now PASS [XPASS=> PASS]";
35my $XPASS_XPASS = "Still xpass [XPASS=>XPASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020036my $XPASS_FAIL = "XPASS now FAIL [XPASS=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020037my $XPASS_XFAIL = "XPASS now XFAIL [XPASS=>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000038my $XPASS_KFAIL = "XPASS now KFAIL [XPASS=>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020039my $XPASS_UNSUPPORTED = "XPASS now UNSUPPORTED [XPASS=>UNSUP]";
40my $XPASS_UNRESOLVED = "XPASS now UNRESOLVED [XPASS=>UNRES]";
41my $XPASS_UNTESTED = "XPASS now UNTESTED [XPASS=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020042my $XPASS_DISAPPEARS = "XPASS disappears [XPASS=> ]";
43my $XPASS_APPEARS = "XPASS appears [ =>XPASS]";
44
45my $FAIL_PASS = "FAIL now PASS [FAIL => PASS]";
46my $FAIL_XPASS = "FAIL now XPASS [FAIL =>XPASS]";
47my $FAIL_FAIL = "Still fails [FAIL => FAIL]";
48my $FAIL_XFAIL = "FAIL now XFAIL [FAIL =>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000049my $FAIL_KFAIL = "FAIL now KFAIL [FAIL =>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020050my $FAIL_UNSUPPORTED = "FAIL now UNSUPPORTED [FAIL =>UNSUP]";
51my $FAIL_UNRESOLVED = "FAIL now UNRESOLVED [FAIL =>UNRES]";
52my $FAIL_UNTESTED = "FAIL now UNTESTED [FAIL =>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020053my $FAIL_DISAPPEARS = "FAIL disappears [FAIL => ]";
54my $FAIL_APPEARS = "FAIL appears [ => FAIL]";
55
56my $XFAIL_PASS = "XFAIL now PASS [XFAIL=> PASS]";
57my $XFAIL_XPASS = "XFAIL now XPASS [XFAIL=>XPASS]";
Christophe Lyondded4d82016-06-28 18:12:38 +020058my $XFAIL_FAIL = "XFAIL now FAIL [XFAIL=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020059my $XFAIL_XFAIL = "Still xfail [XFAIL=>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000060my $XFAIL_KFAIL = "XFAIL now KFAIL [XFAIL=>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020061my $XFAIL_UNSUPPORTED = "XFAIL now UNSUPPORTED [XFAIL=>UNSUP]";
62my $XFAIL_UNRESOLVED = "XFAIL now UNRESOLVED [XFAIL=>UNRES]";
63my $XFAIL_UNTESTED = "XFAIL now UNTESTED [XFAIL=>UNTES]";
Christophe Lyona140aa82015-12-17 22:53:03 +010064my $XFAIL_DISAPPEARS = "XFAIL disappears [XFAIL=> ]";
Christophe Lyon71cec962016-06-28 18:27:30 +020065my $XFAIL_APPEARS = "XFAIL appears [ =>XFAIL]";
Christophe Lyona140aa82015-12-17 22:53:03 +010066
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000067my $KFAIL_PASS = "KFAIL now PASS [KFAIL=> PASS]";
68my $KFAIL_XPASS = "KFAIL now XPASS [KFAIL=>XPASS]";
69my $KFAIL_FAIL = "KFAIL now FAIL [KFAIL=> FAIL]";
70my $KFAIL_XFAIL = "KFAIL now XFAIL [KFAIL=>XFAIL]";
71my $KFAIL_KFAIL = "Still kfail [KFAIL=>KFAIL]";
72my $KFAIL_UNSUPPORTED = "KFAIL now UNSUPPORTED [KFAIL=>UNSUP]";
73my $KFAIL_UNRESOLVED = "KFAIL now UNRESOLVED [KFAIL=>UNRES]";
74my $KFAIL_UNTESTED = "KFAIL now UNTESTED [KFAIL=>UNTES]";
75my $KFAIL_DISAPPEARS = "KFAIL disappears [KFAIL=> ]";
76my $KFAIL_APPEARS = "KFAIL appears [ =>KFAIL]";
77
Christophe Lyona140aa82015-12-17 22:53:03 +010078my $UNSUPPORTED_PASS = "UNSUPPORTED now PASS [UNSUP=> PASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +020079my $UNSUPPORTED_XPASS = "UNSUPPORTED now XPASS [UNSUP=>XPASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +010080my $UNSUPPORTED_FAIL = "UNSUPPORTED now FAIL [UNSUP=> FAIL]";
Christophe Lyon71cec962016-06-28 18:27:30 +020081my $UNSUPPORTED_XFAIL = "UNSUPPORTED now XFAIL [UNSUP=>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000082my $UNSUPPORTED_KFAIL = "UNSUPPORTED now KFAIL [UNSUP=>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020083my $UNSUPPORTED_UNSUPPORTED= "UNSUPP now UNSUPP [UNSUP=>UNSUP]";
84my $UNSUPPORTED_UNRESOLVED= "UNSUPP now UNRESOLVED [UNSUP=>UNRES]";
85my $UNSUPPORTED_UNTESTED = "UNSUPP now UNTESTED [UNSUP=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020086my $UNSUPPORTED_DISAPPEARS= "UNSUPPORTED disappears [UNSUP=> ]";
87my $UNSUPPORTED_APPEARS = "UNSUPPORTED appears [ =>UNSUP]";
88
89my $UNTESTED_PASS = "UNTESTED now PASS [UNTES=> PASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +010090my $UNTESTED_XPASS = "UNTESTED now XPASS [UNTES=>XPASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +020091my $UNTESTED_FAIL = "UNTESTED now FAIL [UNTES=> FAIL]";
92my $UNTESTED_XFAIL = "UNTESTED now XFAIL [UNTES=>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +000093my $UNTESTED_KFAIL = "UNTESTED now KFAIL [UNTES=>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +020094my $UNTESTED_UNSUPPORTED = "UNTESTED now UNSUPP [UNTES=>UNSUP]";
95my $UNTESTED_UNRESOLVED = "UNTESTED now UNRESOLVED [UNTES=>UNRES]";
96my $UNTESTED_UNTESTED = "UNTESTED now UNTESTED [UNTES=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +020097my $UNTESTED_DISAPPEARS = "UNTESTED disappears [UNTES=> ]";
98my $UNTESTED_APPEARS = "UNTESTED appears [ =>UNTES]";
99
100my $UNRESOLVED_PASS = "UNRESOLVED now PASS [UNRES=> PASS]";
Christophe Lyona140aa82015-12-17 22:53:03 +0100101my $UNRESOLVED_XPASS = "UNRESOLVED now XPASS [UNRES=>XPASS]";
Christophe Lyon71cec962016-06-28 18:27:30 +0200102my $UNRESOLVED_FAIL = "UNRESOLVED now FAIL [UNRES=> FAIL]";
103my $UNRESOLVED_XFAIL = "UNRESOLVED now XFAIL [UNRES=>XFAIL]";
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000104my $UNRESOLVED_KFAIL = "UNRESOLVED now KFAIL [UNRES=>KFAIL]";
Christophe Lyon9dde3332016-06-28 23:00:00 +0200105my $UNRESOLVED_UNSUPPORTED= "UNRESOLVED now UNSUPP [UNRES=>UNSUP]";
106my $UNRESOLVED_UNRESOLVED = "UNRESOLVED now UNRESOLVED [UNRES=>UNRES]";
107my $UNRESOLVED_UNTESTED = "UNRESOLVED now UNTESTED [UNRES=>UNTES]";
Christophe Lyon71cec962016-06-28 18:27:30 +0200108my $UNRESOLVED_DISAPPEARS = "UNRESOLVED disappears [UNRES=> ]";
109my $UNRESOLVED_APPEARS = "UNRESOLVED appears [ =>UNRES]";
110
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200111my $ERROR_DISAPPEARS = "ERROR disappears [ERROR=> ]";
112my $ERROR_APPEARS = "ERROR appears [ =>ERROR]";
113
Christophe Lyon71cec962016-06-28 18:27:30 +0200114my $UNHANDLED_CASES = "Unhandled cases [ ..??.. ]";
115my $UNSTABLE_CASES = "Unstable cases, ignored [~RANDOM ]";
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000116my $HWDEP_CASES = "HW dependent cases [HW-DEPENDENT]";
Christophe Lyonbff39612015-11-18 16:29:11 +0100117
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000118# Handle status transitions:
119# 'was' is the reference status
120# 'is' is the current status
121# 'cat' is the short name for the transition type
122# 'handler' is a function handling the transition, if non-trivial
123# report_hwdep is a boolean controlling whether to report the
124# transition even if flagged as hardware-dependent
Christophe Lyonbff39612015-11-18 16:29:11 +0100125my @handler_list = (
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000126 {was=>"PASS", is=>"PASS", cat=>$PASS_PASS, report_hwdep=>"false"},
127 {was=>"PASS", is=>"XPASS", cat=>$PASS_XPASS, report_hwdep=>"true"},
128 {was=>"PASS", is=>"FAIL", handler=>\&handle_pass_fail, report_hwdep=>"true"},
129 {was=>"PASS", is=>"XFAIL", cat=>$PASS_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000130 {was=>"PASS", is=>"KFAIL", cat=>$PASS_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000131 {was=>"PASS", is=>"UNSUPPORTED",cat=>$PASS_UNSUPPORTED, report_hwdep=>"false"},
132 {was=>"PASS", is=>"UNTESTED", cat=>$PASS_UNTESTED, report_hwdep=>"true"},
133 {was=>"PASS", is=>"UNRESOLVED",cat=>$PASS_UNRESOLVED, report_hwdep=>"true"},
134 {was=>"PASS", is=>"NO_EXIST", cat=>$PASS_DISAPPEARS, report_hwdep=>"false"},
135 {was=>"NO_EXIST", is=>"PASS", cat=>$PASS_APPEARS, report_hwdep=>"false"},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200136
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000137 {was=>"XPASS", is=>"PASS", cat=>$XPASS_PASS, report_hwdep=>"true"},
138 {was=>"XPASS", is=>"XPASS", cat=>$XPASS_XPASS, report_hwdep=>"true"},
139 {was=>"XPASS", is=>"FAIL", cat=>$XPASS_FAIL, report_hwdep=>"true"},
140 {was=>"XPASS", is=>"XFAIL", cat=>$XPASS_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000141 {was=>"XPASS", is=>"KFAIL", cat=>$XPASS_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000142 {was=>"XPASS", is=>"UNSUPPORTED",cat=>$XPASS_UNSUPPORTED, report_hwdep=>"true"},
143 {was=>"XPASS", is=>"UNTESTED", cat=>$XPASS_UNTESTED, report_hwdep=>"true"},
144 {was=>"XPASS", is=>"UNRESOLVED",cat=>$XPASS_UNRESOLVED, report_hwdep=>"true"},
145 {was=>"XPASS", is=>"NO_EXIST", cat=>$XPASS_DISAPPEARS, report_hwdep=>"true"},
146 {was=>"NO_EXIST", is=>"XPASS", cat=>$XPASS_APPEARS, report_hwdep=>"true"},
Christophe Lyonbff39612015-11-18 16:29:11 +0100147
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000148 {was=>"FAIL", is=>"PASS", cat=>$FAIL_PASS, report_hwdep=>"true"},
149 {was=>"FAIL", is=>"XPASS", cat=>$FAIL_XPASS, report_hwdep=>"true"},
150 {was=>"FAIL", is=>"FAIL", cat=>$FAIL_FAIL, report_hwdep=>"true"},
151 {was=>"FAIL", is=>"XFAIL", cat=>$FAIL_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000152 {was=>"FAIL", is=>"KFAIL", cat=>$FAIL_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000153 {was=>"FAIL", is=>"UNSUPPORTED",cat=>$FAIL_UNSUPPORTED, report_hwdep=>"true"},
154 {was=>"FAIL", is=>"UNTESTED", cat=>$FAIL_UNTESTED, report_hwdep=>"true"},
155 {was=>"FAIL", is=>"UNRESOLVED",cat=>$FAIL_UNRESOLVED, report_hwdep=>"true"},
156 {was=>"FAIL", is=>"NO_EXIST", cat=>$FAIL_DISAPPEARS, report_hwdep=>"true"},
157 {was=>"NO_EXIST", is=>"FAIL", cat=>$FAIL_APPEARS, report_hwdep=>"true"},
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200158
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000159 {was=>"XFAIL", is=>"PASS", cat=>$XFAIL_PASS, report_hwdep=>"true"},
160 {was=>"XFAIL", is=>"XPASS", cat=>$XFAIL_XPASS, report_hwdep=>"true"},
161 {was=>"XFAIL", is=>"FAIL", cat=>$XFAIL_FAIL, report_hwdep=>"true"},
162 {was=>"XFAIL", is=>"XFAIL", cat=>$XFAIL_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000163 {was=>"XFAIL", is=>"KFAIL", cat=>$XFAIL_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000164 {was=>"XFAIL", is=>"UNSUPPORTED",cat=>$XFAIL_UNSUPPORTED, report_hwdep=>"true"},
165 {was=>"XFAIL", is=>"UNTESTED", cat=>$XFAIL_UNTESTED, report_hwdep=>"true"},
166 {was=>"XFAIL", is=>"UNRESOLVED",cat=>$XFAIL_UNRESOLVED, report_hwdep=>"true"},
167 {was=>"XFAIL", is=>"NO_EXIST", cat=>$XFAIL_DISAPPEARS, report_hwdep=>"true"},
168 {was=>"NO_EXIST", is=>"XFAIL", cat=>$XFAIL_APPEARS, report_hwdep=>"true"},
Christophe Lyonbff39612015-11-18 16:29:11 +0100169
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000170 {was=>"KFAIL", is=>"PASS", cat=>$KFAIL_PASS, report_hwdep=>"true"},
171 {was=>"KFAIL", is=>"XPASS", cat=>$KFAIL_XPASS, report_hwdep=>"true"},
172 {was=>"KFAIL", is=>"FAIL", cat=>$KFAIL_FAIL, report_hwdep=>"true"},
173 {was=>"KFAIL", is=>"XFAIL", cat=>$KFAIL_XFAIL, report_hwdep=>"true"},
174 {was=>"KFAIL", is=>"KFAIL", cat=>$KFAIL_KFAIL, report_hwdep=>"true"},
175 {was=>"KFAIL", is=>"UNSUPPORTED",cat=>$KFAIL_UNSUPPORTED, report_hwdep=>"true"},
176 {was=>"KFAIL", is=>"UNTESTED", cat=>$KFAIL_UNTESTED, report_hwdep=>"true"},
177 {was=>"KFAIL", is=>"UNRESOLVED",cat=>$KFAIL_UNRESOLVED, report_hwdep=>"true"},
178 {was=>"KFAIL", is=>"NO_EXIST", cat=>$KFAIL_DISAPPEARS, report_hwdep=>"true"},
179 {was=>"NO_EXIST", is=>"KFAIL", cat=>$KFAIL_APPEARS, report_hwdep=>"true"},
180
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000181 {was=>"UNSUPPORTED", is=>"PASS", cat=>$UNSUPPORTED_PASS, report_hwdep=>"true"},
182 {was=>"UNSUPPORTED", is=>"XPASS", cat=>$UNSUPPORTED_XPASS, report_hwdep=>"true"},
183 {was=>"UNSUPPORTED", is=>"FAIL", cat=>$UNSUPPORTED_FAIL, report_hwdep=>"true"},
184 {was=>"UNSUPPORTED", is=>"XFAIL", cat=>$UNSUPPORTED_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000185 {was=>"UNSUPPORTED", is=>"KFAIL", cat=>$UNSUPPORTED_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000186 {was=>"UNSUPPORTED", is=>"UNSUPPORTED",cat=>$UNSUPPORTED_UNSUPPORTED, report_hwdep=>"true"},
187 {was=>"UNSUPPORTED", is=>"UNTESTED", cat=>$UNSUPPORTED_UNTESTED, report_hwdep=>"true"},
188 {was=>"UNSUPPORTED", is=>"UNRESOLVED",cat=>$UNSUPPORTED_UNRESOLVED, report_hwdep=>"true"},
189 {was=>"UNSUPPORTED", is=>"NO_EXIST", cat=>$UNSUPPORTED_DISAPPEARS, report_hwdep=>"true"},
190 {was=>"NO_EXIST", is=>"UNSUPPORTED", cat=>$UNSUPPORTED_APPEARS, report_hwdep=>"true"},
Christophe Lyona140aa82015-12-17 22:53:03 +0100191
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000192 {was=>"UNTESTED", is=>"PASS", cat=>$UNTESTED_PASS, report_hwdep=>"true"},
193 {was=>"UNTESTED", is=>"XPASS", cat=>$UNTESTED_XPASS, report_hwdep=>"true"},
194 {was=>"UNTESTED", is=>"FAIL", cat=>$UNTESTED_FAIL, report_hwdep=>"true"},
195 {was=>"UNTESTED", is=>"XFAIL", cat=>$UNTESTED_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000196 {was=>"UNTESTED", is=>"KFAIL", cat=>$UNTESTED_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000197 {was=>"UNTESTED", is=>"UNSUPPORTED",cat=>$UNTESTED_UNSUPPORTED,report_hwdep=>"true"},
198 {was=>"UNTESTED", is=>"UNTESTED", cat=>$UNTESTED_UNTESTED, report_hwdep=>"true"},
199 {was=>"UNTESTED", is=>"UNRESOLVED",cat=>$UNTESTED_UNRESOLVED, report_hwdep=>"true"},
200 {was=>"UNTESTED", is=>"NO_EXIST", cat=>$UNTESTED_DISAPPEARS, report_hwdep=>"true"},
201 {was=>"NO_EXIST", is=>"UNTESTED", cat=>$UNTESTED_APPEARS, report_hwdep=>"true"},
Christophe Lyona140aa82015-12-17 22:53:03 +0100202
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000203 {was=>"UNRESOLVED", is=>"PASS", cat=>$UNRESOLVED_PASS, report_hwdep=>"true"},
204 {was=>"UNRESOLVED", is=>"XPASS", cat=>$UNRESOLVED_XPASS, report_hwdep=>"true"},
205 {was=>"UNRESOLVED", is=>"FAIL", cat=>$UNRESOLVED_FAIL, report_hwdep=>"true"},
206 {was=>"UNRESOLVED", is=>"XFAIL", cat=>$UNRESOLVED_XFAIL, report_hwdep=>"true"},
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000207 {was=>"UNRESOLVED", is=>"KFAIL", cat=>$UNRESOLVED_KFAIL, report_hwdep=>"true"},
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000208 {was=>"UNRESOLVED", is=>"UNSUPPORTED",cat=>$UNRESOLVED_UNSUPPORTED, report_hwdep=>"true"},
209 {was=>"UNRESOLVED", is=>"UNTESTED", cat=>$UNRESOLVED_UNTESTED, report_hwdep=>"true"},
210 {was=>"UNRESOLVED", is=>"UNRESOLVED",cat=>$UNRESOLVED_UNRESOLVED, report_hwdep=>"true"},
211 {was=>"UNRESOLVED", is=>"NO_EXIST", cat=>$UNRESOLVED_DISAPPEARS, report_hwdep=>"true"},
212 {was=>"NO_EXIST", is=>"UNRESOLVED", cat=>$UNRESOLVED_APPEARS, report_hwdep=>"true"},
Christophe Lyondc66fc52016-04-05 17:38:07 +0200213
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000214 {was=>"ERROR", is=>"NO_EXIST", cat=>$ERROR_DISAPPEARS, report_hwdep=>"true"},
215 {was=>"NO_EXIST", is=>"ERROR", cat=>$ERROR_APPEARS, report_hwdep=>"true"},
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200216
Christophe Lyonbff39612015-11-18 16:29:11 +0100217# {was=>"NO_EXIST", is=>"NO_EXIST", handler=>\&handle_not_yet_supported}
218);
219
220######################################################
221# TREAT ARGUMENTS
222
223my $verbose=0;
224my $quiet=0;
225my $long=0;
226my $short=0;
227my $debug=0;
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +0000228my $merge_mode=0; # Merge result sum files into reference sum file
229my $output_file;
Christophe Lyonbff39612015-11-18 16:29:11 +0100230my ($testroot, $basename);
231my ($ref_file_name, $res_file_name);
232my $nounstable=0;
233my $unstablefile=0;
234my @unstable_markers=();
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000235
236my $no_hwdep=0; # Ignore hw-dependent flag (ie. consider all tests as *not* hw-dependent
237my $hwdep_file=0; # File containing the list of hw-dependent tests
238my @hwdep_markers=(); # Optional markers when parsing hwdep_file
239
Christophe Lyonca9d8302017-05-22 12:04:00 +0000240my $ratio_thresh = 0.95; # Warn if pass ratio is below this threshold
Christophe Lyonbff39612015-11-18 16:29:11 +0100241
242GetOptions ("l" => \$long,
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +0000243 "o=s" => \$output_file,
Christophe Lyonbff39612015-11-18 16:29:11 +0100244 "s" => \$short,
245 "q" => \$quiet,
246 "v" => \$verbose,
247 "dbg" => \$debug,
248 "testroot=s" => \$testroot,
249 "basename=s" => \$basename,
Christophe Lyonca9d8302017-05-22 12:04:00 +0000250 "pass-thresh=f" => \$ratio_thresh,
Christophe Lyonbff39612015-11-18 16:29:11 +0100251 "no-unstable" => \$nounstable,
252 "unstable-tests=s" => \$unstablefile,
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000253 "unstable-marker=s" => \@unstable_markers,
254 "no-hwdep" => \$no_hwdep,
255 "hwdep-tests=s" => \$hwdep_file,
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +0000256 "hwdep-marker=s" => \@hwdep_markers,
257 "merge" => \$merge_mode);
258
259# Merge is a separate operating mode of this script where instead of comparing sum files,
260# it merges them. It could be a separate script, but it's kept here to reuse the sum file
261# parsing code.
262#
263# In this mode, the script will merge the sum files provided as arguments into one
264# synthetic sum file. The reference sum file will be the first one provided as argument.
265# For tests that didn't pass, check the other sum files to see whether that test PASSed or
266# XFAILed in any of them. If so, the status for the test is changed to PASS or XFAIL in
267# the reference file. The result is written to the file given by the '-o' option.
268if ($merge_mode) {
269 $ref_file_name = shift(@ARGV);
270 my $ref = read_sum($ref_file_name);
271 my @res;
272 foreach (@ARGV) {
273 push(@res, read_sum($_));
274 }
275
276 exit merge($output_file, $ref_file_name, @res);
277}
Christophe Lyonbff39612015-11-18 16:29:11 +0100278
279$ref_file_name = $ARGV[0] if ($#ARGV == 1);
280$res_file_name = $ARGV[1] if ($#ARGV == 1);
281
282$ref_file_name = $testroot."/expected_results/".$basename if ($testroot and $basename);
283$res_file_name = $testroot."/testing/run/".$basename if ($testroot and $basename);
284&usage if (not $ref_file_name or not $res_file_name);
285
286my ($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
287 = ("\033[31;1m","\033[31;3m","\033[32;1m","\033[32;3m","\033[35;1m","\033[35;2m","\033[0m");
288($col_boldred, $col_red, $col_boldgreen, $col_green, $col_boldpink, $col_pink, $col_reset)
289 = ("","","","","","","") if (not I_am_interactive());
290
291######################################################
292# MAIN PROGRAM
293# print "comparing $ref_file_name $res_file_name\n";
294
295# If none of the 2 .sum exists, nothing to compare: exit early.
296exit 0 if ( (! -e $ref_file_name) && (! -e $res_file_name ));
297
298my $ref = read_sum($ref_file_name) ;
299my $res = read_sum($res_file_name) ;
300my @unstablelist = ();
301
302@unstablelist = read_unstable($unstablefile) if ($unstablefile ne 0);
303
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000304# Import list of hw-dependent files, if provided
305my @hwdep_list = ();
306
307@hwdep_list = read_unstable($hwdep_file) if ($hwdep_file ne 0);
308
Christophe Lyonbff39612015-11-18 16:29:11 +0100309compare_results($ref, $res);
310
311my $final_result = print_compare_results_summary($ref, $res);
312
313exit $final_result;
314
315######################################################
316# UTILITIES
317
318sub empty_result()
319{
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000320 my %empty_result;# = {PASS=>0, FAIL=>0, XPASS=>0, XFAIL=>0, KFAIL=>0, UNSUPPORTED=>0, UNTESTED=>0, UNRESOLVED=>0, ERROR=>0};
321 $empty_result{PASS}=$empty_result{FAIL}=$empty_result{XPASS}=$empty_result{XFAIL}=$empty_result{KFAIL}=0;
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200322 $empty_result{UNSUPPORTED}=$empty_result{UNTESTED}=$empty_result{UNRESOLVED}=$empty_result{NO_EXIST}=$empty_result{ERROR}=0;
Christophe Lyon9a3ce972021-06-30 23:18:23 +0000323 $empty_result{NB}=0;
Christophe Lyonbff39612015-11-18 16:29:11 +0100324 return \%empty_result;
325}
326sub I_am_interactive {
327 return -t STDIN && -t STDOUT;
328}
329sub usage()
330{
331 print "Usage : $app <ref_file.sum> <result_file.sum>\n";
332 exit 1;
333}
334
335
336######################################################
337# PARSING
338sub read_sum($)
339{
340 my ($sum_file) = @_;
341 my $res = empty_result();
342 my %testcases;
Thiago Jung Bauermann9cbfa082024-02-24 21:31:48 -0300343 my %exp_files;
Christophe Lyonbff39612015-11-18 16:29:11 +0100344 $res->{testcases} = \%testcases;
Thiago Jung Bauermann9cbfa082024-02-24 21:31:48 -0300345 $res->{exp_files} = \%exp_files;
Christophe Lyonbff39612015-11-18 16:29:11 +0100346 my $pending_timeout=0;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000347 my $current_tool="";
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000348 my $current_exp="";
Christophe Lyonbff39612015-11-18 16:29:11 +0100349
Christophe Lyonad8c7242016-02-03 13:04:28 +0100350 $res->{EXEC}->{PASS} = 0;
351 $res->{EXEC}->{FAIL} = 0;
352
Christophe Lyonbff39612015-11-18 16:29:11 +0100353 open SUMFILE, $sum_file or die $!;
354 while (<SUMFILE>)
355 {
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000356 if (m/^(PASS|XPASS|FAIL|XFAIL|KFAIL|UNSUPPORTED|UNTESTED|UNRESOLVED|ERROR): *(.*)/)
Christophe Lyonbff39612015-11-18 16:29:11 +0100357 {
358 my ($diag,$tc) = ($1,$2);
359 my %tcresult;
360 $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./;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000361 # Prefix test name wih .exp filename to help report
362 # regressions/run bisect.
363 $tc = "$current_tool:$current_exp=$tc";
Christophe Lyonbff39612015-11-18 16:29:11 +0100364 $testcases{$tc} = empty_result() if (not exists $testcases{$tc});
365 $testcases{$tc}->{$diag}++;
366 $testcases{$tc}->{HAS_TIMED_OUT} = $pending_timeout;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000367 $testcases{$tc}->{TOOL_EXP} = "$current_tool:$current_exp";
Christophe Lyon9a3ce972021-06-30 23:18:23 +0000368 $testcases{$tc}->{NB}++;
Christophe Lyonbff39612015-11-18 16:29:11 +0100369 $pending_timeout = 0;
370 $res->{$diag}++;
Christophe Lyonad8c7242016-02-03 13:04:28 +0100371 # Count execution tests, for a sanity check
372 if ($tc =~ /execution/)
373 {
374 $res->{EXEC}->{$diag}++;
375 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100376 }
377 elsif (m/WARNING: program timed out/)
378 {
379 $pending_timeout = 1;
380 }
381 elsif (m/^(# of expected passes|# of unexpected failures|# of expected failures|# of known failures|# of unsupported tests|# of untested testcases)\s+(.*)/)
382 {
383 $res->{"summary - "."$1"} = $2;
384 }
385 elsif (m/^\/.*\/([^\/]+)\s+version\s+(.*)/)
386 {
387 $res->{tool} = $1;
388 $res->{version} = $2;
389 $res->{version} =~ s/ [-(].*//;
390 }
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000391 elsif (m/^Running target .*/)
392 {
393 }
394 elsif (m/^Running (.*) \.\.\.*/)
395 {
396 $current_exp=$1;
397 $current_exp =~ s|.*/testsuite/||;
Thiago Jung Bauermann9cbfa082024-02-24 21:31:48 -0300398 # For merging, we want to know whether the exp file is present in the result.
399 $exp_files{"$current_tool:$current_exp"} = 1;
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000400 }
Christophe Lyonc63afc92021-07-01 09:52:29 +0000401 elsif (m/^\t\t=== (.*) tests ===/)
402 {
403 $current_tool=$1;
404 }
405 elsif (m/^\t\t=== (.*) Summary ===/)
406 {
407 $current_tool="";
408 $current_exp="";
409 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100410 }
411 close SUMFILE;
412 return $res;
413}
414
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000415# Parse list of unstable/hw-dependent tests
Christophe Lyonbff39612015-11-18 16:29:11 +0100416sub read_unstable($)
417{
418 my ($unstable_file) = @_;
419 my @unstable_tests = ();
420
421 open UNSTABLEFILE, $unstable_file or die $!;
422 while (<UNSTABLEFILE>)
423 {
424 # Skip lines starting with '#', or with spaces only
425 if ((/^#/) || (/^[ ]*$/))
426 {
427 }
428 else
429 {
430 chomp;
431
432 my $test = $_;
433
434 # Check if line is of type: target:testname
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100435 if (/^(.*?):/)
Christophe Lyonbff39612015-11-18 16:29:11 +0100436 {
437 foreach my $unstable_marker (@unstable_markers)
438 {
439 if ($unstable_marker eq $1) {
440 # If target matches the one supplied as script
441 # argument, add the testname to the list
Christophe Lyon5e7241c2015-12-04 12:57:27 +0100442 $test =~ s/.*?://;
Christophe Lyonbff39612015-11-18 16:29:11 +0100443 push @unstable_tests, $test;
444 }
445 }
446 } else {
447 push @unstable_tests, $test;
448 }
449 }
450 }
451 close UNSTABLEFILE;
452 return @unstable_tests;
453}
454
455######################################################
456# DIFFING
457sub handle_pass_fail($$$$)
458{
459 my ($ref, $res, $diag_diag, $tc) = @_;
460 if ($res->{testcases}->{$tc}->{HAS_TIMED_OUT})
461 {
462 push @{$res->{$PASSED_NOW_TIMEOUTS}}, $tc;
463 }
464 else
465 {
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000466 # This transition is flagged as hw-dependent if:
467 # - the name is in the list
468 # - the transition should not be reported (but be flagged as hw-dependent instead)
469 # - --no-hwdep was not provided
470 if ((grep { (index $tc,$_)!=-1} @hwdep_list)
471 && ($diag_diag->{report_hwdep} eq "false")
472 && ($no_hwdep == 0)) {
473 push @{$res->{$HWDEP_CASES}}, $tc;
474 } else {
475 push @{$res->{$PASS_FAIL}}, $tc;
476 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100477 }
478}
479
480sub compare_results($$)
481{
482 my ($ref, $res) = @_;
483
Christophe Lyondded4d82016-06-28 18:12:38 +0200484 @{$res->{$PASS_PASS}} = ();
Christophe Lyondded4d82016-06-28 18:12:38 +0200485 @{$res->{$PASS_XPASS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200486 @{$res->{$PASS_FAIL}} = ();
487 @{$res->{$PASS_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000488 @{$res->{$PASS_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200489 @{$res->{$PASS_UNSUPPORTED}} = ();
490 @{$res->{$PASS_UNTESTED}} = ();
491 @{$res->{$PASS_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200492 @{$res->{$PASS_DISAPPEARS}} = ();
493 @{$res->{$PASS_APPEARS}} = ();
494 @{$res->{$PASSED_NOW_TIMEOUTS}} = ();
495
Christophe Lyondded4d82016-06-28 18:12:38 +0200496 @{$res->{$XPASS_PASS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200497 @{$res->{$XPASS_XPASS}} = ();
498 @{$res->{$XPASS_FAIL}} = ();
499 @{$res->{$XPASS_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000500 @{$res->{$XPASS_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200501 @{$res->{$XPASS_UNSUPPORTED}} = ();
502 @{$res->{$XPASS_UNTESTED}} = ();
503 @{$res->{$XPASS_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200504 @{$res->{$XPASS_DISAPPEARS}} = ();
505 @{$res->{$XPASS_APPEARS}} = ();
506
507 @{$res->{$FAIL_PASS}} = ();
508 @{$res->{$FAIL_XPASS}} = ();
509 @{$res->{$FAIL_FAIL}} = ();
510 @{$res->{$FAIL_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000511 @{$res->{$FAIL_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200512 @{$res->{$FAIL_UNSUPPORTED}} = ();
513 @{$res->{$FAIL_UNTESTED}} = ();
514 @{$res->{$FAIL_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200515 @{$res->{$FAIL_DISAPPEARS}} = ();
516 @{$res->{$FAIL_APPEARS}} = ();
517
Christophe Lyondded4d82016-06-28 18:12:38 +0200518 @{$res->{$XFAIL_PASS}} = ();
519 @{$res->{$XFAIL_XPASS}} = ();
520 @{$res->{$XFAIL_FAIL}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200521 @{$res->{$XFAIL_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000522 @{$res->{$XFAIL_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200523 @{$res->{$XFAIL_UNSUPPORTED}} = ();
524 @{$res->{$XFAIL_UNTESTED}} = ();
525 @{$res->{$XFAIL_UNRESOLVED}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200526 @{$res->{$XFAIL_DISAPPEARS}} = ();
527 @{$res->{$XFAIL_APPEARS}} = ();
528
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000529 @{$res->{$KFAIL_PASS}} = ();
530 @{$res->{$KFAIL_XPASS}} = ();
531 @{$res->{$KFAIL_FAIL}} = ();
532 @{$res->{$KFAIL_XFAIL}} = ();
533 @{$res->{$KFAIL_KFAIL}} = ();
534 @{$res->{$KFAIL_UNSUPPORTED}} = ();
535 @{$res->{$KFAIL_UNTESTED}} = ();
536 @{$res->{$KFAIL_UNRESOLVED}} = ();
537 @{$res->{$KFAIL_DISAPPEARS}} = ();
538 @{$res->{$KFAIL_APPEARS}} = ();
539
Christophe Lyona140aa82015-12-17 22:53:03 +0100540 @{$res->{$UNSUPPORTED_PASS}} = ();
541 @{$res->{$UNSUPPORTED_XPASS}} = ();
542 @{$res->{$UNSUPPORTED_FAIL}} = ();
543 @{$res->{$UNSUPPORTED_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000544 @{$res->{$UNSUPPORTED_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200545 @{$res->{$UNSUPPORTED_UNSUPPORTED}} = ();
546 @{$res->{$UNSUPPORTED_UNTESTED}} = ();
547 @{$res->{$UNSUPPORTED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100548 @{$res->{$UNSUPPORTED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200549 @{$res->{$UNSUPPORTED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200550
Christophe Lyona140aa82015-12-17 22:53:03 +0100551 @{$res->{$UNTESTED_PASS}} = ();
552 @{$res->{$UNTESTED_XPASS}} = ();
553 @{$res->{$UNTESTED_FAIL}} = ();
554 @{$res->{$UNTESTED_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000555 @{$res->{$UNTESTED_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200556 @{$res->{$UNTESTED_UNSUPPORTED}} = ();
557 @{$res->{$UNTESTED_UNTESTED}} = ();
558 @{$res->{$UNTESTED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100559 @{$res->{$UNTESTED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200560 @{$res->{$UNTESTED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200561
Christophe Lyona140aa82015-12-17 22:53:03 +0100562 @{$res->{$UNRESOLVED_PASS}} = ();
563 @{$res->{$UNRESOLVED_XPASS}} = ();
564 @{$res->{$UNRESOLVED_FAIL}} = ();
565 @{$res->{$UNRESOLVED_XFAIL}} = ();
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000566 @{$res->{$UNRESOLVED_KFAIL}} = ();
Christophe Lyon9dde3332016-06-28 23:00:00 +0200567 @{$res->{$UNRESOLVED_UNSUPPORTED}} = ();
568 @{$res->{$UNRESOLVED_UNTESTED}} = ();
569 @{$res->{$UNRESOLVED_UNRESOLVED}} = ();
Christophe Lyona140aa82015-12-17 22:53:03 +0100570 @{$res->{$UNRESOLVED_DISAPPEARS}} = ();
Christophe Lyondc66fc52016-04-05 17:38:07 +0200571 @{$res->{$UNRESOLVED_APPEARS}} = ();
Christophe Lyonfdfbd172016-06-28 18:38:55 +0200572
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200573 @{$res->{$ERROR_DISAPPEARS}} = ();
574 @{$res->{$ERROR_APPEARS}} = ();
575
Christophe Lyonbff39612015-11-18 16:29:11 +0100576 @{$res->{$UNHANDLED_CASES}} = ();
577 @{$res->{$UNSTABLE_CASES}} = ();
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000578 @{$res->{$HWDEP_CASES}} = ();
Christophe Lyonbff39612015-11-18 16:29:11 +0100579
580 #### MERGE REF AND RES
581 foreach my $key (sort (keys %{$res->{testcases}}))
582 {
583 if (not exists $ref->{testcases}->{$key}) {
584 $ref->{testcases}->{$key} = empty_result();
585 $ref->{testcases}->{$key}->{NO_EXIST} = 1;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000586 $ref->{testcases}->{$key}->{TOOL_EXP} = $res->{testcases}->{$key}->{TOOL_EXP};
Christophe Lyonbff39612015-11-18 16:29:11 +0100587 }
Christophe Lyon9a3ce972021-06-30 23:18:23 +0000588
589 # Consistency check, useful in case of duplicate test names
590 if ($ref->{testcases}->{$key}->{NB} != $res->{testcases}->{$key}->{NB}) {
591 print "Number of occurrences mismatch $key (ref $ref->{testcases}->{$key}->{NB} vs $res->{testcases}->{$key}->{NB})\n" if ($debug);
592 if ($ref->{testcases}->{$key}->{NB} > $res->{testcases}->{$key}->{NB}) {
593 $res->{testcases}->{$key}->{NO_EXIST} = 1;
594 } elsif ($ref->{testcases}->{$key}->{NB} < $res->{testcases}->{$key}->{NB}) {
595 $ref->{testcases}->{$key}->{NO_EXIST} = 1;
596 }
597 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100598 }
599 foreach my $key (keys %{$ref->{testcases}})
600 {
601 if (not exists $res->{testcases}->{$key})
602 {
603 $res->{testcases}->{$key} = empty_result();
604 $res->{testcases}->{$key}->{NO_EXIST} = 1;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000605 $res->{testcases}->{$key}->{TOOL_EXP} = $ref->{testcases}->{$key}->{TOOL_EXP};
Christophe Lyonbff39612015-11-18 16:29:11 +0100606 }
Christophe Lyon9a3ce972021-06-30 23:18:23 +0000607
608 # No need for similar consistency check: since we are
609 # checking for tests whose number of occurrences are
610 # different, they are present in both ref and res, so
611 # no need to check again here.
Christophe Lyonbff39612015-11-18 16:29:11 +0100612 }
613
614 #### ACTIONS FOR EACH CASES
615 my %unstable_found;
616
617 foreach my $key (sort (keys %{$ref->{testcases}}))
618 {
619 foreach my $diag_diag (@handler_list)
620 {
621 if ($ref->{testcases}->{$key}->{$diag_diag->{was}} != $res->{testcases}->{$key}->{$diag_diag->{was}}
Christophe Lyon9a3ce972021-06-30 23:18:23 +0000622 and $ref->{testcases}->{$key}->{$diag_diag->{was}}
Christophe Lyonbff39612015-11-18 16:29:11 +0100623 and $res->{testcases}->{$key}->{$diag_diag->{is}})
624 {
Christophe Lyon1ed93102021-06-30 23:04:43 +0000625 print "$key ref $diag_diag->{was}:$ref->{testcases}->{$key}->{$diag_diag->{was}}, res $diag_diag->{was}:$res->{testcases}->{$key}->{$diag_diag->{was}}, res $diag_diag->{is}:$res->{testcases}->{$key}->{$diag_diag->{is}} \n" if ($debug);
Christophe Lyon28a92782017-09-13 09:00:39 +0000626 # If testcase is listed as 'unstable' mark it as such
627 # and skip other processing to avoid listing it twice.
Christophe Lyonbff39612015-11-18 16:29:11 +0100628 {
629 if (grep { (index $key,$_)!=-1} @unstablelist)
630 {
631 print "[unstable] $key\n" if ($debug);
632 $unstable_found{$key}=1;
633 }
634 else {
635 print "[$diag_diag->{was} => $diag_diag->{is}] $key\n" if ($debug);
636 if ($diag_diag->{handler})
637 {
638 $diag_diag->{handler} ($ref, $res, $diag_diag, $key);
639 }
640 else
641 {
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000642 # This transition is flagged as hw-dependent if:
643 # - the name is in the list
644 # - the transition should not be reported (but be flagged as hw-dependent instead)
645 # - --no-hwdep was not provided
646 if ((grep { (index $key,$_)!=-1} @hwdep_list)
647 && ($diag_diag->{report_hwdep} eq "false")
648 && ($no_hwdep == 0)) {
649 push @{$res->{$HWDEP_CASES}}, $key;
650 } else {
651 push @{$res->{$diag_diag->{cat}}}, $key;
652 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100653 }
654 }
655 }
656 }
657 }
658 }
659 push @{$res->{$UNSTABLE_CASES}}, (sort (keys (%unstable_found))) if ($nounstable == 0);
660
661}
662
663######################################################
664# PRINTING
665sub print_tclist($@)
666{
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000667 # The 1st parameter is used to find the name of the .exp file
Christophe Lyon28a92782017-09-13 09:00:39 +0000668 # associated with the testcase.
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000669 my ($this_res, $cat, @tclist) = @_;
Christophe Lyonc63afc92021-07-01 09:52:29 +0000670 my $this_tool_exp = "";
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000671 if (scalar(@tclist))
672 {
673 print " - ".$cat.":\n\n";
674 foreach my $case (@tclist)
675 {
Christophe Lyonc63afc92021-07-01 09:52:29 +0000676 if ($this_tool_exp ne $this_res->{testcases}->{$case}->{TOOL_EXP}) {
677 $this_tool_exp = $this_res->{testcases}->{$case}->{TOOL_EXP};
678 print " Executed from: $this_tool_exp\n";
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000679 }
680 print " $case\n";
681 }
682 print "\n\n";
683 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100684}
685
686sub print_compare_results_summary($$)
687{
688 my ($ref, $res) = @_;
689 my $return_value=0;
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100690 my $total_better = 0;
Christophe Lyonbff39612015-11-18 16:29:11 +0100691 my $rtotal = 0;
692 my $quiet_reg = $quiet;
Christophe Lyond618f662016-02-02 19:07:58 +0100693 my $ref_ratio = 0;
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200694 my $ref_total = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100695 my $res_ratio = 0;
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200696 my $res_total = 0;
Christophe Lyonad8c7242016-02-03 13:04:28 +0100697 my $ignore_exec = 0;
698 my $ref_has_exec_tests = 0;
699 my $res_has_exec_tests = 0;
Christophe Lyond618f662016-02-02 19:07:58 +0100700
701 # Compute the pass ratio as a sanity check
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200702 $ref_total = $ref->{PASS} +
703 $ref->{XFAIL} +
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000704 $ref->{KFAIL} +
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200705 $ref->{XPASS} +
706 $ref->{FAIL} +
707 $ref->{UNRESOLVED} +
708 $ref->{UNSUPPORTED} +
709 $ref->{UNTESTED};
710
711 # It is possible that no test is executed at all (for instance if
712 # RUNTESTFLAGS was too restrictive). Avoid division by 0.
713 if ($ref_total > 0) {
714 $ref_ratio = ($ref->{PASS} + $ref->{XFAIL}) /
715 $ref_total;
716 }
717
718 $res_total = $res->{PASS} +
719 $res->{XFAIL} +
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000720 $res->{KFAIL} +
Christophe Lyon0ab7d352016-04-06 10:39:58 +0200721 $res->{XPASS} +
722 $res->{FAIL} +
723 $res->{UNRESOLVED} +
724 $res->{UNSUPPORTED} +
725 $res->{UNTESTED};
726
727 if ($res_total > 0) {
728 $res_ratio = ($res->{PASS} + $res->{XFAIL}) /
729 $res_total;
730 }
Christophe Lyonbff39612015-11-18 16:29:11 +0100731
732 if (not $quiet)
733 {
734 printf "Comparing:\n";
735 printf "REFERENCE:$ref_file_name\n";
736 printf "CURRENT: $res_file_name\n\n";
737 }
738
739 #### TESTS STATUS
740 if (not $quiet and not $short)
741 {
Thiago Jung Bauermann66d0ccb2023-03-01 05:15:40 +0000742 printf " +---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100743 printf "o RUN STATUS: | REF | RES |\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100744 printf " +------------------------------------------+---------+---------+\n";
Christophe Lyona140aa82015-12-17 22:53:03 +0100745 printf " | %-40s | %7d | %7d |\n", "Passes [PASS]", $ref->{PASS}, $res->{PASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100746 printf " | %-40s | %7d | %7d |\n", "Unexpected fails [FAIL]", $ref->{FAIL}, $res->{FAIL};
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200747 printf " | %-40s | %7d | %7d |\n", "Errors [ERROR]", $ref->{ERROR}, $res->{ERROR};
Christophe Lyona140aa82015-12-17 22:53:03 +0100748 printf " | %-40s | %7d | %7d |\n", "Unexpected passes [XPASS]", $ref->{XPASS}, $res->{XPASS};
Christophe Lyonbff39612015-11-18 16:29:11 +0100749 printf " | %-40s | %7d | %7d |\n", "Expected fails [XFAIL]", $ref->{XFAIL}, $res->{XFAIL};
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000750 printf " | %-40s | %7d | %7d |\n", "Known fails [KFAIL]", $ref->{KFAIL}, $res->{KFAIL};
Christophe Lyonbff39612015-11-18 16:29:11 +0100751 printf " | %-40s | %7d | %7d |\n", "Unresolved [UNRESOLVED]", $ref->{UNRESOLVED}, $res->{UNRESOLVED};
Christophe Lyona140aa82015-12-17 22:53:03 +0100752 printf " | %-40s | %7d | %7d |\n", "Unsupported [UNSUPPORTED]", $ref->{UNSUPPORTED}, $res->{UNSUPPORTED};
753 printf " | %-40s | %7d | %7d |\n", "Untested [UNTESTED]", $ref->{UNTESTED}, $res->{UNTESTED};
Christophe Lyonbff39612015-11-18 16:29:11 +0100754 printf " +------------------------------------------+---------+---------+\n";
755 printf "\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100756
Christophe Lyon3d195c22016-04-06 16:00:25 +0200757 printf " REF PASS ratio: %f\n", $ref_ratio;
758 printf " RES PASS ratio: %f\n", $res_ratio;
Christophe Lyond618f662016-02-02 19:07:58 +0100759 if ($ref_ratio < $ratio_thresh)
760 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100761 printf " ***** ERROR: REF PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100762 }
763 if ($res_ratio < $ratio_thresh)
764 {
Christophe Lyon1176f962016-03-03 18:01:10 +0100765 printf " ***** ERROR: RES PASS ratio is abnormally low *****\n";
Christophe Lyond618f662016-02-02 19:07:58 +0100766 }
767
Christophe Lyonad8c7242016-02-03 13:04:28 +0100768 # If both PASS and FAIL EXEC tests are zero, assume there is no
769 # execution test for this tool, and do not warn.
770 $ref_has_exec_tests = ($ref->{EXEC}->{PASS} + $ref->{EXEC}->{FAIL}) != 0;
771 if ($ref_has_exec_tests)
772 {
773 printf " ***** ERROR: No REF execution test PASSed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{PASS} == 0);
774 printf " ***** WARNING: No REF execution test FAILed. Check execution engine configuration. *****\n" if ($ref->{EXEC}->{FAIL} == 0);
775 }
776
777 $res_has_exec_tests = ($res->{EXEC}->{PASS} + $res->{EXEC}->{FAIL}) != 0;
778 if ($res_has_exec_tests)
779 {
780 printf " ***** ERROR: No RES execution test PASSed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{PASS} == 0);
781 printf " ***** WARNING: No RES execution test FAILed. Check execution engine configuration. *****\n" if ($res->{EXEC}->{FAIL} == 0);
782 }
783
784 # Ignore number of execution tests when computing the return
785 # value, if both REF and RES have no execution test.
786 $ignore_exec = !$ref_has_exec_tests && !$res_has_exec_tests;
Christophe Lyonbff39612015-11-18 16:29:11 +0100787 }
788
789 #### REGRESSIONS ?
Christophe Lyon9dde3332016-06-28 23:00:00 +0200790 $rtotal = scalar(@{$res->{$PASS_XPASS}})
791 +scalar(@{$res->{$PASS_FAIL}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000792 +scalar(@{$res->{$PASS_KFAIL}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200793 +scalar(@{$res->{$PASS_UNRESOLVED}})
794 +scalar(@{$res->{$PASSED_NOW_TIMEOUTS}})
Christophe Lyon30037832018-11-30 15:33:20 +0000795 +scalar(@{$res->{$ERROR_APPEARS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200796 +scalar(@{$res->{$XPASS_FAIL}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000797 +scalar(@{$res->{$XPASS_KFAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100798 +scalar(@{$res->{$XPASS_APPEARS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200799 +scalar(@{$res->{$XPASS_UNRESOLVED}})
800 +scalar(@{$res->{$FAIL_APPEARS}})
801 +scalar(@{$res->{$FAIL_UNRESOLVED}})
Christophe Lyondded4d82016-06-28 18:12:38 +0200802 +scalar(@{$res->{$XFAIL_FAIL}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200803 +scalar(@{$res->{$XFAIL_UNRESOLVED}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000804 +scalar(@{$res->{$KFAIL_APPEARS}})
805 +scalar(@{$res->{$KFAIL_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100806 +scalar(@{$res->{$UNSUPPORTED_FAIL}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000807 +scalar(@{$res->{$UNSUPPORTED_KFAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100808 +scalar(@{$res->{$UNSUPPORTED_XPASS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200809 +scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100810 +scalar(@{$res->{$UNTESTED_FAIL}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000811 +scalar(@{$res->{$UNTESTED_KFAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100812 +scalar(@{$res->{$UNTESTED_XPASS}})
Christophe Lyon9dde3332016-06-28 23:00:00 +0200813 +scalar(@{$res->{$UNTESTED_UNRESOLVED}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100814 +scalar(@{$res->{$UNRESOLVED_FAIL}})
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000815 +scalar(@{$res->{$UNRESOLVED_KFAIL}})
Christophe Lyona140aa82015-12-17 22:53:03 +0100816 +scalar(@{$res->{$UNRESOLVED_XPASS}})
Christophe Lyon30037832018-11-30 15:33:20 +0000817 +scalar(@{$res->{$UNRESOLVED_APPEARS}});
Christophe Lyona140aa82015-12-17 22:53:03 +0100818
819 $quiet_reg=1 if ($short and not $rtotal);
Christophe Lyonbff39612015-11-18 16:29:11 +0100820
821 if (not $quiet_reg)
822 {
Christophe Lyona140aa82015-12-17 22:53:03 +0100823 printf "\n$col_red"."o REGRESSIONS:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100824 printf " +------------------------------------------+---------+\n";
Christophe Lyondded4d82016-06-28 18:12:38 +0200825 printf " | %-40s | %7d |\n", $PASS_XPASS, scalar(@{$res->{$PASS_XPASS}}) if (scalar(@{$res->{$PASS_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200826 printf " | %-40s | %7d |\n", $PASS_FAIL, scalar(@{$res->{$PASS_FAIL}}) if (scalar(@{$res->{$PASS_FAIL}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000827 printf " | %-40s | %7d |\n", $PASS_KFAIL, scalar(@{$res->{$PASS_KFAIL}}) if (scalar(@{$res->{$PASS_KFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200828 printf " | %-40s | %7d |\n", $PASS_UNRESOLVED, scalar(@{$res->{$PASS_UNRESOLVED}}) if (scalar(@{$res->{$PASS_UNRESOLVED}}));
829 printf " | %-40s | %7d |\n", $PASSED_NOW_TIMEOUTS, scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}) if (scalar(@{$res->{$PASSED_NOW_TIMEOUTS}}));
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200830 printf " | %-40s | %7d |\n", $ERROR_APPEARS, scalar(@{$res->{$ERROR_APPEARS}}) if (scalar(@{$res->{$ERROR_APPEARS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200831 printf " | %-40s | %7d |\n", $XPASS_FAIL, scalar(@{$res->{$XPASS_FAIL}}) if (scalar(@{$res->{$XPASS_FAIL}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000832 printf " | %-40s | %7d |\n", $XPASS_KFAIL, scalar(@{$res->{$XPASS_KFAIL}}) if (scalar(@{$res->{$XPASS_KFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200833 printf " | %-40s | %7d |\n", $XPASS_APPEARS, scalar(@{$res->{$XPASS_APPEARS}}) if (scalar(@{$res->{$XPASS_APPEARS}}));
834 printf " | %-40s | %7d |\n", $XPASS_UNRESOLVED, scalar(@{$res->{$XPASS_UNRESOLVED}}) if (scalar(@{$res->{$XPASS_UNRESOLVED}}));
835 printf " | %-40s | %7d |\n", $FAIL_APPEARS, scalar(@{$res->{$FAIL_APPEARS}}) if (scalar(@{$res->{$FAIL_APPEARS}}));
836 printf " | %-40s | %7d |\n", $FAIL_UNRESOLVED, scalar(@{$res->{$FAIL_UNRESOLVED}}) if (scalar(@{$res->{$FAIL_UNRESOLVED}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200837 printf " | %-40s | %7d |\n", $XFAIL_FAIL, scalar(@{$res->{$XFAIL_FAIL}}) if (scalar(@{$res->{$XFAIL_FAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200838 printf " | %-40s | %7d |\n", $XFAIL_UNRESOLVED, scalar(@{$res->{$XFAIL_UNRESOLVED}}) if (scalar(@{$res->{$XFAIL_UNRESOLVED}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000839 printf " | %-40s | %7d |\n", $KFAIL_APPEARS, scalar(@{$res->{$KFAIL_APPEARS}}) if (scalar(@{$res->{$KFAIL_APPEARS}}));
840 printf " | %-40s | %7d |\n", $KFAIL_UNRESOLVED, scalar(@{$res->{$KFAIL_UNRESOLVED}}) if (scalar(@{$res->{$KFAIL_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100841 printf " | %-40s | %7d |\n", $UNSUPPORTED_FAIL, scalar(@{$res->{$UNSUPPORTED_FAIL}}) if (scalar(@{$res->{$UNSUPPORTED_FAIL}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000842 printf " | %-40s | %7d |\n", $UNSUPPORTED_KFAIL, scalar(@{$res->{$UNSUPPORTED_KFAIL}}) if (scalar(@{$res->{$UNSUPPORTED_KFAIL}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100843 printf " | %-40s | %7d |\n", $UNSUPPORTED_XPASS, scalar(@{$res->{$UNSUPPORTED_XPASS}}) if (scalar(@{$res->{$UNSUPPORTED_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200844 printf " | %-40s | %7d |\n", $UNSUPPORTED_UNRESOLVED, scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}}) if (scalar(@{$res->{$UNSUPPORTED_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100845 printf " | %-40s | %7d |\n", $UNTESTED_FAIL, scalar(@{$res->{$UNTESTED_FAIL}}) if (scalar(@{$res->{$UNTESTED_FAIL}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000846 printf " | %-40s | %7d |\n", $UNTESTED_KFAIL, scalar(@{$res->{$UNTESTED_KFAIL}}) if (scalar(@{$res->{$UNTESTED_KFAIL}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100847 printf " | %-40s | %7d |\n", $UNTESTED_XPASS, scalar(@{$res->{$UNTESTED_XPASS}}) if (scalar(@{$res->{$UNTESTED_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200848 printf " | %-40s | %7d |\n", $UNTESTED_UNRESOLVED, scalar(@{$res->{$UNTESTED_UNRESOLVED}}) if (scalar(@{$res->{$UNTESTED_UNRESOLVED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100849 printf " | %-40s | %7d |\n", $UNRESOLVED_FAIL, scalar(@{$res->{$UNRESOLVED_FAIL}}) if (scalar(@{$res->{$UNRESOLVED_FAIL}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000850 printf " | %-40s | %7d |\n", $UNRESOLVED_KFAIL, scalar(@{$res->{$UNRESOLVED_KFAIL}}) if (scalar(@{$res->{$UNRESOLVED_KFAIL}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100851 printf " | %-40s | %7d |\n", $UNRESOLVED_XPASS, scalar(@{$res->{$UNRESOLVED_XPASS}}) if (scalar(@{$res->{$UNRESOLVED_XPASS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200852 printf " | %-40s | %7d |\n", $UNRESOLVED_APPEARS, scalar(@{$res->{$UNRESOLVED_APPEARS}}) if (scalar(@{$res->{$UNRESOLVED_APPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100853 printf " +------------------------------------------+---------+\n";
854 printf " | %-40s | %7d |\n", "TOTAL_REGRESSIONS", $rtotal;
855 printf " +------------------------------------------+---------+\n";
856 printf "\n";
857
858 if ($long)
859 {
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000860 print_tclist($res, $PASS_XPASS, @{$res->{$PASS_XPASS}});
861 print_tclist($res, $PASS_FAIL, @{$res->{$PASS_FAIL}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000862 print_tclist($res, $PASS_KFAIL, @{$res->{$PASS_KFAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000863 print_tclist($res, $PASS_UNRESOLVED, @{$res->{$PASS_UNRESOLVED}});
864 print_tclist($res, $PASSED_NOW_TIMEOUTS, @{$res->{$PASSED_NOW_TIMEOUTS}});
865 print_tclist($res, $ERROR_APPEARS, @{$res->{$ERROR_APPEARS}});
866 print_tclist($res, $XPASS_FAIL, @{$res->{$XPASS_FAIL}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000867 print_tclist($res, $XPASS_KFAIL, @{$res->{$XPASS_KFAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000868 print_tclist($res, $XPASS_APPEARS, @{$res->{$XPASS_APPEARS}});
869 print_tclist($res, $XPASS_UNRESOLVED, @{$res->{$XPASS_UNRESOLVED}});
870 print_tclist($res, $FAIL_APPEARS, @{$res->{$FAIL_APPEARS}});
871 print_tclist($res, $FAIL_UNRESOLVED, @{$res->{$FAIL_UNRESOLVED}});
872 print_tclist($res, $XFAIL_FAIL, @{$res->{$XFAIL_FAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000873 print_tclist($res, $XFAIL_UNRESOLVED, @{$res->{$XFAIL_UNRESOLVED}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000874 print_tclist($res, $KFAIL_APPEARS, @{$res->{$KFAIL_APPEARS}});
875 print_tclist($res, $KFAIL_UNRESOLVED, @{$res->{$KFAIL_UNRESOLVED}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000876 print_tclist($res, $UNSUPPORTED_FAIL, @{$res->{$UNSUPPORTED_FAIL}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000877 print_tclist($res, $UNSUPPORTED_KFAIL, @{$res->{$UNSUPPORTED_KFAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000878 print_tclist($res, $UNSUPPORTED_XPASS, @{$res->{$UNSUPPORTED_XPASS}});
879 print_tclist($res, $UNSUPPORTED_UNRESOLVED, @{$res->{$UNSUPPORTED_UNRESOLVED}});
880 print_tclist($res, $UNTESTED_FAIL, @{$res->{$UNTESTED_FAIL}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000881 print_tclist($res, $UNTESTED_KFAIL, @{$res->{$UNTESTED_KFAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000882 print_tclist($res, $UNTESTED_XPASS, @{$res->{$UNTESTED_XPASS}});
883 print_tclist($res, $UNTESTED_UNRESOLVED, @{$res->{$UNTESTED_UNRESOLVED}});
884 print_tclist($res, $UNRESOLVED_FAIL, @{$res->{$UNRESOLVED_FAIL}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000885 print_tclist($res, $UNRESOLVED_KFAIL, @{$res->{$UNRESOLVED_KFAIL}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000886 print_tclist($res, $UNRESOLVED_XPASS, @{$res->{$UNRESOLVED_XPASS}});
887 print_tclist($res, $UNRESOLVED_APPEARS, @{$res->{$UNRESOLVED_APPEARS}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100888 }
889 printf "$col_reset\n";
890 }
891
Christophe Lyon924cce42018-11-30 15:38:19 +0000892 #### IMPROVEMENTS TO BE CHECKED ?
Christophe Lyonbff39612015-11-18 16:29:11 +0100893 if (not $quiet and not $short)
894 {
Christophe Lyon9dde3332016-06-28 23:00:00 +0200895 $total_better =
Christophe Lyon31279df2016-07-04 17:02:12 +0200896 scalar(@{$res->{$PASS_DISAPPEARS}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200897 scalar(@{$res->{$PASS_XFAIL}})+
898 scalar(@{$res->{$PASS_APPEARS}})+
899 scalar(@{$res->{$PASS_UNSUPPORTED}})+
900 scalar(@{$res->{$PASS_UNTESTED}})+
901 scalar(@{$res->{$XPASS_PASS}})+
902 scalar(@{$res->{$XPASS_XFAIL}})+
903 scalar(@{$res->{$XPASS_UNSUPPORTED}})+
904 scalar(@{$res->{$XPASS_UNTESTED}})+
905 scalar(@{$res->{$XPASS_DISAPPEARS}})+
Christophe Lyondded4d82016-06-28 18:12:38 +0200906 scalar(@{$res->{$FAIL_PASS}})+
907 scalar(@{$res->{$FAIL_XPASS}})+
Christophe Lyondded4d82016-06-28 18:12:38 +0200908 scalar(@{$res->{$FAIL_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200909 scalar(@{$res->{$FAIL_UNSUPPORTED}})+
910 scalar(@{$res->{$FAIL_UNTESTED}})+
911 scalar(@{$res->{$FAIL_DISAPPEARS}})+
Christophe Lyon3b675e82018-11-30 15:24:32 +0000912 scalar(@{$res->{$XFAIL_DISAPPEARS}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200913 scalar(@{$res->{$XFAIL_PASS}})+
914 scalar(@{$res->{$XFAIL_XPASS}})+
915 scalar(@{$res->{$XFAIL_UNSUPPORTED}})+
916 scalar(@{$res->{$XFAIL_UNTESTED}})+
917 scalar(@{$res->{$XFAIL_APPEARS}})+
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000918 scalar(@{$res->{$KFAIL_PASS}})+
919 scalar(@{$res->{$KFAIL_XPASS}})+
920 scalar(@{$res->{$KFAIL_XFAIL}})+
921 scalar(@{$res->{$KFAIL_UNSUPPORTED}})+
922 scalar(@{$res->{$KFAIL_UNTESTED}})+
923 scalar(@{$res->{$KFAIL_DISAPPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100924 scalar(@{$res->{$UNSUPPORTED_PASS}})+
925 scalar(@{$res->{$UNSUPPORTED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200926 scalar(@{$res->{$UNSUPPORTED_UNTESTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100927 scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}})+
Christophe Lyondc66fc52016-04-05 17:38:07 +0200928 scalar(@{$res->{$UNSUPPORTED_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100929 scalar(@{$res->{$UNTESTED_PASS}})+
930 scalar(@{$res->{$UNTESTED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200931 scalar(@{$res->{$UNTESTED_UNSUPPORTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100932 scalar(@{$res->{$UNTESTED_DISAPPEARS}})+
Christophe Lyondc66fc52016-04-05 17:38:07 +0200933 scalar(@{$res->{$UNTESTED_APPEARS}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100934 scalar(@{$res->{$UNRESOLVED_PASS}})+
935 scalar(@{$res->{$UNRESOLVED_XFAIL}})+
Christophe Lyon9dde3332016-06-28 23:00:00 +0200936 scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}})+
937 scalar(@{$res->{$UNRESOLVED_UNTESTED}})+
Christophe Lyona140aa82015-12-17 22:53:03 +0100938 scalar(@{$res->{$UNRESOLVED_DISAPPEARS}})+
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200939 scalar(@{$res->{$ERROR_DISAPPEARS}})+
Christophe Lyonf5aeb342015-12-08 14:47:16 +0100940 scalar(@{$res->{$UNHANDLED_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +0100941
Christophe Lyon924cce42018-11-30 15:38:19 +0000942 printf "$col_pink"."o IMPROVEMENTS TO BE CHECKED:\n";
Christophe Lyonbff39612015-11-18 16:29:11 +0100943 printf " +------------------------------------------+---------+\n";
Christophe Lyon31279df2016-07-04 17:02:12 +0200944 printf " | %-40s | %7d |\n", $PASS_DISAPPEARS, scalar(@{$res->{$PASS_DISAPPEARS}}) if (scalar(@{$res->{$PASS_DISAPPEARS}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200945 printf " | %-40s | %7d |\n", $PASS_XFAIL, scalar(@{$res->{$PASS_XFAIL}}) if (scalar(@{$res->{$PASS_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200946 printf " | %-40s | %7d |\n", $PASS_APPEARS, scalar(@{$res->{$PASS_APPEARS}}) if (scalar(@{$res->{$PASS_APPEARS}}));
947 printf " | %-40s | %7d |\n", $PASS_UNSUPPORTED, scalar(@{$res->{$PASS_UNSUPPORTED}}) if (scalar(@{$res->{$PASS_UNSUPPORTED}}));
948 printf " | %-40s | %7d |\n", $PASS_UNTESTED, scalar(@{$res->{$PASS_UNTESTED}}) if (scalar(@{$res->{$PASS_UNTESTED}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200949 printf " | %-40s | %7d |\n", $XPASS_PASS, scalar(@{$res->{$XPASS_PASS}}) if (scalar(@{$res->{$XPASS_PASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200950 printf " | %-40s | %7d |\n", $XPASS_XFAIL, scalar(@{$res->{$XPASS_XFAIL}}) if (scalar(@{$res->{$XPASS_XFAIL}}));
951 printf " | %-40s | %7d |\n", $XPASS_UNSUPPORTED, scalar(@{$res->{$XPASS_UNSUPPORTED}}) if (scalar(@{$res->{$XPASS_UNSUPPORTED}}));
952 printf " | %-40s | %7d |\n", $XPASS_UNTESTED, scalar(@{$res->{$XPASS_UNTESTED}}) if (scalar(@{$res->{$XPASS_UNTESTED}}));
953 printf " | %-40s | %7d |\n", $XPASS_DISAPPEARS, scalar(@{$res->{$XPASS_DISAPPEARS}}) if (scalar(@{$res->{$XPASS_DISAPPEARS}}));
Christophe Lyondded4d82016-06-28 18:12:38 +0200954 printf " | %-40s | %7d |\n", $FAIL_PASS, scalar(@{$res->{$FAIL_PASS}}) if (scalar(@{$res->{$FAIL_PASS}}));
955 printf " | %-40s | %7d |\n", $FAIL_XPASS, scalar(@{$res->{$FAIL_XPASS}}) if (scalar(@{$res->{$FAIL_XPASS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200956 printf " | %-40s | %7d |\n", $FAIL_XFAIL, scalar(@{$res->{$FAIL_XFAIL}}) if (scalar(@{$res->{$FAIL_XFAIL}}));
957 printf " | %-40s | %7d |\n", $FAIL_UNSUPPORTED, scalar(@{$res->{$FAIL_UNSUPPORTED}}) if (scalar(@{$res->{$FAIL_UNSUPPORTED}}));
958 printf " | %-40s | %7d |\n", $FAIL_UNTESTED, scalar(@{$res->{$FAIL_UNTESTED}}) if (scalar(@{$res->{$FAIL_UNTESTED}}));
959 printf " | %-40s | %7d |\n", $FAIL_DISAPPEARS, scalar(@{$res->{$FAIL_DISAPPEARS}}) if (scalar(@{$res->{$FAIL_DISAPPEARS}}));
Christophe Lyon3b675e82018-11-30 15:24:32 +0000960 printf " | %-40s | %7d |\n", $XFAIL_DISAPPEARS, scalar(@{$res->{$XFAIL_DISAPPEARS}}) if (scalar(@{$res->{$XFAIL_DISAPPEARS}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200961 printf " | %-40s | %7d |\n", $XFAIL_PASS, scalar(@{$res->{$XFAIL_PASS}}) if (scalar(@{$res->{$XFAIL_PASS}}));
962 printf " | %-40s | %7d |\n", $XFAIL_XPASS, scalar(@{$res->{$XFAIL_XPASS}}) if (scalar(@{$res->{$XFAIL_XPASS}}));
963 printf " | %-40s | %7d |\n", $XFAIL_UNSUPPORTED, scalar(@{$res->{$XFAIL_UNSUPPORTED}}) if (scalar(@{$res->{$XFAIL_UNSUPPORTED}}));
964 printf " | %-40s | %7d |\n", $XFAIL_UNTESTED, scalar(@{$res->{$XFAIL_UNTESTED}}) if (scalar(@{$res->{$XFAIL_UNTESTED}}));
965 printf " | %-40s | %7d |\n", $XFAIL_APPEARS, scalar(@{$res->{$XFAIL_APPEARS}}) if (scalar(@{$res->{$XFAIL_APPEARS}}));
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +0000966 printf " | %-40s | %7d |\n", $KFAIL_PASS, scalar(@{$res->{$KFAIL_PASS}}) if (scalar(@{$res->{$KFAIL_PASS}}));
967 printf " | %-40s | %7d |\n", $KFAIL_XPASS, scalar(@{$res->{$KFAIL_XPASS}}) if (scalar(@{$res->{$KFAIL_XPASS}}));
968 printf " | %-40s | %7d |\n", $KFAIL_XFAIL, scalar(@{$res->{$KFAIL_XFAIL}}) if (scalar(@{$res->{$KFAIL_XFAIL}}));
969 printf " | %-40s | %7d |\n", $KFAIL_UNSUPPORTED, scalar(@{$res->{$KFAIL_UNSUPPORTED}}) if (scalar(@{$res->{$KFAIL_UNSUPPORTED}}));
970 printf " | %-40s | %7d |\n", $KFAIL_UNTESTED, scalar(@{$res->{$KFAIL_UNTESTED}}) if (scalar(@{$res->{$KFAIL_UNTESTED}}));
971 printf " | %-40s | %7d |\n", $KFAIL_DISAPPEARS, scalar(@{$res->{$KFAIL_DISAPPEARS}}) if (scalar(@{$res->{$KFAIL_DISAPPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100972 printf " | %-40s | %7d |\n", $UNSUPPORTED_PASS, scalar(@{$res->{$UNSUPPORTED_PASS}}) if (scalar(@{$res->{$UNSUPPORTED_PASS}}));
973 printf " | %-40s | %7d |\n", $UNSUPPORTED_XFAIL, scalar(@{$res->{$UNSUPPORTED_XFAIL}}) if (scalar(@{$res->{$UNSUPPORTED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200974 printf " | %-40s | %7d |\n", $UNSUPPORTED_UNTESTED, scalar(@{$res->{$UNSUPPORTED_UNTESTED}}) if (scalar(@{$res->{$UNSUPPORTED_UNTESTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100975 printf " | %-40s | %7d |\n", $UNSUPPORTED_DISAPPEARS, scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_DISAPPEARS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200976 printf " | %-40s | %7d |\n", $UNSUPPORTED_APPEARS, scalar(@{$res->{$UNSUPPORTED_APPEARS}}) if (scalar(@{$res->{$UNSUPPORTED_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100977 printf " | %-40s | %7d |\n", $UNTESTED_PASS, scalar(@{$res->{$UNTESTED_PASS}}) if (scalar(@{$res->{$UNTESTED_PASS}}));
978 printf " | %-40s | %7d |\n", $UNTESTED_XFAIL, scalar(@{$res->{$UNTESTED_XFAIL}}) if (scalar(@{$res->{$UNTESTED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200979 printf " | %-40s | %7d |\n", $UNTESTED_UNSUPPORTED, scalar(@{$res->{$UNTESTED_UNSUPPORTED}}) if (scalar(@{$res->{$UNTESTED_UNSUPPORTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100980 printf " | %-40s | %7d |\n", $UNTESTED_DISAPPEARS, scalar(@{$res->{$UNTESTED_DISAPPEARS}}) if (scalar(@{$res->{$UNTESTED_DISAPPEARS}}));
Christophe Lyondc66fc52016-04-05 17:38:07 +0200981 printf " | %-40s | %7d |\n", $UNTESTED_APPEARS, scalar(@{$res->{$UNTESTED_APPEARS}}) if (scalar(@{$res->{$UNTESTED_APPEARS}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100982 printf " | %-40s | %7d |\n", $UNRESOLVED_PASS, scalar(@{$res->{$UNRESOLVED_PASS}}) if (scalar(@{$res->{$UNRESOLVED_PASS}}));
983 printf " | %-40s | %7d |\n", $UNRESOLVED_XFAIL, scalar(@{$res->{$UNRESOLVED_XFAIL}}) if (scalar(@{$res->{$UNRESOLVED_XFAIL}}));
Christophe Lyon9dde3332016-06-28 23:00:00 +0200984 printf " | %-40s | %7d |\n", $UNRESOLVED_UNSUPPORTED, scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}}) if (scalar(@{$res->{$UNRESOLVED_UNSUPPORTED}}));
985 printf " | %-40s | %7d |\n", $UNRESOLVED_UNTESTED, scalar(@{$res->{$UNRESOLVED_UNTESTED}}) if (scalar(@{$res->{$UNRESOLVED_UNTESTED}}));
Christophe Lyona140aa82015-12-17 22:53:03 +0100986 printf " | %-40s | %7d |\n", $UNRESOLVED_DISAPPEARS, scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}) if (scalar(@{$res->{$UNRESOLVED_DISAPPEARS}}));
Christophe Lyonbcbd7482016-09-19 14:54:50 +0200987 printf " | %-40s | %7d |\n", $ERROR_DISAPPEARS, scalar(@{$res->{$ERROR_DISAPPEARS}}) if (scalar(@{$res->{$ERROR_DISAPPEARS}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100988 printf " | %-40s | %7d |\n", $UNHANDLED_CASES, scalar(@{$res->{$UNHANDLED_CASES}}) if (scalar(@{$res->{$UNHANDLED_CASES}}));
989 printf " | %-40s | %7d |\n", $UNSTABLE_CASES, scalar(@{$res->{$UNSTABLE_CASES}}) if (scalar(@{$res->{$UNSTABLE_CASES}}));
Christophe Lyon73ac1d82018-06-12 13:32:47 +0000990 printf " | %-40s | %7d |\n", $HWDEP_CASES, scalar(@{$res->{$HWDEP_CASES}}) if (scalar(@{$res->{$HWDEP_CASES}}));
Christophe Lyonbff39612015-11-18 16:29:11 +0100991 printf " +------------------------------------------+---------+\n";
Christophe Lyon924cce42018-11-30 15:38:19 +0000992 printf " | %-40s | %7d |\n", "TOTAL_IMPROVEMENTS_TO_BE_CHECKED", $total_better + scalar(@{$res->{$UNSTABLE_CASES}});;
Christophe Lyonbff39612015-11-18 16:29:11 +0100993 printf " +------------------------------------------+---------+\n";
994 printf "\n";
995
996 if ($long)
997 {
Christophe Lyon28a92782017-09-13 09:00:39 +0000998 print_tclist($res, $PASS_DISAPPEARS, @{$res->{$PASS_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +0000999 print_tclist($res, $PASS_XFAIL, @{$res->{$PASS_XFAIL}});
1000 print_tclist($res, $PASS_APPEARS, @{$res->{$PASS_APPEARS}});
1001 print_tclist($res, $PASS_UNSUPPORTED, @{$res->{$PASS_UNSUPPORTED}});
1002 print_tclist($res, $PASS_UNTESTED, @{$res->{$PASS_UNTESTED}});
1003 print_tclist($res, $XPASS_PASS, @{$res->{$XPASS_PASS}});
1004 print_tclist($res, $XPASS_XFAIL, @{$res->{$XPASS_XFAIL}});
1005 print_tclist($res, $XPASS_UNSUPPORTED, @{$res->{$XPASS_UNSUPPORTED}});
1006 print_tclist($res, $XPASS_UNTESTED, @{$res->{$XPASS_UNTESTED}});
Christophe Lyon28a92782017-09-13 09:00:39 +00001007 print_tclist($res, $XPASS_DISAPPEARS, @{$res->{$XPASS_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001008 print_tclist($res, $FAIL_PASS, @{$res->{$FAIL_PASS}});
1009 print_tclist($res, $FAIL_XPASS, @{$res->{$FAIL_XPASS}});
1010 print_tclist($res, $FAIL_XFAIL, @{$res->{$FAIL_XFAIL}});
1011 print_tclist($res, $FAIL_UNSUPPORTED, @{$res->{$FAIL_UNSUPPORTED}});
1012 print_tclist($res, $FAIL_UNTESTED, @{$res->{$FAIL_UNTESTED}});
Christophe Lyon28a92782017-09-13 09:00:39 +00001013 print_tclist($res, $FAIL_DISAPPEARS, @{$res->{$FAIL_DISAPPEARS}});
Christophe Lyon3b675e82018-11-30 15:24:32 +00001014 print_tclist($res, $XFAIL_DISAPPEARS, @{$res->{$XFAIL_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001015 print_tclist($res, $XFAIL_PASS, @{$res->{$XFAIL_PASS}});
1016 print_tclist($res, $XFAIL_XPASS, @{$res->{$XFAIL_XPASS}});
1017 print_tclist($res, $XFAIL_UNSUPPORTED, @{$res->{$XFAIL_UNSUPPORTED}});
1018 print_tclist($res, $XFAIL_UNTESTED, @{$res->{$XFAIL_UNTESTED}});
1019 print_tclist($res, $XFAIL_APPEARS, @{$res->{$XFAIL_APPEARS}});
Thiago Jung Bauermann3be267a2023-02-28 23:30:09 +00001020 print_tclist($res, $KFAIL_PASS, @{$res->{$KFAIL_PASS}});
1021 print_tclist($res, $KFAIL_XPASS, @{$res->{$KFAIL_XPASS}});
1022 print_tclist($res, $KFAIL_XFAIL, @{$res->{$KFAIL_XFAIL}});
1023 print_tclist($res, $KFAIL_UNSUPPORTED, @{$res->{$KFAIL_UNSUPPORTED}});
1024 print_tclist($res, $KFAIL_UNTESTED, @{$res->{$KFAIL_UNTESTED}});
1025 print_tclist($res, $KFAIL_DISAPPEARS, @{$res->{$KFAIL_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001026 print_tclist($res, $UNSUPPORTED_PASS, @{$res->{$UNSUPPORTED_PASS}});
1027 print_tclist($res, $UNSUPPORTED_XFAIL, @{$res->{$UNSUPPORTED_XFAIL}});
1028 print_tclist($res, $UNSUPPORTED_UNTESTED, @{$res->{$UNSUPPORTED_UNTESTED}});
Christophe Lyon28a92782017-09-13 09:00:39 +00001029 print_tclist($res, $UNSUPPORTED_DISAPPEARS, @{$res->{$UNSUPPORTED_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001030 print_tclist($res, $UNSUPPORTED_APPEARS, @{$res->{$UNSUPPORTED_APPEARS}});
1031 print_tclist($res, $UNTESTED_PASS, @{$res->{$UNTESTED_PASS}});
1032 print_tclist($res, $UNTESTED_XFAIL, @{$res->{$UNTESTED_XFAIL}});
1033 print_tclist($res, $UNTESTED_UNSUPPORTED, @{$res->{$UNTESTED_UNSUPPORTED}});
Christophe Lyon28a92782017-09-13 09:00:39 +00001034 print_tclist($res, $UNTESTED_DISAPPEARS, @{$res->{$UNTESTED_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001035 print_tclist($res, $UNTESTED_APPEARS, @{$res->{$UNTESTED_APPEARS}});
1036 print_tclist($res, $UNRESOLVED_PASS, @{$res->{$UNRESOLVED_PASS}});
1037 print_tclist($res, $UNRESOLVED_XFAIL, @{$res->{$UNRESOLVED_XFAIL}});
1038 print_tclist($res, $UNRESOLVED_UNSUPPORTED, @{$res->{$UNRESOLVED_UNSUPPORTED}});
1039 print_tclist($res, $UNRESOLVED_UNTESTED, @{$res->{$UNRESOLVED_UNTESTED}});
Christophe Lyon28a92782017-09-13 09:00:39 +00001040 print_tclist($res, $UNRESOLVED_DISAPPEARS, @{$res->{$UNRESOLVED_DISAPPEARS}});
1041 print_tclist($res, $ERROR_DISAPPEARS, @{$res->{$ERROR_DISAPPEARS}});
Christophe Lyon14d1ec82017-03-23 14:59:58 +00001042 print_tclist($res, $UNHANDLED_CASES, @{$res->{$UNHANDLED_CASES}});
1043 print_tclist($res, $UNSTABLE_CASES, @{$res->{$UNSTABLE_CASES}});
Christophe Lyon73ac1d82018-06-12 13:32:47 +00001044 print_tclist($res, $HWDEP_CASES, @{$res->{$HWDEP_CASES}});
Christophe Lyonbff39612015-11-18 16:29:11 +01001045 }
1046 printf "$col_reset\n";
1047 }
1048
Christophe Lyonf5aeb342015-12-08 14:47:16 +01001049 $return_value = 1 if ($total_better);
Christophe Lyonbff39612015-11-18 16:29:11 +01001050
1051 $return_value = 2 if ($rtotal);
1052
Christophe Lyond618f662016-02-02 19:07:58 +01001053 # Error if there was no PASS (eg when sth went wrong and no .sum was generated)
1054 $return_value = 2 if (($res->{PASS} + $res->{XFAIL}) == 0);
1055
1056 # Error if every test passed, or the ratio was too low. This
1057 # generally means the simulator is not configured well.
1058 $return_value = 2 if (($ref_ratio == 100) || ($ref_ratio < $ratio_thresh));
1059 $return_value = 2 if (($res_ratio == 100) || ($res_ratio < $ratio_thresh));
Christophe Lyonbff39612015-11-18 16:29:11 +01001060
Christophe Lyonad8c7242016-02-03 13:04:28 +01001061 # Error if no execution test passed.
1062 # It is possible that no execution test fails, though.
1063 $return_value = 2 if (($ignore_exec == 0)
1064 && (($ref->{EXEC}->{PASS} == 0)
1065 || ($res->{EXEC}->{PASS} == 0)));
1066
Christophe Lyonbff39612015-11-18 16:29:11 +01001067 return $return_value;
1068}
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +00001069
1070######################################################
1071# MERGING
1072sub merge($$@)
1073{
1074 my ($output_file, $ref_file, @results) = @_;
1075 my $res = empty_result();
1076 my $current_tool="";
1077 my $current_exp="";
1078
1079 open(REF, '<', $ref_file) or die $!;
1080 open(OUTPUT, '>', $output_file) or die $!;
1081
1082 print OUTPUT "Note: This is a synthetic sum file generated by merging the sum files of\n";
1083 print OUTPUT " several testsuite runs. To investigate test results, refer to the\n";
1084 print OUTPUT " original sum and log files.\n\n";
1085
1086 while (<REF>) {
1087 my $printed = 0;
1088 if (m/^(PASS|XPASS|FAIL|XFAIL|KFAIL|UNSUPPORTED|UNTESTED|UNRESOLVED): *(.*)/) {
1089 my ($diag,$tc) = ($1,$2);
1090 # Prefix test name wih .exp filename to help report
1091 # regressions/run bisect.
1092 $tc = "$current_tool:$current_exp=$tc";
1093
1094 if ($diag ne "PASS") {
1095 my $xfail_seen = 0;
Thiago Jung Bauermann4578bcf2023-03-22 15:44:00 +00001096 my $test_in_all_results = 1;
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +00001097
1098 # Did this test pass or xfail in any of the other results?
1099 foreach my $result (@results) {
Thiago Jung Bauermann4578bcf2023-03-22 15:44:00 +00001100 if (not exists $result->{testcases}->{$tc}) {
1101 # Check whether the exp file is present in this result.
Thiago Jung Bauermann9cbfa082024-02-24 21:31:48 -03001102 if (exists $result->{exp_files}->{"$current_tool:$current_exp"}) {
1103 # The exp file is present but this test isn't.
1104 $test_in_all_results = 0;
Thiago Jung Bauermann4578bcf2023-03-22 15:44:00 +00001105 }
1106 } elsif ($result->{testcases}->{$tc}->{PASS}) {
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +00001107 print OUTPUT "PASS: $2\n";
1108 $printed = 1;
1109
1110 # Adjust the summary statistics.
1111 $res->{$diag}--;
1112 $res->{PASS}++;
1113 last;
1114 } elsif ($result->{testcases}->{$tc}->{XFAIL}) {
1115 $xfail_seen = 1;
1116 }
1117 }
1118
1119 if (not $printed and $xfail_seen) {
1120 print OUTPUT "XFAIL: $2\n";
1121 $printed = 1;
1122
1123 # Adjust the summary statistics.
1124 $res->{$diag}--;
1125 $res->{XFAIL}++;
Thiago Jung Bauermann4578bcf2023-03-22 15:44:00 +00001126 } elsif (not $test_in_all_results) {
1127 # If this test isn't present in all the sum files then consider its
1128 # absence from at least one of them to mean that it didn't fail, and
1129 # therefore leave it out of the merged sum file. This addresses a
1130 # situation that can happen in GDB tests where if a test succeeds it
1131 # doesn't produce a PASS but if it fails it produces a FAIL.
1132 $printed = 1;
1133
1134 # Adjust the summary statistics.
1135 $res->{$diag}--;
Thiago Jung Bauermann99efda82023-02-28 23:03:05 +00001136 }
1137 }
1138 } elsif (m/^(# of expected passes|# of unexpected failures|# of expected failures|# of known failures|# of unsupported tests|# of untested testcases|# of unresolved testcases)(\s+)(\d+)$/) {
1139 my $total;
1140 my $adjustment = 0;
1141
1142 $adjustment = $res->{PASS} if ($1 eq "# of expected passes");
1143 $adjustment = $res->{FAIL} if ($1 eq "# of unexpected failures");
1144 $adjustment = $res->{XFAIL} if ($1 eq "# of expected failures");
1145 $adjustment = $res->{KFAIL} if ($1 eq "# of known failures");
1146 $adjustment = $res->{UNSUPPORTED} if ($1 eq "# of unsupported tests");
1147 $adjustment = $res->{UNTESTED} if ($1 eq "# of untested testcases");
1148 $adjustment = $res->{UNRESOLVED} if ($1 eq "# of unresolved testcases");
1149
1150 $total = $3 + $adjustment;
1151 print OUTPUT "$1$2$total\n";
1152 $printed = 1;
1153 } elsif (m/^Running (.*) \.\.\.*/) {
1154 $current_exp=$1;
1155 $current_exp =~ s|.*/testsuite/||;
1156 } elsif (m/^\t\t=== (.*) tests ===/) {
1157 $current_tool=$1;
1158 } elsif (m/^\t\t=== (.*) Summary ===/) {
1159 $current_tool="";
1160 $current_exp="";
1161 } elsif (m/^Note: This is a synthetic sum file.*/) {
1162 # If the reference file is itself a synthetic sum file, we should skip the
1163 # note at the top because we already printed it.
1164
1165 # Skip next 3 lines.
1166 foreach my $i (0..2) {
1167 my $skipped_line = <REF>;
1168 }
1169
1170 $printed = 1;
1171 }
1172
1173 # Pass-through lines that weren't modified.
1174 print OUTPUT $_ if (not $printed);
1175 }
1176 close(REF);
1177 close(OUTPUT);
1178
1179 return 0;
1180}