Skip to content

Commit e3decff

Browse files
ossy-szegedrerobika
authored andcommitted
Make run-test-suite.py handle crashes properly (#3512)
Changes: - Crashing jerry / jerry-snapshot is always "FAIL", only the 1 return code is accepted as expected fail. - "FAIL (XPASS)" string is only used if the test marked as expected fail, but the return code is 0. - Simple "FAIL" string is used if the test marked as expected fail, but the return code is not 0 or 1. (crash) JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
1 parent 210b631 commit e3decff

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tools/runners/run-test-suite.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ def run_normal_tests(args, tests):
138138
is_expected_to_fail = os.path.join(os.path.sep, 'fail', '') in test
139139
(returncode, stdout) = execute_test_command(test_cmd + [test])
140140

141-
if bool(returncode) == is_expected_to_fail:
141+
if (returncode == 0 and not is_expected_to_fail) or (returncode == 1 and is_expected_to_fail):
142142
passed += 1
143143
if not args.quiet:
144144
passed_string = 'PASS' + (' (XFAIL)' if is_expected_to_fail else '')
145145
util.print_test_result(tested, total, True, passed_string, test_path)
146146
else:
147-
passed_string = 'FAIL%s (%d)' % (' (XPASS)' if is_expected_to_fail else '', returncode)
147+
passed_string = 'FAIL%s (%d)' % (' (XPASS)' if returncode == 0 and is_expected_to_fail else '', returncode)
148148
util.print_test_result(tested, total, False, passed_string, test_path)
149149
print("================================================")
150150
print(stdout)
@@ -176,7 +176,7 @@ def run_snapshot_tests(args, tests):
176176
is_expected_to_fail = os.path.join(os.path.sep, 'fail', '') in test
177177
(returncode, stdout) = execute_test_command(generate_snapshot_cmd + [test])
178178

179-
if is_expected_to_fail or not returncode:
179+
if (returncode == 0) or (returncode == 1 and is_expected_to_fail):
180180
if not args.quiet:
181181
passed_string = 'PASS' + (' (XFAIL)' if returncode else '')
182182
util.print_test_result(tested, total, True, passed_string, test_path, True)
@@ -194,13 +194,13 @@ def run_snapshot_tests(args, tests):
194194
(returncode, stdout) = execute_test_command(execute_snapshot_cmd)
195195
os.remove('js.snapshot')
196196

197-
if bool(returncode) == is_expected_to_fail:
197+
if (returncode == 0 and not is_expected_to_fail) or (returncode == 1 and is_expected_to_fail):
198198
passed += 1
199199
if not args.quiet:
200200
passed_string = 'PASS' + (' (XFAIL)' if is_expected_to_fail else '')
201201
util.print_test_result(tested, total, True, passed_string, test_path, False)
202202
else:
203-
passed_string = 'FAIL%s (%d)' % (' (XPASS)' if is_expected_to_fail else '', returncode)
203+
passed_string = 'FAIL%s (%d)' % (' (XPASS)' if returncode == 0 and is_expected_to_fail else '', returncode)
204204
util.print_test_result(tested, total, False, passed_string, test_path, False)
205205
print("================================================")
206206
print(stdout)

0 commit comments

Comments
 (0)