|
Lines 8-15
sys.path.insert(0, '.')
Link Here
|
| 8 |
from TestUMCSystemModule import TestUMCSystem |
8 |
from TestUMCSystemModule import TestUMCSystem |
| 9 |
|
9 |
|
| 10 |
from psutil import Process |
10 |
from psutil import Process |
| 11 |
from os import wait4, WNOHANG |
11 |
from os import wait4, WNOHANG, WTERMSIG |
| 12 |
from subprocess import Popen |
12 |
import signal |
| 13 |
|
13 |
|
| 14 |
from univention.config_registry import ConfigRegistry |
14 |
from univention.config_registry import ConfigRegistry |
| 15 |
import univention.testing.utils as utils |
15 |
import univention.testing.utils as utils |
|
Lines 66-74
class TestUMCProcessKilling(TestUMCSystem):
Link Here
|
| 66 |
"forcing kill" % self.Proc.pid) |
66 |
"forcing kill" % self.Proc.pid) |
| 67 |
self.Proc.kill() |
67 |
self.Proc.kill() |
| 68 |
_pid, exit_status, _res_usage = wait4(self.Proc.pid, WNOHANG) |
68 |
_pid, exit_status, _res_usage = wait4(self.Proc.pid, WNOHANG) |
| 69 |
if exit_status != 9: |
69 |
if WTERMSIG(exit_status) != signal.SIGKILL: |
| 70 |
print("The exit status while force kill is '%s' " |
70 |
print("The exit status while force kill is 0x%x " |
| 71 |
"instead of 'SIGKILL' code 9." % exit_status) |
71 |
"instead of 'SIGKILL'(%d)." % (exit_status, signal.SIGKILL)) |
| 72 |
|
72 |
|
| 73 |
def create_process(self): |
73 |
def create_process(self): |
| 74 |
""" |
74 |
""" |
|
Lines 98-106
class TestUMCProcessKilling(TestUMCSystem):
Link Here
|
| 98 |
if self.query_process_exists(pid): |
98 |
if self.query_process_exists(pid): |
| 99 |
self.make_kill_request('SIGTERM', [pid]) |
99 |
self.make_kill_request('SIGTERM', [pid]) |
| 100 |
_pid, exit_status, _res_usage = wait4(pid, WNOHANG) |
100 |
_pid, exit_status, _res_usage = wait4(pid, WNOHANG) |
| 101 |
if exit_status != 15: |
101 |
if WTERMSIG(exit_status) != signal.SIGTERM: |
| 102 |
utils.fail("Process exit status is '%s' instead of " |
102 |
utils.fail("Process exit status is 0x%x instead of " |
| 103 |
"'SIGTERM' code 15." % exit_status) |
103 |
"SIGTERM(%d)." % (exit_status, signal.SIGTERM)) |
| 104 |
if self.query_process_exists(pid): |
104 |
if self.query_process_exists(pid): |
| 105 |
utils.fail("Process did not terminate after request " |
105 |
utils.fail("Process did not terminate after request " |
| 106 |
"with 'SIGTERM' signal") |
106 |
"with 'SIGTERM' signal") |
|
Lines 116-124
class TestUMCProcessKilling(TestUMCSystem):
Link Here
|
| 116 |
if self.query_process_exists(pid): |
116 |
if self.query_process_exists(pid): |
| 117 |
self.make_kill_request('SIGKILL', [pid]) |
117 |
self.make_kill_request('SIGKILL', [pid]) |
| 118 |
_pid, exit_status, _res_usage = wait4(pid, WNOHANG) |
118 |
_pid, exit_status, _res_usage = wait4(pid, WNOHANG) |
| 119 |
if exit_status != 9: |
119 |
if WTERMSIG(exit_status) != signal.SIGKILL: |
| 120 |
utils.fail("Process exit status is '%s' instead of " |
120 |
utils.fail("Process exit status is 0x%x instead of " |
| 121 |
"'SIGKILL' code 9." % exit_status) |
121 |
"SIGKILL(%d)." % (exit_status, signal.SIGKILL)) |
| 122 |
if self.query_process_exists(pid): |
122 |
if self.query_process_exists(pid): |
| 123 |
utils.fail("Process did not terminate after request " |
123 |
utils.fail("Process did not terminate after request " |
| 124 |
"with 'SIGKILL' signal") |
124 |
"with 'SIGKILL' signal") |
| 125 |
- |
|
|
| 126 |
-- |
| 127 |
.../60_umc-system/22_umc-service-proc-killing | 49 +++++++++------------- |
125 |
.../60_umc-system/22_umc-service-proc-killing | 49 +++++++++------------- |
| 128 |
1 file changed, 19 insertions(+), 30 deletions(-) |
126 |
1 file changed, 19 insertions(+), 30 deletions(-) |