19
19
nFAIL = 0
20
20
nPASS = 0
21
21
nSKIP = 0
22
+ errors = []
22
23
23
24
def __filter (cases_ ) -> typing .List [TestCase ]:
24
25
cases = cases_ [:]
26
+ selected_cases = []
27
+ skipped_cases = []
25
28
26
29
# Check "--from" and "--to" exist and are in the right order
27
30
bFoundFrom , bFoundTo = (False , False )
@@ -51,16 +54,20 @@ def __filter(cases_) -> typing.List[TestCase]:
51
54
for case in cases [:]:
52
55
if case .ppn > 1 and not ARG ("mpi" ):
53
56
cases .remove (case )
57
+ skipped_cases .append (case )
54
58
55
59
if ARG ("percent" ) == 100 :
56
- return cases
60
+ return cases , skipped_cases
57
61
58
- return sample (cases , k = int (len (cases )* ARG ("percent" )/ 100.0 ))
62
+ selected_cases = sample (cases , k = int (len (cases )* ARG ("percent" )/ 100.0 ))
63
+ skipped_cases = [item for item in cases if item not in selected_cases ]
59
64
65
+ return selected_cases , skipped_cases
60
66
61
67
def test ():
62
68
# pylint: disable=global-statement, global-variable-not-assigned
63
69
global nFAIL , nPASS , nSKIP
70
+ global errors
64
71
65
72
cases = list_cases ()
66
73
@@ -75,7 +82,8 @@ def test():
75
82
76
83
return
77
84
78
- cases = [ _ .to_case () for _ in __filter (cases ) ]
85
+ cases , skipped_cases = __filter (cases )
86
+ cases = [ _ .to_case () for _ in cases ]
79
87
80
88
if ARG ("list" ):
81
89
table = rich .table .Table (title = "MFC Test Cases" , box = rich .table .box .SIMPLE )
@@ -125,9 +133,23 @@ def test():
125
133
[ sched .Task (ppn = case .ppn , func = handle_case , args = [case ], load = case .get_cell_count ()) for case in cases ],
126
134
ARG ("jobs" ), ARG ("gpus" ))
127
135
136
+ nSKIP = len (skipped_cases )
128
137
cons .print ()
129
138
cons .unindent ()
130
- cons .print (f"\n Test Summary: [bold green]{ nPASS } [/bold green] passed, [bold red]{ nFAIL } [/bold red] failed, [bold yellow]{ nSKIP } [/bold yellow] skipped." )
139
+ cons .print (f"\n Test Summary: [bold green]{ nPASS } [/bold green] passed, [bold red]{ nFAIL } [/bold red] failed, [bold yellow]{ nSKIP } [/bold yellow] skipped.\n " )
140
+
141
+ # Print a summary of all errors at the end if errors exist
142
+ if len (errors ) != 0 :
143
+ cons .print (f"[bold red]Failed Cases[/bold red]\n " )
144
+ for e in errors :
145
+ cons .print (e )
146
+
147
+ # Print the list of skipped cases
148
+ if len (skipped_cases ) != 0 :
149
+ cons .print ("[bold yellow]Skipped Cases[/bold yellow]\n " )
150
+ for c in skipped_cases :
151
+ cons .print (f"[bold yellow]{ c .trace } [/bold yellow]" )
152
+
131
153
exit (nFAIL )
132
154
133
155
@@ -216,6 +238,7 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
216
238
def handle_case (case : TestCase , devices : typing .Set [int ]):
217
239
# pylint: disable=global-statement, global-variable-not-assigned
218
240
global nFAIL , nPASS , nSKIP
241
+ global errors
219
242
220
243
nAttempts = 0
221
244
@@ -228,9 +251,11 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
228
251
except Exception as exc :
229
252
if nAttempts < ARG ("max_attempts" ):
230
253
cons .print (f"[bold yellow] Attempt { nAttempts } : Failed test { case .get_uuid ()} . Retrying...[/bold yellow]" )
254
+ errors .append (f"[bold yellow] Attempt { nAttempts } : Failed test { case .get_uuid ()} . Retrying...[/bold yellow]" )
231
255
continue
232
256
nFAIL += 1
233
257
cons .print (f"[bold red]Failed test { case } after { nAttempts } attempt(s).[/bold red]" )
234
- cons .print (f"{ exc } " )
258
+ errors .append (f"[bold red]Failed test { case } after { nAttempts } attempt(s).[/bold red]" )
259
+ errors .append (f"{ exc } " )
235
260
236
261
return
0 commit comments