Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-127933: Add option to run regression tests in parallel#128003

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
colesbury merged 11 commits intopython:mainfromcolesbury:gh-127933-parallel-tests
Feb 4, 2025

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commentedDec 16, 2024
edited by bedevere-appbot
Loading

This adds a new command line argument,--parallel-threads to the regression test runner to allow it to run individual tests in multiple threads in parallel in order to find multithreading bugs.

Some tests pass when run with--parallel-threads, but there's still a bunch more work before the entire suite passes:

  • Mark non-thread safe tests with@thread_unsafe
  • Tests that rely onsupport.gc_collect() are sensitive to threads becausegc.collect() returns immediately without running the GC if it's already running in a different thread

This adds a new command line argument, `--parallel-threads` to theregression test runner to allow it to run individual tests in multiplethreads in parallel in order to find multithreading bugs.
colesburyand others added2 commitsDecember 16, 2024 18:22
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Copy link
Contributor

@mpagempage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This looks good to me. I'm a little unsure about marking tests as thread-unsafe at the source level. I worry a bit that the use ofthread_unsafe /__unittest_thread_unsafe__ will create too much noise, but I think we can see how it goes.

barrier=threading.Barrier(self.num_threads)
threads= []
forcase,rinzip(cases,results):
thread=threading.Thread(target=self.run_worker,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It might be nice to give these threads an informative name, something containing the testcase and the Nth thread it is.

colesbury reacted with thumbs up emoji

# Note: We can't call result.addError, result.addFailure, etc. because
# we no longer have the original exception, just the string format.
forrinresults:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This looks like something that might be worth adding tounittest.result.TestResult, something to aggregate multiple results. (Not for this PR, but it might be a nice small feature for someone to work on.)

result.addSuccess(self)

# Note: We can't call result.addError, result.addFailure, etc. because
# we no longer have the original exception, just the string format.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

FWIW, another reason not to call those is that they raise right away if failfast is set.

colesbury reacted with thumbs up emoji
@@ -0,0 +1,3 @@
Add an option ``--parallel-threads=N`` to the regression test runner that
runs individual tests in multiple threads in parallel in order to find
concurrency bugs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should this (or other documentation) mention that most of the testsuite isn't appropriately reviewed/marked yet?

colesbury reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've updated the blurb. It might be worth adding something to the devguide when this gets further along.

@colesburycolesbury merged commite5f10a7 intopython:mainFeb 4, 2025
47 checks passed
@colesburycolesbury deleted the gh-127933-parallel-tests branchFebruary 4, 2025 22:45
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull requestFeb 7, 2025
…ongh-128003)This adds a new command line argument, `--parallel-threads` to theregression test runner to allow it to run individual tests in multiplethreads in parallel in order to find multithreading bugs.Some tests pass when run with `--parallel-threads`, but there's stillmore work before the entire suite passes.
cmaloney pushed a commit to cmaloney/cpython that referenced this pull requestFeb 8, 2025
…ongh-128003)This adds a new command line argument, `--parallel-threads` to theregression test runner to allow it to run individual tests in multiplethreads in parallel in order to find multithreading bugs.Some tests pass when run with `--parallel-threads`, but there's stillmore work before the entire suite passes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tomasr8tomasr8tomasr8 left review comments

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@Eclips4Eclips4Eclips4 left review comments

@mpagempagempage approved these changes

@Yhg1sYhg1sYhg1s approved these changes

@pablogsalpablogsalAwaiting requested review from pablogsalpablogsal is a code owner

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

Assignees

No one assigned

Labels

testsTests in the Lib/test dirtopic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@colesbury@mpage@Yhg1s@tomasr8@ZeroIntensity@Eclips4

[8]ページ先頭

©2009-2025 Movatter.jp