Fix: tests: remove killall, add missing SIGTERM handlers
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 19 Nov 2014 21:40:30 +0000 (22:40 +0100)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 26 Nov 2014 17:52:33 +0000 (12:52 -0500)
Applications may change name and, thus, be missed by using
killall.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/stress/test_multi_sessions_per_uid_10app
tests/stress/test_multi_sessions_per_uid_5app_streaming
tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd

index 365519dc661b2fe890ca35e63a787287c3360d3a..a86b72426b8585c9117a71fe41ddf8f771449181 100755 (executable)
@@ -24,6 +24,7 @@ NR_APP=10
 NR_SESSION=5
 NR_LOOP=1000
 COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
+APPS_PID=
 
 TEST_DESC="Stress test - $NR_SESSION sessions per UID with $NR_APP apps"
 
@@ -101,7 +102,11 @@ test_stress()
 function cleanup()
 {
        diag "Cleaning up!"
-       killall -9 $LAUNCH_APP
+       for p in ${APPS_PID}; do
+               kill -s SIGKILL ${p}
+               wait ${p} 2>/dev/null
+       done
+       APPS_PID=
        stop_lttng_sessiond
 }
 
@@ -113,6 +118,7 @@ function sighandler()
 }
 
 trap sighandler SIGINT
+trap sighandler SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
@@ -128,6 +134,7 @@ diag "Starting applications"
 
 # Start NR_APP applications script that will spawn apps non stop.
 ./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
+APPS_PID="${APPS_PID} ${!}"
 
 TRACE_PATH=$(mktemp -d)
 
index 40c0a4d960732facd36cb6fb8ce651e936ef786d..36a15d92e8a545011e202aedbb944f03239603d7 100755 (executable)
@@ -23,6 +23,7 @@ NR_SESSION=5
 NR_LOOP=1000
 COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
 NUM_TESTS=16
+APPS_PID=
 
 TEST_DESC="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps"
 
@@ -140,7 +141,11 @@ test_stress()
 function cleanup()
 {
        diag "Cleaning up!"
-       killall -9 $LAUNCH_APP
+       for p in ${APPS_PID}; do
+               kill -s SIGKILL ${p}
+               wait ${p} 2>/dev/null
+       done
+       APPS_PID=
        stop_lttng_sessiond
        stop_lttng_relayd
 }
@@ -153,6 +158,7 @@ function sighandler()
 }
 
 trap sighandler SIGINT
+trap sighandler SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
@@ -171,6 +177,7 @@ diag "Starting applications launcher"
 
 # Start NR_APP applications script that will spawn apps non stop.
 ./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
+APPS_PID="${APPS_PID} ${!}"
 
 test_stress
 out=$?
index fa41b4cbb39e7269b1c18b53f5ecfcac3f1e0a96..e01e6aaf8c80906a019680e5f520bc42a4c14245 100755 (executable)
@@ -24,6 +24,7 @@ NR_SESSION=5
 NR_LOOP=100000
 COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
 NUM_TESTS=16
+APPS_PID=
 
 TEST_DESC="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps. The relayd is killed sporadically"
 
@@ -142,8 +143,11 @@ test_stress()
 function cleanup()
 {
        diag "Cleaning up!"
-       killall -9 $LAUNCH_APP
-       killall -9 $KILL_RELAYD_HELPER
+       for p in ${APPS_PID}; do
+               kill ${p}
+               wait ${p} 2>/dev/null
+       done
+       APPS_PID=
        stop_lttng_sessiond
        stop_lttng_relayd
 }
@@ -156,6 +160,7 @@ function sighandler()
 }
 
 trap sighandler SIGINT
+trap sighandler SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
@@ -174,8 +179,11 @@ diag "Starting applications launcher"
 
 # Start NR_APP applications script that will spawn apps non stop.
 ./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
+APPS_PID="${APPS_PID} ${!}"
+
 # Launch the helper script that will randomly kill the relayd at vitam eternam.
 ./$TESTDIR/stress/$KILL_RELAYD_HELPER 1 1 &
+APPS_PID="${APPS_PID} ${!}"
 
 test_stress
 out=$?
This page took 0.027197 seconds and 4 git commands to generate.