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
gh-84461: Fix parallel testing on WebAssembly (GH-93768) #93768
Conversation
Emscripten and WASI have stubbed getpid() syscall that always returns the same value. Use time and random value instead of pid to create a unique working directory.
LGTM. It's better if test_cwd is unique system-wide, but it's not a strict requirement. Chosen nonce is good for uniqueness ;-)
Lib/test/libregrtest/main.py
Outdated
@@ -628,7 +628,12 @@ def create_temp_dir(self): | |||
# Define a writable temp dir that will be used as cwd while running | |||
# the tests. The name of the dir includes the pid to allow parallel | |||
# testing (see the -j option). | |||
pid = os.getpid() | |||
# Emscripten and WASI have stubbed getpid(), Emscripten has only | |||
# milisecond clock resolution. Use time_ns() + randint() instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use time.time_ns
if it has only "milisecond clock resolution"?
Thanks @tiran for the PR |
(cherry picked from commit c200757) Co-authored-by: Christian Heimes <christian@python.org>
GH-93782 is a backport of this pull request to the 3.11 branch. |
Emscripten and WASI have stubbed getpid() syscall that always returns
the same value. Use time and random value instead of pid to create a
unique working directory.