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

Enhance Python regrtest test runner (test.libregrtest) #109276

Closed
vstinner opened this issue Sep 11, 2023 · 2 comments
Closed

Enhance Python regrtest test runner (test.libregrtest) #109276

vstinner opened this issue Sep 11, 2023 · 2 comments

Comments

vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was signed with the committer’s verified signature.
kornelski Kornel
libregrtest now uses a separated file descriptor to write test result
into JSON. Previously, if a test wrote debug messages around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
libregrtest now uses a separated file descriptor to write test result
into JSON. Previously, if a test wrote debug messages around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
libregrtest now uses a separated file descriptor to write test result
as JSON.  Previously, if a test wrote debug messages late around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.
@vstinner
Copy link
Member Author

Recent libregrtest enhancements:

  • Worker processes no longer import test.libregrtest.main: the python -m test.libregrtest.worker command is used instead. Change: commit a939b65.
  • Worker processes are now run in a different working directory: in the temporary directory created by the main test process. Change: commit a939b65.
  • --failfast now fails faster (!): RegressionTestResult.addFailure() now calls self.stop is support.failfast is true. Change: commit 31c2945.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
There is no need to check for environment changes twice.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
There is no need to check for environment changes twice.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
There is no need to check for environment changes twice.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
libregrtest now uses a separated file descriptor to write test result
as JSON.  Previously, if a test wrote debug messages late around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.

create_worker_process() now always spawn the process with
close_fds=True.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once before running all
test files and it was not called in worker processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variables from test_regrtest.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variables from test_regrtest.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was signed with the committer’s verified signature.
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variable from test_regrtest.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variable from test_regrtest.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variable from test_regrtest.
* Add RunTests members are now mandatory.
vstinner added a commit that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
libregrtest now uses a separated file descriptor to write test result
as JSON.  Previously, if a test wrote debug messages late around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.

create_worker_process() now always spawn the process with
close_fds=True.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variable from test_regrtest.
* Add RunTests members are now mandatory.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Don't spawn more threads than the maximum number of jobs: these
worker threads will not get anything to do.

Add RunTests.get_jobs() method.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Don't spawn more threads than the number of jobs: these worker
threads would never get anything to do.

Add RunTests.get_jobs() method.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* Fix 'wasm32-emscripten node' and 'wasm32-wasi' buildbot workers:
  start the test worker process in the Python source code directory,
  since these buildbot workers need to get their 'python.js' and
  'python.wasm' file. Then worker_process() goes to the temporary
  directory created to run tests.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* 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() goes to the temporary directory
  created to run tests.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* 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() goes to the temporary directory
  created to run tests.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* 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() goes to the temporary directory
  created to run tests.
* --cleanup now also removes "temporary" directories of test worker
  processes (in /tmp).
vstinner added a commit to vstinner/cpython that referenced this issue Sep 12, 2023
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* 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() goes to the temporary directory
  created to run tests.
* --cleanup now also removes "temporary" directories of test worker
  processes (in /tmp).
* test.pythoninfo now also logs sysconfig 'abs_builddir' and
  'srcdir', and sysconfig.is_python_build().
vstinner added a commit to vstinner/cpython that referenced this issue Sep 12, 2023
* WorkerThread now always creates a temporary directory, even on
  Emscripten and WASI: it's used as the working directory of the test
  worker process.
* 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() goes to the temporary directory
  created to run tests.
* --cleanup now also removes "temporary" directories of test worker
  processes (in /tmp).
* test.pythoninfo now also logs:

  * sysconfig 'abs_builddir' and 'srcdir'
  * sysconfig.is_python_build()
  * tempfile.gettempdir()
vstinner added a commit to vstinner/cpython that referenced this issue Sep 12, 2023
* Enable collect_sysconfig() on Windows.
* Add sysconfig 'abs_builddir' and 'srcdir'
* Add sysconfig.is_python_build()
* Add tempfile.gettempdir()
* Remove compatiblity with Python 2.7 (print_function).
vstinner added a commit that referenced this issue Sep 25, 2023
* Factorize code listing "bad / env changed / ..." tests.
* Add TestResults.is_all_good() method.
* Move "All 400 tests OK." to the end
* Move "Test suite interrupted by signal SIGINT." to the end.
vstinner added a commit that referenced this issue Sep 25, 2023
When a test fails with "env changed" and --rerun option is used, the
test is now re-run in verbose mode in a fresh process.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit that referenced this issue Sep 26, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
* Factorize code listing "bad / env changed / ..." tests.
* Add TestResults.is_all_good() method.
* Move "All 400 tests OK." to the end
* Move "Test suite interrupted by signal SIGINT." to the end.
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
When a test fails with "env changed" and --rerun option is used, the
test is now re-run in verbose mode in a fresh process.
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 30, 2023
WORKER_FAILED does not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 30, 2023
WORKER_FAILED does not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 30, 2023
Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 30, 2023
Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.

WorkerThread now tries to get the signal name for negative exit code.
vstinner added a commit that referenced this issue Sep 30, 2023
Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.

WorkerThread now tries to get the signal name for negative exit code.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
* Factorize code listing "bad / env changed / ..." tests.
* Add TestResults.is_all_good() method.
* Move "All 400 tests OK." to the end
* Move "Test suite interrupted by signal SIGINT." to the end.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
When a test fails with "env changed" and --rerun option is used, the
test is now re-run in verbose mode in a fresh process.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.

WorkerThread now tries to get the signal name for negative exit code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant