summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
Commit message (Collapse)AuthorAgeFilesLines
* bpo-37957: Allow regrtest to receive a file with test (and subtests) to ↵Pablo Galindo2019-11-193-3/+17
| | | | | | | ignore (GH-16989) When building Python in some uncommon platforms there are some known tests that will fail. Right now, the test suite has the ability to ignore entire tests using the -x option and to receive a filter file using the --matchfile filter. The problem with the --matchfile option is that it receives a file with patterns to accept and when you want to ignore a couple of tests and subtests, is too cumbersome to lists ALL tests that are not the ones that you want to accept and he problem with -x is that is not easy to ignore just a subtests that fail and the whole test needs to be ignored. For these reasons, add a new option to allow to ignore a list of test and subtests for these situations.
* bpo-38614: Add timeout constants to test.support (GH-16964)Victor Stinner2019-10-301-0/+11
| | | | | | | | Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
* bpo-38502: regrtest uses process groups if available (GH-16829)Victor Stinner2019-10-181-7/+22
| | | | | test.regrtest now uses process groups in the multiprocessing mode (-jN command line option) if process groups are available: if os.setsid() and os.killpg() functions are available.
* bpo-37531: regrtest now catchs ProcessLookupError (GH-16827)Victor Stinner2019-10-161-0/+5
| | | | Fix a warning on a race condition on TestWorkerProcess.kill(): ignore silently ProcessLookupError rather than logging an useless warning.
* bpo-37531: regrtest ignores output on timeout (GH-16659)Victor Stinner2019-10-081-27/+37
| | | | | | | | | | | bpo-37531, bpo-38207: On timeout, regrtest no longer attempts to call `popen.communicate() again: it can hang until all child processes using stdout and stderr pipes completes. Kill the worker process and ignores its output. Reenable test_regrtest.test_multiprocessing_timeout(). bpo-37531: Change also the faulthandler timeout of the main process from 1 minute to 5 minutes, for Python slowest buildbots.
* bpo-36670: Enhance regrtest (GH-16556)Victor Stinner2019-10-034-50/+89
| | | | | | | | | | | | | | * Add log() method: add timestamp and load average prefixes to main messages. * WindowsLoadTracker: * LOAD_FACTOR_1 is now computed using SAMPLING_INTERVAL * Initialize the load to the arithmetic mean of the first 5 values of the Processor Queue Length value (so over 5 seconds), rather than 0.0. * Handle BrokenPipeError and when typeperf exit. * format_duration(1.5) now returns '1.5 sec', rather than '1 sec 500 ms'
* bpo-36670: Enhance regrtest WindowsLoadTracker (GH-16553)Victor Stinner2019-10-031-26/+42
| | | | The last line is now passed to the parser even if it does not end with a newline, but only if it's a valid value.
* bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)Victor Stinner2019-10-021-1/+4
| | | | WindowsLoadTracker.read_output() now uses a short buffer for incomplete line.
* bpo-36670: regrtest bug fixes (GH-16537)Victor Stinner2019-10-021-10/+12
| | | | | | | | * Fix TestWorkerProcess.__repr__(): start_time is only valid if _popen is not None. * Fix _kill(): don't set _killed to True if _popen is None. * _run_process(): only set _killed to False after calling run_test_in_subprocess().
* bpo-36670: Multiple regrtest bugfixes (GH-16511)Victor Stinner2019-10-013-133/+175
| | | | | | | | | | | | | | | | * Windows: Fix counter name in WindowsLoadTracker. Counter names are localized: use the registry to get the counter name. Original change written by Lorenz Mende. * Regrtest.main() now ensures that the Windows load tracker is also killed if an exception is raised * TestWorkerProcess now ensures that worker processes are no longer running before exiting: kill also worker processes when an exception is raised. * Enhance regrtest messages and warnings: include test name, duration, add a worker identifier, etc. * Rename MultiprocessRunner to TestWorkerProcess * Use print_warning() to display warnings. Co-Authored-By: Lorenz Mende <Lorenz.mende@gmail.com>
* bpo-38203: faulthandler.dump_traceback_later() is always available (GH-16249)Victor Stinner2019-09-181-5/+0
| | | | dump_traceback_later() and cancel_dump_traceback_later() functions of the faulthandler module are always available since Python 3.7.
* bpo-38203: regrtest: put a 2 min timeout on Python exit (GH-16250)Victor Stinner2019-09-181-10/+24
|
* bpo-37531: regrtest main process uses shorter timeout (GH-16220)Victor Stinner2019-09-171-6/+6
| | | | | | When using multiprocesss (-jN), the main process now uses a timeout of 60 seconds instead of the double of the --timeout value. The buildbot server stops a job which does not produce any output in 1200 seconds.
* bpo-37936: Systematically distinguish rooted vs. unrooted in .gitignore ↵Greg Price2019-09-111-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-15823) A root cause of bpo-37936 is that it's easy to write a .gitignore rule that's intended to apply to a specific file (e.g., the `pyconfig.h` generated by `./configure`) but actually applies to all similarly-named files in the tree (e.g., `PC/pyconfig.h`.) Specifically, any rule with no non-trailing slashes is applied in an "unrooted" way, to files anywhere in the tree. This means that if we write the rules in the most obvious-looking way, then * for specific files we want to ignore that happen to be in subdirectories (like `Modules/config.c`), the rule will work as intended, staying "rooted" to the top of the tree; but * when a specific file we want to ignore happens to be at the root of the repo (like `platform`), then the obvious rule (`platform`) will apply much more broadly than intended: if someone tries to add a file or directory named `platform` somewhere else in the tree, it will unexpectedly get ignored. That's surprising behavior that can make the .gitignore file's behavior feel finicky and unpredictable. To avoid it, we can simply always give a rule "rooted" behavior when that's what's intended, by systematically using leading slashes. Further, to help make the pattern obvious when looking at the file and minimize any need for thinking about the syntax when adding new rules: separate the rules into one group for each type, with brief comments identifying them. For most of these rules it's clear whether they're meant to be rooted or unrooted, but in a handful of cases I've only guessed. In that case the safer default (the choice that won't hide information) is the narrower, rooted meaning, with a leading slash. If for some of these the unrooted meaning is desired after all, it'll be easy to move them to the unrooted section at the top.
* bpo-37531: Fix regrtest _timedout() function on timeout (GH-15419)Victor Stinner2019-08-231-2/+2
| | | Fix code handling TimeoutExpired exception in _timedout().
* bpo-37531: Enhance regrtest multiprocess timeout (GH-15345)Victor Stinner2019-08-211-18/+63
| | | | | | | * Write a message when killing a worker process * Put a timeout on the second popen.communicate() call (after killing the process) * Put a timeout on popen.wait() call * Catch popen.kill() and popen.wait() exceptions
* bpo-37531: Fix regrtest timeout for subprocesses (GH-15072)Victor Stinner2019-08-143-14/+49
| | | Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com>
* bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181)Paul Monson2019-08-081-0/+1
|
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-37707: Exclude expensive unit tests from PGO task (GH-15009)Neil Schemenauer2019-07-301-0/+1
| | | | | Mark some individual tests to skip when --pgo is used. The tests marked increase the PGO task time significantly and likely don't help improve optimization of the final executable.
* bpo-36044: Avoid warnings in Windows PGO build and add lzma, bz2 and sqlite ↵Steve Dower2019-07-291-0/+3
| | | | | | | | | coverage (GH-14985) https://bugs.python.org/issue36044 Automerge-Triggered-By: @zooba
* Only setup PGO tests when --pgo is enabled. (GH-14927)Gregory P. Smith2019-07-241-2/+3
|
* bpo-36044: Reduce number of unit tests run for PGO build (GH-14702)Neil Schemenauer2019-07-223-1/+61
| | | | | | | | | | | | Reduce the number of unit tests run for the PGO generation task. This speeds up the task by a factor of about 15x. Running the full unit test suite is slow. This change may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the much slower build, the old behavior can be restored using './configure [..] PROFILE_TASK="-m test --pgo-extended"'. We make no guarantees as to which PGO task set produces a faster build. Users who care should run their own relevant benchmarks as results can depend on the environment, workload, and compiler tool chain.
* bpo-37473: Don't import importlib ASAP in tests (GH-14661)Victor Stinner2019-07-141-3/+0
| | | | | | | | | bpo-15386, bpo-37473: test_import, regrtest and libregrtest no longer import importlib as soon as possible, as the first import, "to test bpo-15386". It is tested by test_import.test_there_can_be_only_one(). Sort test_import imports.
* bpo-37421: urllib.request tests call urlcleanup() (GH-14529)Victor Stinner2019-07-021-0/+13
| | | | | | | | urllib.request tests now call urlcleanup() to remove temporary files created by urlretrieve() tests and to clear the _opener global variable set by urlopen() and functions calling indirectly urlopen(). regrtest now checks if urllib.request._url_tempfiles and urllib.request._opener are changed by tests.
* bpo-34602: Avoid failures setting macOS stack resource limit (GH-14546)Ned Deily2019-07-021-16/+0
| | | | | | | | | | | | | | | | | Under some conditions the earlier fix for bpo-18075, "Infinite recursion tests triggering a segfault on Mac OS X", now causes failures on macOS when attempting to change stack limit with resource.setrlimit resource.RLIMIT_STACK, like regrtest does when running the test suite. The reverted change had specified a non-default stack size when linking the python executable on macOS. As of macOS 10.14.4, the previous code causes a hard failure when running tests, although similar failures had been seen under some conditions under some earlier systems. Reverting the change to the interpreter stack size at link time helped for release builds but caused some tests to fail when built --with-pydebug. Try the opposite approach: continue to build the interpreter with an increased stack size on macOS and remove the failing setrlimit call in regrtest initialization. This will definitely avoid the resource.RLIMIT_STACK error and should have no, or fewer, side effects.
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-011-1/+0
|
* bpo-37359: Fix regrtest --cleanup (GH-14336)Victor Stinner2019-06-241-1/+1
|
* bpo-37359: Add --cleanup option to python3 -m test (GH-14332)Victor Stinner2019-06-242-14/+41
| | | | | * regrtest: Add --cleanup option to remove "test_python_*" directories of previous failed test jobs. * Add "make cleantest" to run "python3 -m test --cleanup".
* bpo-37069: regrtest uses sys.unraisablehook (GH-13759)Victor Stinner2019-06-122-0/+21
| | | | | | | | regrtest now uses sys.unraisablehook() to mark a test as "environment altered" (ENV_CHANGED) if it emits an "unraisable exception". Moreover, regrtest logs a warning in this case. Use "python3 -m test --fail-env-changed" to catch unraisable exceptions in tests.
* bpo-36842: Fix reference leak in tests by running out-of-proc (GH-13556)Steve Dower2019-05-291-21/+26
|
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-0/+6
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36915: regrtest always remove tempdir of worker processes (GH-13312)Victor Stinner2019-05-142-44/+66
| | | | | | | | | When using multiprocessing (-jN option), worker processes now create their temporary directory inside the temporary directory of the main process. So the main process is able to remove temporary directories of worker processes even if they crash or when they are killed by regrtest on KeyboardInterrupt (CTRL+c). Rework also how multiprocessing arguments are parsed in main.py.
* bpo-36719: Fix regrtest MultiprocessThread (GH-13301)Victor Stinner2019-05-141-4/+55
| | | | MultiprocessThread.kill() now closes stdout and stderr to prevent popen.communicate() to hang.
* bpo-36719: regrtest -jN no longer stops on crash (GH-13231)Victor Stinner2019-05-134-18/+46
| | | | | | | "python3 -m test -jN ..." now continues the execution of next tests when a worker process crash (CHILD_ERROR state). Previously, the test suite stopped immediately. Use --failfast to stop at the first error. Moreover, --forever now also implies --failfast.
* bpo-36719: regrtest closes explicitly WindowsLoadTracker (GH-12965)Victor Stinner2019-04-262-14/+29
| | | | Regrtest.finalize() now closes explicitly the WindowsLoadTracker instance.
* bpo-36719: Fix regrtest re-run (GH-12964)Victor Stinner2019-04-262-13/+13
| | | | | Properly handle a test which fail but then pass. Add test_rerun_success() unit test.
* bpo-36719: regrtest always detect uncollectable objects (GH-12951)Victor Stinner2019-04-263-63/+27
| | | | | | | regrtest now always detects uncollectable objects. Previously, the check was only enabled by --findleaks. The check now also works with -jN/--multiprocess N. --findleaks becomes a deprecated alias to --fail-env-changed.
* bpo-36725: Refactor regrtest multiprocessing code (GH-12961)Victor Stinner2019-04-263-150/+200
| | | | | | | | | | | | | | | | Rewrite run_tests_multiprocess() function as a new MultiprocessRunner class with multiple methods to better report errors and stop immediately when needed. Changes: * Worker processes are now killed immediately if tests are interrupted or if a test does crash (CHILD_ERROR): worker processes are killed. * Rewrite how errors in a worker thread are reported to the main thread. No longer ignore BaseException or parsing errors silently. * Remove 'finished' variable: use worker.is_alive() instead * Always compute omitted tests. Add Regrtest.get_executed() method.
* bpo-36725: regrtest: add TestResult type (GH-12960)Victor Stinner2019-04-267-195/+271
| | | | | | | | | | | | | | | * Add TestResult and MultiprocessResult types to ensure that results always have the same fields. * runtest() now handles KeyboardInterrupt * accumulate_result() and format_test_result() now takes a TestResult * cleanup_test_droppings() is now called by runtest() and mark the test as ENV_CHANGED if the test leaks support.TESTFN file. * runtest() now includes code "around" the test in the test timing * Add print_warning() in test.libregrtest.utils to standardize how libregrtest logs warnings to ease parsing the test output. * support.unload() is now called with abstest rather than test_name * Rename 'test' variable/parameter to 'test_name' * dash_R(): remove unused the_module parameter * Remove unused imports
* bpo-36638: Fix WindowsLoadTracker exception on some Windows versions (GH-12849)Paul Monson2019-04-181-2/+7
|
* bpo-36560: regrtest: don't collect the GC twice (GH-12747)Victor Stinner2019-04-091-2/+4
| | | | | | dash_R() function of libregrtest doesn't call support.gc_collect() directly anymore: it's already called by dash_R_cleanup(). Call dash_R_cleanup() before starting the loop.
* bpo-36560: Fix reference leak hunting in regrtest (GH-12744)Victor Stinner2019-04-093-33/+42
| | | | | | | | | | | | | | | | | | Fix reference leak hunting in regrtest: compute also deltas (of reference count, allocated memory blocks, file descriptor count) during warmup, to ensure that everything is initialized before starting to hunt reference leaks. Other changes: * Replace gc.collect() with support.gc_collect() * Move calls to read memory statistics from dash_R_cleanup() to dash_R() * Pass regrtest 'ns' to dash_R() * dash_R() is now more quiet with --quiet option (don't display progress). * Precompute the full range for "for it in range(repcount):" to ensure that the iteration doesn't allocate anything new. * dash_R() now is responsible to call warm_caches().
* bpo-34060: Report system load when running test suite for Windows (GH-8357)Ammar Askar2019-04-092-2/+115
| | | | | | | | | | | | | | | While Windows exposes the system processor queue length, the raw value used for load calculations on Unix systems, it does not provide an API to access the averaged value. Hence to calculate the load we must track and average it ourselves. We can't use multiprocessing or a thread to read it in the background while the tests run since using those would conflict with test_multiprocessing and test_xxsubprocess. Thus, we use Window's asynchronous IO API to run the tracker in the background with it sampling at the correct rate. When we wish to access the load we check to see if there's new data on the stream, if there is, we update our load values.
* bpo-36565: Fix libregrtest for Python without builtin _abc (GH-12733)Victor Stinner2019-04-081-2/+6
| | | | Fix reference hunting (``python3 -m test -R 3:3``) when Python has no built-in abc module: fix _get_dump() reimplementation of libregrtest.
* Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)Anthony Sottile2019-02-251-4/+2
|
* bpo-35683: Improve Azure Pipelines steps (GH-11493)Steve Dower2019-01-221-0/+4
|
* Fix typo in test module usage message (GH-11374)sth2018-12-311-1/+1
| | | | | A minor typo in the output of `python -m test -h`. A space was missing in between two words. howmuch -> how much
* bpo-35513, unittest: TextTestRunner uses time.perf_counter() (GH-11180)Victor Stinner2018-12-171-2/+2
| | | | | | | TextTestRunner of unittest.runner now uses time.perf_counter() rather than time.time() to measure the execution time of a test: time.time() can go backwards, whereas time.perf_counter() is monotonic. Similar change made in libregrtest, pprint and random.
* bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10150)Pablo Galindo2018-11-292-1/+17
|