def test_kill_process_with_sigkill(self):
"""
Verify that killing process really works, even if something is
holding the process badly. In these cases, a SIGKILL is performed
some time after the SIGTERM was issued and didn't work.
"""
output_filename = self.makeFile("NOT RUN")
self._write_script(
("#!%s\n"
"import signal, os\n"
"signal.signal(signal.SIGTERM, signal.SIG_IGN)\n"
"file = open(%r, 'w')\n"
"file.write('RUN')\n"
"file.close()\n"
"os.kill(os.getpid(), signal.SIGSTOP)\n"
) % (sys.executable, output_filename))
self.addCleanup(setattr, landscape.client.watchdog, "SIGKILL_DELAY",
landscape.client.watchdog.SIGKILL_DELAY)
landscape.client.watchdog.SIGKILL_DELAY = 1
waiter = FileChangeWaiter(output_filename)
self.daemon.start()
waiter.wait()
self.assertEqual(open(output_filename).read(), "RUN")
return self.daemon.stop()
评论列表
文章目录