Skip to content

Commit

Permalink
gh-108834: regrtest --fail-rerun exits with code 5 (#108896)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
vstinner committed Sep 5, 2023
1 parent 3f81740 commit 4f7e7b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
EXIT_TIMEOUT = 120.0

EXITCODE_BAD_TEST = 2
EXITCODE_INTERRUPTED = 130
EXITCODE_ENV_CHANGED = 3
EXITCODE_NO_TESTS_RAN = 4
EXITCODE_RERUN_FAIL = 5
EXITCODE_INTERRUPTED = 130


class Regrtest:
Expand Down Expand Up @@ -840,7 +841,7 @@ def get_exitcode(self):
elif self.no_tests_run():
exitcode = EXITCODE_NO_TESTS_RAN
elif self.rerun and self.ns.fail_rerun:
exitcode = EXITCODE_BAD_TEST
exitcode = EXITCODE_RERUN_FAIL
return exitcode

def action_run_tests(self):
Expand Down
5 changes: 3 additions & 2 deletions Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
EXITCODE_BAD_TEST = 2
EXITCODE_ENV_CHANGED = 3
EXITCODE_NO_TESTS_RAN = 4
EXITCODE_RERUN_FAIL = 5
EXITCODE_INTERRUPTED = 130

TEST_INTERRUPTED = textwrap.dedent("""
Expand Down Expand Up @@ -1261,10 +1262,10 @@ def test_fail_once(self):
stats=TestStats(3, 1))
os_helper.unlink(marker_filename)

# with --fail-rerun, exit code EXITCODE_BAD_TEST
# with --fail-rerun, exit code EXITCODE_RERUN_FAIL
# on "FAILURE then SUCCESS" state.
output = self.run_tests("--rerun", "--fail-rerun", testname,
exitcode=EXITCODE_BAD_TEST)
exitcode=EXITCODE_RERUN_FAIL)
self.check_executed_tests(output, [testname],
rerun=Rerun(testname,
match="test_fail_once",
Expand Down

0 comments on commit 4f7e7b9

Please sign in to comment.