Skip to content

Commit 4f7e7b9

Browse files
committed
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"). (cherry picked from commit 1170d5a)
1 parent 3f81740 commit 4f7e7b9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Lib/test/libregrtest/main.py

Lines changed: 3 additions & 2 deletions
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:
@@ -840,7 +841,7 @@ def get_exitcode(self):
840841
elif self.no_tests_run():
841842
exitcode = EXITCODE_NO_TESTS_RAN
842843
elif self.rerun and self.ns.fail_rerun:
843-
exitcode = EXITCODE_BAD_TEST
844+
exitcode = EXITCODE_RERUN_FAIL
844845
return exitcode
845846

846847
def action_run_tests(self):

Lib/test/test_regrtest.py

Lines changed: 3 additions & 2 deletions
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("""
@@ -1261,10 +1262,10 @@ def test_fail_once(self):
12611262
stats=TestStats(3, 1))
12621263
os_helper.unlink(marker_filename)
12631264

1264-
# with --fail-rerun, exit code EXITCODE_BAD_TEST
1265+
# with --fail-rerun, exit code EXITCODE_RERUN_FAIL
12651266
# on "FAILURE then SUCCESS" state.
12661267
output = self.run_tests("--rerun", "--fail-rerun", testname,
1267-
exitcode=EXITCODE_BAD_TEST)
1268+
exitcode=EXITCODE_RERUN_FAIL)
12681269
self.check_executed_tests(output, [testname],
12691270
rerun=Rerun(testname,
12701271
match="test_fail_once",

0 commit comments

Comments
 (0)