From 1a8dc6e21c43e69996d4d9655e3eb48941425a59 Mon Sep 17 00:00:00 2001 From: Thomas Orozco Date: Sat, 31 Oct 2015 15:31:57 +0100 Subject: [PATCH] Cleanup internal tests a little bit No functional changes here. --- test/run_inner_tests.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/run_inner_tests.py b/test/run_inner_tests.py index 5cad861..b1f9def 100755 --- a/test/run_inner_tests.py +++ b/test/run_inner_tests.py @@ -60,20 +60,19 @@ def main(): # Run the signals test - for signame in "SIGINT", "SIGTERM": - print "running signal test for: {0} ({1} with env {2})".format(signame, " ".join(target), env) + for signum in [signal.SIGINT, signal.SIGTERM]: + print "running signal test for: {0} ({1} with env {2})".format(SIGNUM_TO_SIGNAME[signum], " ".join(target), env) p = subprocess.Popen(target + [os.path.join(src, "test", "signals", "test.py")], env=dict(os.environ, **env)) - sig = getattr(signal, signame) - p.send_signal(sig) + p.send_signal(signum) ret = p.wait() - assert ret == -sig, "Signals test failed!" + assert ret == -signum, "Signals test failed (ret was {0}, expected {1})".format(ret, -signum) # Run the process group test # This test has Tini spawn a process that ignores SIGUSR1 and spawns a child that doesn't (and waits on the child) # We send SIGUSR1 to Tini, and expect the grand-child to terminate, then the child, and then Tini. print "Running process group test" - p = subprocess.Popen([tini, '-g', '--', os.path.join(src, "test", "pgroup", "stage_1.py")], env=dict(os.environ, **env)) + p = subprocess.Popen([tini, '-g', '--', os.path.join(src, "test", "pgroup", "stage_1.py")], stdout=subprocess.PIPE, stderr=subprocess.PIPE) busy_wait(lambda: len(psutil.Process(p.pid).children(recursive=True)) == 2, 10) p.send_signal(signal.SIGUSR1)