Skip to content

Commit 1170d5a

Browse files
authored
gh-108834: regrtest --fail-rerun exits with code 5 (#108896)
When the --fail-rerun option is used and a test fails and then pass, regrtest now uses exit code 5 ("rerun) instead of 2 ("bad test").
1 parent 6765938 commit 1170d5a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Lib/test/libregrtest/main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
EXIT_TIMEOUT = 120.0
3030

3131
EXITCODE_BAD_TEST = 2
32-
EXITCODE_INTERRUPTED = 130
3332
EXITCODE_ENV_CHANGED = 3
3433
EXITCODE_NO_TESTS_RAN = 4
34+
EXITCODE_RERUN_FAIL = 5
35+
EXITCODE_INTERRUPTED = 130
3536

3637

3738
class Regrtest:
@@ -847,7 +848,7 @@ def get_exitcode(self):
847848
elif self.no_tests_run():
848849
exitcode = EXITCODE_NO_TESTS_RAN
849850
elif self.rerun and self.ns.fail_rerun:
850-
exitcode = EXITCODE_BAD_TEST
851+
exitcode = EXITCODE_RERUN_FAIL
851852
return exitcode
852853

853854
def action_run_tests(self):

Lib/test/test_regrtest.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
EXITCODE_BAD_TEST = 2
3535
EXITCODE_ENV_CHANGED = 3
3636
EXITCODE_NO_TESTS_RAN = 4
37+
EXITCODE_RERUN_FAIL = 5
3738
EXITCODE_INTERRUPTED = 130
3839

3940
TEST_INTERRUPTED = textwrap.dedent("""
@@ -1265,10 +1266,10 @@ def test_fail_once(self):
12651266
stats=TestStats(3, 1))
12661267
os_helper.unlink(marker_filename)
12671268

1268-
# with --fail-rerun, exit code EXITCODE_BAD_TEST
1269+
# with --fail-rerun, exit code EXITCODE_RERUN_FAIL
12691270
# on "FAILURE then SUCCESS" state.
12701271
output = self.run_tests("--rerun", "--fail-rerun", testname,
1271-
exitcode=EXITCODE_BAD_TEST)
1272+
exitcode=EXITCODE_RERUN_FAIL)
12721273
self.check_executed_tests(output, [testname],
12731274
rerun=Rerun(testname,
12741275
match="test_fail_once",

0 commit comments

Comments
 (0)