blob: c2e8deadbab752025187660c8ace1a2975a592bb [file] [log] [blame]
Charles-François Natali6e6c59b2015-02-07 13:27:50 +00001import os
2import signal
Miss Islington (bot)0fc3b2f2018-12-05 15:35:43 -08003import subprocess
4import sys
Charles-François Natali6e6c59b2015-02-07 13:27:50 +00005import unittest
6
Berker Peksagce643912015-05-06 06:33:17 +03007from test import support
8from test.support import script_helper
Charles-François Natali6e6c59b2015-02-07 13:27:50 +00009
10
11@unittest.skipUnless(os.name == "posix", "only supported on Unix")
12class EINTRTests(unittest.TestCase):
13
14 @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")
15 def test_all(self):
16 # Run the tester in a sub-process, to make sure there is only one
17 # thread (for reliable signal delivery).
18 tester = support.findfile("eintr_tester.py", subdir="eintrdata")
Victor Stinner98f223d2015-10-01 13:16:43 +020019 # use -u to try to get the full output if the test hangs or crash
Miss Islington (bot)0fc3b2f2018-12-05 15:35:43 -080020 args = ["-u", tester, "-v"]
21 if support.verbose:
22 print()
23 print("--- run eintr_tester.py ---")
24 # In verbose mode, the child process inherit stdout and stdout,
25 # to see output in realtime and reduce the risk of loosing output.
26 args = [sys.executable, "-E", "-X", "faulthandler", *args]
27 proc = subprocess.run(args)
28 print(f"--- eintr_tester.py completed: exit code {proc.returncode} ---")
29 if proc.returncode:
30 self.fail("eintr_tester.py failed")
31 else:
32 script_helper.assert_python_ok("-u", tester, "-v")
Charles-François Natali6e6c59b2015-02-07 13:27:50 +000033
34
35if __name__ == "__main__":
36 unittest.main()