Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-108834: Sync libregrtest with the main branch #108966

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

vstinner and others added 3 commits September 6, 2023 00:34
…#108839)

When using --rerun option, regrtest now re-runs failed tests
in verbose mode in fresh worker processes to have more
deterministic behavior. So it can write its final report even
if a test killed a worker progress.

Add --fail-rerun option to regrtest: exit with non-zero exit code
if a test failed pass passed when re-run in verbose mode (in a
fresh process). That's now more useful since tests can pass
when re-run in a fresh worker progress, whereas they failed
when run after other tests when tests are run sequentially.

Rename --verbose2 option (-w) to --rerun. Keep --verbose2 as a
deprecated alias.

Changes:

* Fix and enhance statistics in regrtest summary. Add "(filtered)"
  when --match and/or --ignore options are used.
* Add RunTests class.
* Add TestResult.get_rerun_match_tests() method
* Rewrite code to serialize/deserialize worker arguments as JSON
  using a new WorkerJob class.
* Fix stats when a test is run with --forever --rerun.
* If failed test names cannot be parsed, log a warning and don't
  filter tests.
* test_regrtest.test_rerun_success() now uses a marker file, since
  the test is re-run in a separated process.
* Add tests on normalize_test_name() function.
* Add test_success() and test_skip() tests to test_regrtest.

(cherry picked from commit 31c2945)
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)
@vstinner vstinner changed the title [3.12] Sync libregrtest with the main branch [3.12] gh-108834: Sync libregrtest with the main branch Sep 5, 2023
@vstinner
Copy link
Member Author

vstinner commented Sep 5, 2023

This PR is a backport of PR #108839: gh-108834: regrtest reruns failed tests in subprocesses.

I had to include some others changes to keep libregrest in sync with main, and avoid futur merge conflicts.

@gpshead
Copy link
Member

gpshead commented Sep 5, 2023

#108923 includes part of this already.

@vstinner
Copy link
Member Author

vstinner commented Sep 6, 2023

@gpshead:

#108923 includes part of this already.

The problem is that regrtest changes were not backported in the same order than main changes :-( And so git cherry-pick is unhappy and creates conflicts. I almost lost @serhiy-storchaka's change about test_main(), but I catched it and fixed it.

I checked manually that at the end, files are the same in the two branches. Now, the remaining change is:

diff -u Lib/test/libregrtest/utils.py ../main/Lib/test/libregrtest/utils.py
--- Lib/test/libregrtest/utils.py	2023-09-06 00:39:26.893256876 +0200
+++ ../main/Lib/test/libregrtest/utils.py	2023-09-06 00:27:30.431075564 +0200
@@ -228,6 +228,11 @@
     ldflags_nodist = sysconfig.get_config_var('PY_LDFLAGS_NODIST') or ''
 
     build = []
+
+    # --disable-gil
+    if sysconfig.get_config_var('Py_NOGIL'):
+        build.append("nogil")
+
     if hasattr(sys, 'gettotalrefcount'):
         # --with-pydebug
         build.append('debug')

I could backport it as well (it does nothing in 3.12), but I chose to skip it for now :-)

@rhettinger rhettinger removed their request for review September 7, 2023 14:25
@Yhg1s Yhg1s merged commit 0855b2c into python:3.12 Sep 8, 2023
18 checks passed
@vstinner vstinner deleted the regrtest312 branch September 8, 2023 13:36
@vstinner vstinner added the needs backport to 3.11 only security fixes label Sep 11, 2023
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @vstinner and @Yhg1s, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 0855b2c8b69f02f86f837875acda148479e6a061 3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.11 only security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants