diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2016-12-18 16:42:50 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-01-29 02:27:15 +0100 |
commit | f2d8e88f099f908075d3d7b166fdb40d9be6c1c5 (patch) | |
tree | 07b9b893ef92043960e0c6148937146c05c7ea7b /dcop/tests/run-tests.sh | |
parent | 57e73e9e4c61f9cfd9cc03fbbfa5970452e0e8a4 (diff) | |
download | tdelibs-f2d8e88f099f908075d3d7b166fdb40d9be6c1c5.tar.gz tdelibs-f2d8e88f099f908075d3d7b166fdb40d9be6c1c5.zip |
dcop/tests: run dcop tests in a safer manner
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'dcop/tests/run-tests.sh')
-rw-r--r-- | dcop/tests/run-tests.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dcop/tests/run-tests.sh b/dcop/tests/run-tests.sh index 1645b0696..2dbc55062 100644 --- a/dcop/tests/run-tests.sh +++ b/dcop/tests/run-tests.sh @@ -10,10 +10,13 @@ DCOP_SERVER_PID=$! die() { kill $DCOP_SERVER_PID + [ -n $DCOP_TEST_PID ] && kill $DCOP_TEST_PID echo "$1" exit 1; } +trap 'die "The script interrupted by user"' 2 15 + echo '* Running batch mode' ./dcop_test --batch >batch.stdout || die "Failed to run dcop_test" @@ -21,10 +24,16 @@ echo -n '* Starting test app ' ./dcop_test >shell.stdout & DCOP_TEST_PID=$! +cnt=0 while ! ../client/dcop | grep -q "TestApp-$DCOP_TEST_PID"; do echo -n '.' - sleep 2 + cnt=$((cnt+1)) + if [ "$cnt" -gt 15 ] ; then + kill "$DCOP_TEST_PID" + die "dcop_test seems to hanged up" + fi kill -0 "$DCOP_TEST_PID" || die "dcop_test died unexpectadly" + sleep 1 done echo ' started' |