From 988bb20cff9f5a8837bf07f92d4c04983e65d785 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 17 Aug 2020 18:40:19 +0100 Subject: [PATCH] tests: Test -launch --terminate -- COMMAND Signed-off-by: Simon McVittie <smcv@collabora.com> --- tests/launcher.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/launcher.py b/tests/launcher.py index adabe25ec..eca7f8009 100755 --- a/tests/launcher.py +++ b/tests/launcher.py @@ -57,6 +57,7 @@ class TestLauncher(BaseTest): def test_socket_directory(self) -> None: with tempfile.TemporaryDirectory(prefix='test-') as temp: + need_terminate = True printf_symlink = os.path.join(temp, 'printf=symlink') printf = shutil.which('printf') assert printf is not None @@ -264,8 +265,24 @@ class TestLauncher(BaseTest): launch.wait(), (128 + signal.SIGINT, -signal.SIGINT), ) + + completed = run_subprocess( + self.launch + [ + '--socket', socket, + '--terminate', + '--', + 'sh', '-euc', 'echo Goodbye', + ], + check=True, + stdout=subprocess.PIPE, + stderr=2, + ) + need_terminate = False + self.assertEqual(completed.stdout, b'Goodbye\n') finally: - proc.terminate() + if need_terminate: + proc.terminate() + proc.wait() self.assertEqual(proc.returncode, 0) -- GitLab