Skip to content

gh-109276: libregrtest: WASM use filename for JSON #109340

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

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 12, 2023

On Emscripten and WASI platforms, or if --python command line option is used, libregrtest now uses a filename for the JSON file.

Emscripten and WASI buildbot workers run the main test process with a different Python (Linux) which spawns Emscripten/WASI processes using the command specified in --python command line option. Passing a file descriptor from the parent process to the child process doesn't work in this case.

  • Add RunTests.json_file_use_filename() method.
  • Add a test in test_regrtest on the --python command line option.
  • test_regrtest: add parallel=False parameter.

On Emscripten and WASI platforms, or if --python command line option
is used, libregrtest now uses a filename for the JSON file.

Emscripten and WASI buildbot workers run the main test process with a
different Python (Linux) which spawns Emscripten/WASI processes using
the command specified in --python command line option. Passing a file
descriptor from the parent process to the child process doesn't work
in this case.

* Add JsonFile and JsonFileType classes
* Add RunTests.json_file_use_filename() method.
* Add a test in test_regrtest on the --python command line option.
* test_regrtest: add parallel=False parameter.
* Split long RunWorkers._runtest() function into sub-functions.
@vstinner vstinner merged commit 75cdd9a into python:main Sep 12, 2023
@vstinner vstinner deleted the regrtest_json_file3 branch September 12, 2023 22:41
@vstinner
Copy link
Member Author

First, I wrote PR #109326 to debug the issue and understand what's going on. Then I wrote this clean PR.

Well. Sadly, this PR doesn't work as expected because I misunderstood how Emscripten/WASI buildbot workers run tests.

On these buildbots, a first Linux x86-64 Python binary is used to run python -m test. This one lists tests and then spawns test worker processes.

These test worker processes use the Emscripten/WASI runtime! So the parent and child processes don't run the same "platform"!

Before, the result was serialized as JSON at the end of stdout. But it causes issues, so I enhanced libregrtest to write the JSON into a separated file descriptor (change made 2 days ago).

First probem: apparently, currently, it's not possible to pass a file descriptor from the Linux x86-64 Python to the Emscripten/WASI Python: it fails with OSError: [Errno 8] Bad file descriptor.

So I wrote this PR to use a named filename for the JSON file. Second problem: the Emscripten/WASI Python runtime doesn't have a full access to the filesystem, and paths are mapped differently.

vstinner added a commit to vstinner/cpython that referenced this pull request Sep 13, 2023
On Emscripten and WASI platforms, or if --python command line option
is used, libregrtest now uses a filename for the JSON file.

Emscripten and WASI buildbot workers run the main test process with a
different Python (Linux) which spawns Emscripten/WASI processes using
the command specified in --python command line option. Passing a file
descriptor from the parent process to the child process doesn't work
in this case.

* Add JsonFile and JsonFileType classes
* Add RunTests.json_file_use_filename() method.
* Add a test in test_regrtest on the --python command line option.
* test_regrtest: add parallel=False parameter.
* Split long RunWorkers._runtest() function into sub-functions.
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.

1 participant