Call setitimer() before each test method, instead of once per test
case, to ensure that signals are sent in each test method.
Previously, only the first method of a testcase class got signals.
Changes:
* Replace setUpClass() with setUp() and replace tearDownClass() with
tearDown().
* tearDown() now ensures that at least one signal has been sent.
* Replace support.run_unittest() with unittest.main() which has
a nicer CLI and automatically discover test cases.
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.
Remove the pipe which was used as a weak workaround against the race
condition.
sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
* bpo-29972: Fix test_eintr on AIX
On AIX, sigtimedwait(0.2) sleeps 199.8 ms, whereas the test expects
200 ms or longer.
* bpo-29972: Skip some inet_pton() tests on AIX
Skip some inet_pton() tests of test_socket on AIX.
inet_pton() on AIX is less strict than on Linux and doesn't reject
some invalid IP addresses. The unit tests test more the libc than
Python itself.
* bpo-29972: Skip tests known to fail on AIX
* test_locale.test_strcoll_with_diacritic()
* test_locale.test_strxfrm_with_diacritic()
* test_strptime.test_week_of_year_and_day_of_week_calculation()
* test_tools.test_POT_Creation_Date()
* bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS
Skip some tests of select.poll when running on macOS due to unresolved
issues with the underlying system poll function on some macOS versions.
try to debug a hang on the FreeBSD 9 buildbot.
Run also eintr_tester.py with python "-u" command line option to try to get the
full output on hang/crash.
* test_eintr: support verbose mode, don't redirect eintr_tester output into
a pipe
* eintr_tester: replace os.fork() with subprocess to have a cleaner child
process (ex: don't inherit setitimer())
* eintr_tester: kill the process if the unit test fails
* test_open/test_os_open(): write support.PIPE_MAX_SIZE bytes instead of
support.PIPE_MAX_SIZE*3 bytes
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.
The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
when interrupted by a signal not in the *sigset* parameter, if the signal
handler does not raise an exception. signal.sigtimedwait() recomputes the
timeout with a monotonic clock when it is retried.
Remove test_signal.test_sigwaitinfo_interrupted() because sigwaitinfo() doesn't
raise InterruptedError anymore if it is interrupted by a signal not in its
sigset parameter.
interrupted by a signal
Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro.
The _PyTime_ADD_SECONDS only supported an integer number of seconds, the
_PyTime_AddDouble() has subsecond resolution.
retried with the recomputed delay, except if the signal handler raises an
exception (PEP 475).
Modify also test_signal to use a monotonic clock instead of the system clock.
* Issue #25234: Skip test_eintr.test_open() under OS X to avoid hanging
* Issue #25868: Try to make test_eintr.test_sigwaitinfo() more reliable
especially on slow buildbots. Use a pipe to synchronize the parent and the
child processes.