mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #8407: Remove debug code from test_signal
I don't think that we still need it.
This commit is contained in:
parent
d49b1f14de
commit
3a7f0f05c1
1 changed files with 10 additions and 37 deletions
|
@ -58,15 +58,9 @@ class InterProcessSignalTests(unittest.TestCase):
|
||||||
|
|
||||||
def handlerA(self, signum, frame):
|
def handlerA(self, signum, frame):
|
||||||
self.a_called = True
|
self.a_called = True
|
||||||
if support.verbose:
|
|
||||||
print("handlerA invoked from signal %s at:\n%s" % (
|
|
||||||
signum, self.format_frame(frame, limit=1)))
|
|
||||||
|
|
||||||
def handlerB(self, signum, frame):
|
def handlerB(self, signum, frame):
|
||||||
self.b_called = True
|
self.b_called = True
|
||||||
if support.verbose:
|
|
||||||
print ("handlerB invoked from signal %s at:\n%s" % (
|
|
||||||
signum, self.format_frame(frame, limit=1)))
|
|
||||||
raise HandlerBCalled(signum, self.format_frame(frame))
|
raise HandlerBCalled(signum, self.format_frame(frame))
|
||||||
|
|
||||||
def wait(self, child):
|
def wait(self, child):
|
||||||
|
@ -93,8 +87,6 @@ class InterProcessSignalTests(unittest.TestCase):
|
||||||
|
|
||||||
# Let the sub-processes know who to send signals to.
|
# Let the sub-processes know who to send signals to.
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
if support.verbose:
|
|
||||||
print("test runner's pid is", pid)
|
|
||||||
|
|
||||||
child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)])
|
child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)])
|
||||||
if child:
|
if child:
|
||||||
|
@ -118,8 +110,6 @@ class InterProcessSignalTests(unittest.TestCase):
|
||||||
except HandlerBCalled:
|
except HandlerBCalled:
|
||||||
self.assertTrue(self.b_called)
|
self.assertTrue(self.b_called)
|
||||||
self.assertFalse(self.a_called)
|
self.assertFalse(self.a_called)
|
||||||
if support.verbose:
|
|
||||||
print("HandlerBCalled exception caught")
|
|
||||||
|
|
||||||
child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)])
|
child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)])
|
||||||
if child:
|
if child:
|
||||||
|
@ -135,8 +125,7 @@ class InterProcessSignalTests(unittest.TestCase):
|
||||||
# may return early.
|
# may return early.
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if support.verbose:
|
pass
|
||||||
print("KeyboardInterrupt (the alarm() went off)")
|
|
||||||
except:
|
except:
|
||||||
self.fail("Some other exception woke us from pause: %s" %
|
self.fail("Some other exception woke us from pause: %s" %
|
||||||
traceback.format_exc())
|
traceback.format_exc())
|
||||||
|
@ -359,10 +348,9 @@ class SiginterruptTest(unittest.TestCase):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def test_without_siginterrupt(self):
|
def test_without_siginterrupt(self):
|
||||||
"""If a signal handler is installed and siginterrupt is not called
|
# If a signal handler is installed and siginterrupt is not called
|
||||||
at all, when that signal arrives, it interrupts a syscall that's in
|
# at all, when that signal arrives, it interrupts a syscall that's in
|
||||||
progress.
|
# progress.
|
||||||
"""
|
|
||||||
i = self.readpipe_interrupted()
|
i = self.readpipe_interrupted()
|
||||||
self.assertTrue(i)
|
self.assertTrue(i)
|
||||||
# Arrival of the signal shouldn't have changed anything.
|
# Arrival of the signal shouldn't have changed anything.
|
||||||
|
@ -370,10 +358,9 @@ class SiginterruptTest(unittest.TestCase):
|
||||||
self.assertTrue(i)
|
self.assertTrue(i)
|
||||||
|
|
||||||
def test_siginterrupt_on(self):
|
def test_siginterrupt_on(self):
|
||||||
"""If a signal handler is installed and siginterrupt is called with
|
# If a signal handler is installed and siginterrupt is called with
|
||||||
a true value for the second argument, when that signal arrives, it
|
# a true value for the second argument, when that signal arrives, it
|
||||||
interrupts a syscall that's in progress.
|
# interrupts a syscall that's in progress.
|
||||||
"""
|
|
||||||
signal.siginterrupt(self.signum, 1)
|
signal.siginterrupt(self.signum, 1)
|
||||||
i = self.readpipe_interrupted()
|
i = self.readpipe_interrupted()
|
||||||
self.assertTrue(i)
|
self.assertTrue(i)
|
||||||
|
@ -382,10 +369,9 @@ class SiginterruptTest(unittest.TestCase):
|
||||||
self.assertTrue(i)
|
self.assertTrue(i)
|
||||||
|
|
||||||
def test_siginterrupt_off(self):
|
def test_siginterrupt_off(self):
|
||||||
"""If a signal handler is installed and siginterrupt is called with
|
# If a signal handler is installed and siginterrupt is called with
|
||||||
a false value for the second argument, when that signal arrives, it
|
# a false value for the second argument, when that signal arrives, it
|
||||||
does not interrupt a syscall that's in progress.
|
# does not interrupt a syscall that's in progress.
|
||||||
"""
|
|
||||||
signal.siginterrupt(self.signum, 0)
|
signal.siginterrupt(self.signum, 0)
|
||||||
i = self.readpipe_interrupted()
|
i = self.readpipe_interrupted()
|
||||||
self.assertFalse(i)
|
self.assertFalse(i)
|
||||||
|
@ -410,8 +396,6 @@ class ItimerTest(unittest.TestCase):
|
||||||
|
|
||||||
def sig_alrm(self, *args):
|
def sig_alrm(self, *args):
|
||||||
self.hndl_called = True
|
self.hndl_called = True
|
||||||
if support.verbose:
|
|
||||||
print("SIGALRM handler invoked", args)
|
|
||||||
|
|
||||||
def sig_vtalrm(self, *args):
|
def sig_vtalrm(self, *args):
|
||||||
self.hndl_called = True
|
self.hndl_called = True
|
||||||
|
@ -423,21 +407,13 @@ class ItimerTest(unittest.TestCase):
|
||||||
elif self.hndl_count == 3:
|
elif self.hndl_count == 3:
|
||||||
# disable ITIMER_VIRTUAL, this function shouldn't be called anymore
|
# disable ITIMER_VIRTUAL, this function shouldn't be called anymore
|
||||||
signal.setitimer(signal.ITIMER_VIRTUAL, 0)
|
signal.setitimer(signal.ITIMER_VIRTUAL, 0)
|
||||||
if support.verbose:
|
|
||||||
print("last SIGVTALRM handler call")
|
|
||||||
|
|
||||||
self.hndl_count += 1
|
self.hndl_count += 1
|
||||||
|
|
||||||
if support.verbose:
|
|
||||||
print("SIGVTALRM handler invoked", args)
|
|
||||||
|
|
||||||
def sig_prof(self, *args):
|
def sig_prof(self, *args):
|
||||||
self.hndl_called = True
|
self.hndl_called = True
|
||||||
signal.setitimer(signal.ITIMER_PROF, 0)
|
signal.setitimer(signal.ITIMER_PROF, 0)
|
||||||
|
|
||||||
if support.verbose:
|
|
||||||
print("SIGPROF handler invoked", args)
|
|
||||||
|
|
||||||
def test_itimer_exc(self):
|
def test_itimer_exc(self):
|
||||||
# XXX I'm assuming -1 is an invalid itimer, but maybe some platform
|
# XXX I'm assuming -1 is an invalid itimer, but maybe some platform
|
||||||
# defines it ?
|
# defines it ?
|
||||||
|
@ -450,10 +426,7 @@ class ItimerTest(unittest.TestCase):
|
||||||
def test_itimer_real(self):
|
def test_itimer_real(self):
|
||||||
self.itimer = signal.ITIMER_REAL
|
self.itimer = signal.ITIMER_REAL
|
||||||
signal.setitimer(self.itimer, 1.0)
|
signal.setitimer(self.itimer, 1.0)
|
||||||
if support.verbose:
|
|
||||||
print("\ncall pause()...")
|
|
||||||
signal.pause()
|
signal.pause()
|
||||||
|
|
||||||
self.assertEqual(self.hndl_called, True)
|
self.assertEqual(self.hndl_called, True)
|
||||||
|
|
||||||
# Issue 3864, unknown if this affects earlier versions of freebsd also
|
# Issue 3864, unknown if this affects earlier versions of freebsd also
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue