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

gh-84461: Fix parallel testing on WebAssembly (GH-93768) #93768

Merged
merged 2 commits into from Jun 13, 2022

Conversation

tiran
Copy link
Member

@tiran tiran commented Jun 13, 2022

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.

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.
@tiran tiran force-pushed the gh-84461-parallel-test branch from 18705c8 to d8eaff4 Compare Jun 13, 2022
@tiran tiran requested review from brettcannon and vstinner Jun 13, 2022
Lib/test/libregrtest/main.py Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

LGTM. It's better if test_cwd is unique system-wide, but it's not a strict requirement. Chosen nonce is good for uniqueness ;-)

@@ -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.
Copy link
Contributor

@carlbordum carlbordum Jun 13, 2022

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"?

@tiran tiran changed the title gh-84461: Fix parallel testing on WebAssembly gh-84461: Fix parallel testing on WebAssembly (GH-93768) Jun 13, 2022
@tiran tiran merged commit c200757 into python:main Jun 13, 2022
12 checks passed
@tiran tiran deleted the gh-84461-parallel-test branch Jun 13, 2022
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 13, 2022

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 13, 2022
(cherry picked from commit c200757)

Co-authored-by: Christian Heimes <christian@python.org>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jun 13, 2022

GH-93782 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this issue Jun 13, 2022
(cherry picked from commit c200757)

Co-authored-by: Christian Heimes <christian@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants