@@ -137,6 +137,7 @@ def print_evaluate(self):
137137 log .error (
138138 "Inconsistent statistics: total != successful + failed + skipped\n "
139139 )
140+ exit (- 1 )
140141
141142 if self .errors != 0 :
142143 log .error ("Failed with errors\n " )
@@ -236,28 +237,41 @@ def compare(self, actual_insns: list[CsInsn], bits: int) -> TestResult:
236237 return TestResult .FAILED
237238
238239 for a_insn , e_insn in zip (actual_insns , self .insns ):
239- def _check (res : bool ):
240- if not res :
241- log .error (f"Failed instruction: { a_insn } " )
242- return TestResult .FAILED
243-
244- _check (compare_asm_text (a_insn , e_insn .get ("asm_text" ), bits ))
240+ if not compare_asm_text (a_insn , e_insn .get ("asm_text" ), bits ):
241+ log .error (f"Failed instruction: { a_insn } " )
242+ return TestResult .FAILED
245243
246- _check (compare_str (a_insn .mnemonic , e_insn .get ("mnemonic" ), "mnemonic" ))
244+ if not compare_str (a_insn .mnemonic , e_insn .get ("mnemonic" ), "mnemonic" ):
245+ log .error (f"Failed instruction: { a_insn } " )
246+ return TestResult .FAILED
247247
248- _check (compare_str (a_insn .op_str , e_insn .get ("op_str" ), "op_str" ))
248+ if not compare_str (a_insn .op_str , e_insn .get ("op_str" ), "op_str" ):
249+ log .error (f"Failed instruction: { a_insn } " )
250+ return TestResult .FAILED
249251
250- _check (compare_enum (a_insn .id , e_insn .get ("id" ), "id" ))
252+ if not compare_enum (a_insn .id , e_insn .get ("id" ), "id" ):
253+ log .error (f"Failed instruction: { a_insn } " )
254+ return TestResult .FAILED
251255
252- _check (compare_tbool (a_insn .is_alias , e_insn .get ("is_alias" ), "is_alias" ))
256+ if not compare_tbool (a_insn .is_alias , e_insn .get ("is_alias" ), "is_alias" ):
257+ log .error (f"Failed instruction: { a_insn } " )
258+ return TestResult .FAILED
253259
254- _check (compare_tbool (a_insn .illegal , e_insn .get ("illegal" ), "illegal" ))
260+ if not compare_tbool (a_insn .illegal , e_insn .get ("illegal" ), "illegal" ):
261+ log .error (f"Failed instruction: { a_insn } " )
262+ return TestResult .FAILED
255263
256- _check (compare_uint32 (a_insn .size , e_insn .get ("size" ), "size" ))
264+ if not compare_uint32 (a_insn .size , e_insn .get ("size" ), "size" ):
265+ log .error (f"Failed instruction: { a_insn } " )
266+ return TestResult .FAILED
257267
258- _check (compare_enum (a_insn .alias_id , e_insn .get ("alias_id" ), "alias_id" ))
268+ if not compare_enum (a_insn .alias_id , e_insn .get ("alias_id" ), "alias_id" ):
269+ log .error (f"Failed instruction: { a_insn } " )
270+ return TestResult .FAILED
259271
260- _check (compare_details (a_insn , e_insn .get ("details" )))
272+ if not compare_details (a_insn , e_insn .get ("details" )):
273+ log .error (f"Failed instruction: { a_insn } " )
274+ return TestResult .FAILED
261275
262276 return TestResult .SUCCESS
263277
@@ -401,7 +415,6 @@ def run_tests(self):
401415 self .stats .add_failing_file (tf .path )
402416 self .stats .add_test_case_data_point (result )
403417 log .info (result )
404- print ()
405418 self .stats .print_evaluate ()
406419
407420
0 commit comments