From 379d94eb70440df7d4844732e7458b281b534ab1 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 30 Aug 2016 15:30:49 +0200 Subject: [PATCH] testing: Try to properly abort a test run after CTRL-C The run is aborted after the current scenario. Depending on which command was interrupted it might be necessary to press CTRL-C multiple times (e.g. if a later command depends on the interrupted one). This should fix HTML files and get us some proper console output after the run. --- testing/do-tests | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/do-tests b/testing/do-tests index 6548345e1..8330f95ad 100755 --- a/testing/do-tests +++ b/testing/do-tests @@ -182,6 +182,16 @@ echo "strongSwan : $SWANVERSION" echo "Date : $TESTDATE" echo +############################################################################## +# trap CTRL-C to properly terminate a long run +# + +function abort_tests() +{ + echo -n "...aborting..." > /dev/tty + aborted=YES +} +trap abort_tests INT ############################################################################## # enter specific test directory @@ -879,6 +889,11 @@ do ssh $SSHCONF $HOSTLOGIN 'if [ -f /var/run/charon.pid ]; then rm /var/run/charon.pid; echo " removed charon.pid on `hostname`"; fi' done + if [ -n "$aborted" ] + then + break 2 + fi + done done