gh-109276: libregrtest: fix worker working dir (#109313)

Fix Emscripten and WASI: start the test worker process in the Python
source code directory, where 'python.js' and 'python.wasm' can be
found. Then worker_process() changes to a temporary directory created
to run tests.

* create_worker_process() uses os_helper.SAVEDCWD as cwd.
* worker_process() uses get_temp_dir() as the parent directory for
  get_work_dir().
* Don't use plural but singual for "test" in "Run 1 test ..."
  message.
* Remove unused imports.
* Add WORK_DIR_PREFIX and WORKER_WORK_DIR_PREFIX constants.
This commit is contained in:
Victor Stinner 2023-09-12 15:13:29 +02:00 committed by GitHub
parent 8b55adfa8f
commit d13f782a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 16 deletions

View file

@ -297,7 +297,7 @@ class Regrtest:
jobs = runtests.get_jobs()
if jobs is not None:
tests = f'{jobs} tests'
tests = count(jobs, 'test')
else:
tests = 'tests'
msg = f"Run {tests} sequentially"
@ -458,7 +458,7 @@ class Regrtest:
def run_tests(self, selected: TestTuple, tests: TestList | None) -> int:
os.makedirs(self.tmp_dir, exist_ok=True)
work_dir = get_work_dir(parent_dir=self.tmp_dir)
work_dir = get_work_dir(self.tmp_dir)
# Put a timeout on Python exit
with exit_timeout():