summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dcop/tests/CMakeLists.txt1
-rwxr-xr-xdcop/tests/generate.pl3
-rw-r--r--dcop/tests/run-tests.sh11
3 files changed, 13 insertions, 2 deletions
diff --git a/dcop/tests/CMakeLists.txt b/dcop/tests/CMakeLists.txt
index 4bb3908aa..b9152cc82 100644
--- a/dcop/tests/CMakeLists.txt
+++ b/dcop/tests/CMakeLists.txt
@@ -38,6 +38,7 @@ add_test( NAME "dcop/dcop-tests"
COMMAND sh -x "${CMAKE_CURRENT_SOURCE_DIR}/run-tests.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )
+set_tests_properties( dcop/dcop-tests PROPERTIES TIMEOUT 30)
##### test.h and files ##########################
diff --git a/dcop/tests/generate.pl b/dcop/tests/generate.pl
index 9ef1f13fc..e7e8d4fd6 100755
--- a/dcop/tests/generate.pl
+++ b/dcop/tests/generate.pl
@@ -11,7 +11,8 @@ my $OBJECT_NAME = 'TestInterface';
sub shell_header {
- print SHELL "TEST_APP=\`$DCOP 'TestApp-*'\`\n";
+ print SHELL "TEST_APP=\"\${DCOP_TEST_PID:+TestApp-\$DCOP_TEST_PID\}\"\n" .
+ "TEST_APP=\"\${TEST_APP:-\$($DCOP 'TestApp-*')}\"\n";
}
sub shell_footer {
print SHELL "$DCOP $TEST_APP 'MainApplication-Interface' quit";
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'