From 24042c1d4c90d31b10b113ac3f2e7b6628ca63a3 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 6 Oct 2020 23:32:35 +0100 Subject: [PATCH 1/2] Fix signal handling in scripts/synapse_sytest.sh make sure that we pass SIGINTs and SIGTERMs through to the perl process, so that `docker stop` and ctrl-c actually stop the test runs. --- scripts/synapse_sytest.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/synapse_sytest.sh b/scripts/synapse_sytest.sh index d0088d6bd..ea322cdcb 100755 --- a/scripts/synapse_sytest.sh +++ b/scripts/synapse_sytest.sh @@ -177,7 +177,14 @@ fi mkdir -p /logs TEST_STATUS=0 -"${RUN_TESTS[@]}" "$@" >/logs/results.tap || TEST_STATUS=$? +"${RUN_TESTS[@]}" "$@" >/logs/results.tap & +pid=$! + +# make sure that we kill the test runner on SIGTERM, SIGINT, etc +trap 'kill $pid' TERM INT + +wait $pid || TEST_STATUS=$? +trap - TERM INT if [ $TEST_STATUS -ne 0 ]; then echo >&2 -e "run-tests \e[31mFAILED\e[0m: exit code $TEST_STATUS" From 7281bffef1289af871ec0ec709197d5daade3a2f Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 7 Oct 2020 10:55:16 +0100 Subject: [PATCH 2/2] do the same for dendrite --- scripts/dendrite_sytest.sh | 8 +++++++- scripts/synapse_sytest.sh | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/dendrite_sytest.sh b/scripts/dendrite_sytest.sh index 20c89c333..cbe674033 100755 --- a/scripts/dendrite_sytest.sh +++ b/scripts/dendrite_sytest.sh @@ -45,7 +45,13 @@ TEST_STATUS=0 mkdir -p /logs ./run-tests.pl -I Dendrite::Monolith -d $GOBIN -W /src/sytest-whitelist -O tap --all \ --work-directory="/work" --exclude-deprecated \ - "$@" > /logs/results.tap || TEST_STATUS=$? + "$@" > /logs/results.tap & +pid=$! + +# make sure that we kill the test runner on SIGTERM, SIGINT, etc +trap 'kill $pid' TERM INT +wait $pid || TEST_STATUS=$? +trap - TERM INT if [ $TEST_STATUS -ne 0 ]; then echo >&2 -e "run-tests \e[31mFAILED\e[0m: exit code $TEST_STATUS" diff --git a/scripts/synapse_sytest.sh b/scripts/synapse_sytest.sh index ea322cdcb..8db7c477a 100755 --- a/scripts/synapse_sytest.sh +++ b/scripts/synapse_sytest.sh @@ -182,7 +182,6 @@ pid=$! # make sure that we kill the test runner on SIGTERM, SIGINT, etc trap 'kill $pid' TERM INT - wait $pid || TEST_STATUS=$? trap - TERM INT