Fix: tests: don't use pidof to wait for test apps
[lttng-tools.git] / tests / regression / tools / snapshots / test_ust_streaming
index 632a563e06502e07303c3ece0a4232352eee5b1f..c0d98c2df1ff0dfb686b7ac7c23eb06ea8d9443c 100755 (executable)
@@ -72,6 +72,15 @@ function start_trace_app()
        rm -f $tmp_file
 }
 
+function stop_trace_app()
+{
+       diag "Killing $TESTAPP_NAME"
+       PID_APP=`pidof $TESTAPP_NAME`
+       kill $PID_APP >/dev/null 2>&1
+       diag "Waiting on $TESTAPP_NAME"
+       wait
+}
+
 # Test a snapshot using a default name for the output destination.
 function test_ust_default_name_with_del()
 {
@@ -90,6 +99,7 @@ function test_ust_default_name_with_del()
        echo $TRACE_PATH/$HOSTNAME/snapshot-1
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
        if [ $? -ne 0 ]; then
+               stop_trace_app
                return $?
        fi
 
@@ -100,15 +110,14 @@ function test_ust_default_name_with_del()
        # Validate test with the next ID since a del output was done prior.
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-2*
        if [ $? -ne 0 ]; then
+               stop_trace_app
                return $?
        fi
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
+       stop_trace_app
 
        return 0
 }
@@ -132,9 +141,7 @@ function test_ust_default_name()
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
        out=$?
 
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
+       stop_trace_app
 
        return $out
 }
@@ -157,9 +164,7 @@ function test_ust_default_name_custom_uri()
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
        out=$?
 
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
+       stop_trace_app
 
        return $out
 }
@@ -193,9 +198,7 @@ function test_ust_custom_name()
                out=1
        fi
 
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
+       stop_trace_app
 
        return $out
 }
This page took 0.027041 seconds and 5 git commands to generate.