dumb-init/tests/exit_status_test.py

12 lines
380 B
Python
Raw Normal View History

2015-09-12 01:57:22 +03:00
from subprocess import Popen
def test_exit_status(both_debug_modes, both_setsid_modes):
"""dumb-init should exit with the same exit status as the process that it
supervises.
"""
for status in [0, 1, 2, 32, 64, 127, 254, 255]:
2015-09-12 03:24:18 +03:00
proc = Popen(('dumb-init', 'sh', '-c', 'exit {0}'.format(status)))
2015-09-12 01:57:22 +03:00
proc.wait()
assert proc.returncode == status