Fix: test flaky sleep and wait patterns
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 19 Nov 2014 21:40:26 +0000 (22:40 +0100)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 23 Nov 2014 19:27:16 +0000 (14:27 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
15 files changed:
tests/regression/tools/live/test_kernel
tests/regression/tools/live/test_ust
tests/regression/tools/live/test_ust_tracefile_count
tests/regression/tools/snapshots/test_ust_streaming
tests/regression/tools/snapshots/ust_test
tests/regression/tools/streaming/test_kernel
tests/regression/ust/java-jul/test_java_jul
tests/regression/ust/java-log4j/test_java_log4j
tests/regression/ust/nprocesses/test_nprocesses
tests/regression/ust/python-logging/test_python_logging
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
tests/utils/testapp/gen-ust-events/gen-ust-events.c
tests/utils/utils.sh

index ac4c19f56d8c7ff9b1a060363a801f7782cd0e01..bf5e79c574381dbd45f606d943dfdbc6a5775429 100755 (executable)
@@ -63,18 +63,16 @@ else
 fi
 
 if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
-       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
+       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-sessiond"
                exit 1
        fi
-       # Wait for sessiond to bootstrap
-       sleep 2
 fi
 
-opt="-o $TRACE_PATH"
+opt="--background -o $TRACE_PATH"
 if [ -z $(pidof lt-$RELAYD_BIN) ]; then
-       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 &
+       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-relayd (opt: $opt)"
                return 1
index 2eac48c6eee8d71a822eb70e9661829b9d019224..4026bba647143f5a3575575b53050237032a9d61 100755 (executable)
@@ -60,18 +60,16 @@ function clean_live_tracing()
 }
 
 if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
-       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
+       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-sessiond"
                exit 1
        fi
-       # Wait for sessiond to bootstrap
-       sleep 2
 fi
 
-opt="-o $TRACE_PATH"
+opt="-o $TRACE_PATH --background"
 if [ -z $(pidof lt-$RELAYD_BIN) ]; then
-       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 &
+       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-relayd (opt: $opt)"
                return 1
index f90cbd1ebd42241c0b4e9426a1345583901bae98..3ef2ee1e9627c9ccc7188f24aa7b9b2786ed271d 100755 (executable)
@@ -61,18 +61,16 @@ function clean_live_tracing()
 }
 
 if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
-       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
+       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-sessiond"
                exit 1
        fi
-       # Wait for sessiond to bootstrap
-       sleep 2
 fi
 
-opt="-o $TRACE_PATH"
+opt="-o $TRACE_PATH --background"
 if [ -z $(pidof lt-$RELAYD_BIN) ]; then
-       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 &
+       $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1
        if [ $? -eq 1 ]; then
                echo "Fail to start lttng-relayd (opt: $opt)"
                return 1
index c0d98c2df1ff0dfb686b7ac7c23eb06ea8d9443c..52330a5c9f8362b1625cbe05f17b71a257c5edbf 100755 (executable)
@@ -28,6 +28,7 @@ TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 NR_ITER=2000000
 NR_USEC_WAIT=100
+APPS_PID=
 
 TRACE_PATH=$(mktemp -d)
 
@@ -55,13 +56,15 @@ function snapshot_add_output ()
 }
 
 # Start trace application and return once one event has been hit.
-function start_trace_app()
+function start_test_app()
 {
        local tmp_file="/tmp/lttng_test_ust.42.file"
 
        # Start application with a temporary file.
        $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file &
-       ok $? "Start application to trace"
+       ret=$?
+       APPS_PID="${APPS_PID} ${!}"
+       ok $ret "Start application to trace"
 
        # Wait for the application file to appear indicating that at least one
        # tracepoint has been fired.
@@ -72,13 +75,13 @@ function start_trace_app()
        rm -f $tmp_file
 }
 
-function stop_trace_app()
+function stop_test_apps()
 {
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
-       diag "Waiting on $TESTAPP_NAME"
-       wait
+       diag "Stopping $TESTAPP_NAME"
+       for p in ${APPS_PID}; do
+               kill ${p}
+               wait ${p} 2>&1
+       done
 }
 
 # Test a snapshot using a default name for the output destination.
@@ -90,7 +93,7 @@ function test_ust_default_name_with_del()
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
        start_lttng_tracing $SESSION_NAME
 
-       start_trace_app
+       start_test_app
 
        snapshot_add_output $SESSION_NAME "net://localhost"
        lttng_snapshot_record $SESSION_NAME
@@ -99,7 +102,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
+               stop_test_apps
                return $?
        fi
 
@@ -110,14 +113,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
+               stop_test_apps
                return $?
        fi
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
-       stop_trace_app
+       stop_test_apps
 
        return 0
 }
@@ -131,7 +134,7 @@ function test_ust_default_name()
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
        start_lttng_tracing $SESSION_NAME
 
-       start_trace_app
+       start_test_app
 
        snapshot_add_output $SESSION_NAME "net://localhost"
        lttng_snapshot_record $SESSION_NAME
@@ -141,7 +144,7 @@ function test_ust_default_name()
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
        out=$?
 
-       stop_trace_app
+       stop_test_apps
 
        return $out
 }
@@ -154,7 +157,7 @@ function test_ust_default_name_custom_uri()
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
        start_lttng_tracing $SESSION_NAME
 
-       start_trace_app
+       start_test_app
 
        snapshot_add_output $SESSION_NAME "-C tcp://localhost:5342 -D tcp://localhost:5343"
        lttng_snapshot_record $SESSION_NAME
@@ -164,7 +167,7 @@ function test_ust_default_name_custom_uri()
        validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
        out=$?
 
-       stop_trace_app
+       stop_test_apps
 
        return $out
 }
@@ -181,7 +184,7 @@ function test_ust_custom_name()
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
        start_lttng_tracing $SESSION_NAME
 
-       start_trace_app
+       start_test_app
 
        snapshot_add_output $SESSION_NAME "net://localhost" $name
        lttng_snapshot_record $SESSION_NAME
@@ -198,7 +201,7 @@ function test_ust_custom_name()
                out=1
        fi
 
-       stop_trace_app
+       stop_test_apps
 
        return $out
 }
index a35fbf37fb9022c22946bd9c96dcd7f4a3427548..4ef9f5848cffb7ccd4f33171ac33305194b19414 100755 (executable)
@@ -27,6 +27,7 @@ TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 NR_ITER=2000000
 NR_USEC_WAIT=100
+APPS_PID=
 
 NUM_TESTS=76
 
@@ -52,7 +53,9 @@ function start_test_app()
 
        # Start application with a temporary file.
        $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file &
-       ok $? "Start application to trace"
+       ret=$?
+       APPS_PID="${APPS_PID} ${!}"
+       ok $ret "Start application to trace"
 
        # Wait for the application file to appear indicating that at least one
        # tracepoint has been fired.
@@ -63,13 +66,13 @@ function start_test_app()
        rm -f $tmp_file
 }
 
-function stop_test_app()
+function stop_test_apps()
 {
-       diag "Killing $TESTAPP_NAME"
-       PID_APP=`pidof $TESTAPP_NAME`
-       kill $PID_APP >/dev/null 2>&1
-       diag "Waiting on $TESTAPP_NAME"
-       wait
+       diag "Stopping $TESTAPP_NAME"
+       for p in ${APPS_PID}; do
+               kill ${p}
+               wait ${p} 2>&1
+       done
 }
 
 function snapshot_add_output ()
@@ -174,7 +177,7 @@ function test_ust_local_snapshot ()
                break
        fi
 
-       stop_test_app
+       stop_test_apps
 }
 
 function test_ust_local_snapshot_max_size ()
@@ -222,7 +225,7 @@ function test_ust_local_snapshot_max_size ()
                rm -rf $TRACE_PATH
        fi
 
-       stop_test_app
+       stop_test_apps
 }
 
 function test_ust_local_snapshot_large_metadata ()
@@ -288,7 +291,7 @@ function test_ust_per_uid_local_snapshot ()
                break
        fi
 
-       stop_test_app
+       stop_test_apps
 }
 
 function test_ust_per_uid_local_snapshot_post_mortem ()
@@ -302,7 +305,7 @@ function test_ust_per_uid_local_snapshot_post_mortem ()
 
        # Returns once the application has at least fired ONE tracepoint.
        start_test_app
-       stop_test_app
+       stop_test_apps
 
        lttng_snapshot_record $SESSION_NAME
        stop_lttng_tracing $SESSION_NAME
@@ -346,7 +349,7 @@ function test_ust_local_snapshots ()
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
-       stop_test_app
+       stop_test_apps
 }
 
 plan_tests $NUM_TESTS
index 9877bb8d949f455c3e9ef071169c26f787eb7965..1e272c39aa92f0f48cd074b7b7637736e90c549a 100755 (executable)
@@ -52,13 +52,6 @@ function test_kernel_before_start ()
        sleep 1
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
-
-       # We can not predict _yet_ when the trace is available so we have to do a
-       # arbitratry sleep to validate the trace.
-       diag "Wait 3 seconds for the trace to be written on disk"
-       for i in `seq 1 3`; do
-               sleep 1
-       done
 }
 
 # Deactivated since this feature is not yet available where we can enable
index bcde273be7cd8fd066aec60ebbfa307470e44164..359fe0536bb0a059fa45142c5a91081ab71722eb 100755 (executable)
@@ -99,7 +99,7 @@ function test_jul_before_start ()
        start_lttng_tracing $SESSION_NAME
 
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -399,7 +399,8 @@ function test_jul_destroy_session()
        # Run 5 times with a 1 second delay
        run_app_background 0 1
 
-       sleep 1
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -414,8 +415,11 @@ function test_jul_destroy_session()
        enable_jul_lttng_event $SESSION_NAME $EVENT_NAME2
        start_lttng_tracing $SESSION_NAME
 
+       # Run 5 times with a 1 second delay
+       run_app_background 0 1
+
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
index b4846c323d625578815b1457ea4153b288e70e80..173d50811705bcce7e3c688f45c428f812e3a640 100755 (executable)
@@ -100,7 +100,7 @@ function test_log4j_before_start ()
        start_lttng_tracing $SESSION_NAME
 
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -399,8 +399,8 @@ function test_log4j_destroy_session()
 
        # Run 5 times with a 1 second delay
        run_app_background 0 1
-
-       sleep 1
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -415,8 +415,10 @@ function test_log4j_destroy_session()
        enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME2
        start_lttng_tracing $SESSION_NAME
 
+       # Run 5 times with a 1 second delay
+       run_app_background 0 1
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
index 84d0ff7a03a8d92eaaacd474975ede1d16086370..396dab0d8a026fbdb3a38f1846918c077dc9bbfc 100755 (executable)
@@ -19,7 +19,7 @@ TEST_DESC="UST tracer - Generate $NUM_PROCESS process"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
-NR_ITER=1000
+NR_ITER=-1     # infinite loop
 NR_USEC_WAIT=1000000
 TESTAPP_PATH="$TESTDIR/utils/testapp"
 TESTAPP_NAME="gen-ust-events"
@@ -28,6 +28,7 @@ SESSION_NAME="ust-nprocesses"
 EVENT_NAME="tp:tptest"
 TEST_WAIT_SEC=5
 NUM_TESTS=9
+APPS_PID=
 
 source $TESTDIR/utils/utils.sh
 
@@ -43,20 +44,24 @@ print_test_banner "$TEST_DESC"
 
 start_lttng_sessiond
 
-# Start test for 1000 seconds
+# Start tests. Each is an infinite tracing loop.
 
+diag "Starting $NUM_PROCESS test applications"
 for i in `seq 1 $NUM_PROCESS`
 do
        $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
+       APPS_PID="${APPS_PID} ${!}"
 done
 
+diag "Waiting for applications to be registered to sessiond"
+
 reg_app_count=0
 while [ $reg_app_count -ne $NUM_PROCESS ]; do
        listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
        reg_app_count=$(echo -n $listing | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep "$TESTAPP_BIN" | wc -l)
 done
 
-pass "Trace validation"
+pass "All applications are registered to sessiond"
 
 TRACE_PATH=$(mktemp -d)
 
@@ -65,10 +70,8 @@ create_lttng_session $SESSION_NAME $TRACE_PATH
 enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 start_lttng_tracing $SESSION_NAME
 
-diag "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere"
-diag "Warning: this arbitrary time can make the test fail on slower system"
-
-sleep $TEST_WAIT_SEC
+# We don't validate whether the applications have traced here, rather
+# just that they registered to sessiond (above).
 
 stop_lttng_tracing $SESSION_NAME
 destroy_lttng_session $SESSION_NAME
@@ -76,8 +79,10 @@ destroy_lttng_session $SESSION_NAME
 rm -rf $TRACE_PATH
 
 diag "Stopping all spawned applications"
-killall -q $TESTAPP_NAME >/dev/null 2>&1
-wait
+for p in ${APPS_PID}; do
+       kill ${p}
+       wait ${p} 2>/dev/null
+done
 pass "Stopped all spawned applications"
 
 stop_lttng_sessiond
index b2fa6fb76f69e1560c173701dde7438bc113268d..cb960daa86d172cdbe931447a9013d0cb06f93d8 100755 (executable)
@@ -99,7 +99,7 @@ function test_python_before_start ()
        start_lttng_tracing $SESSION_NAME
 
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -403,7 +403,8 @@ function test_python_destroy_session()
        # Run 5 times with a 1 second delay
        run_app_background 0 1
 
-       sleep 1
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -418,8 +419,11 @@ function test_python_destroy_session()
        enable_python_lttng_event $SESSION_NAME $EVENT_NAME2
        start_lttng_tracing $SESSION_NAME
 
+       # Run 5 times with a 1 second delay
+       run_app_background 0 1
+
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
index c960957f216a217c1a5326911a88df0780455d06..365519dc661b2fe890ca35e63a787287c3360d3a 100755 (executable)
@@ -67,10 +67,8 @@ function start_sessiond()
        if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
                # We have to start it like this so the ulimit -c is used by this
                # process. Also, we collect any error message printed out.
-               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE 2>&1 &
+               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE 2>&1
                status=$?
-               # Wait for sessiond to bootstrap
-               sleep 2
                ok $status "Start session daemon"
        fi
 }
index eb68107d5d08b55e7f77516cdb7ac8bc99db1e0f..40c0a4d960732facd36cb6fb8ce651e936ef786d 100755 (executable)
@@ -89,10 +89,8 @@ function start_sessiond()
        if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
                # We have to start it like this so the ulimit -c is used by this
                # process. Also, we collect any error message printed out.
-               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
+               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
                status=$?
-               # Wait for sessiond to bootstrap
-               sleep 2
                ok $status "Start session daemon"
        fi
 }
index 4ff927646b97e6f347d6508bd836e40128295f1a..fa41b4cbb39e7269b1c18b53f5ecfcac3f1e0a96 100755 (executable)
@@ -76,12 +76,10 @@ function start_sessiond()
        if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
                # We have to start it like this so the ulimit -c is used by this
                # process. Also, we collect any error message printed out.
-               #$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
-               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --verbose-consumer -vvv --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
-               #$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
+               #$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
+               $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --verbose-consumer -vvv --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
+               #$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
                status=$?
-               # Wait for sessiond to bootstrap
-               sleep 2
                ok $status "Start session daemon"
        fi
 }
index 2f4dc275e1878a1dd89c791cd388da7b6fe82e5b..3be0f0f1130958769e8d9298a1945fd441af6742 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
@@ -48,16 +49,20 @@ void create_file(const char *path)
 
 int main(int argc, char **argv)
 {
-       int i, netint;
+       unsigned int i, netint;
        long values[] = { 1, 2, 3 };
        char text[10] = "test";
        double dbl = 2.0;
        float flt = 2222.0;
-       unsigned int nr_iter = 100;
+       int nr_iter = 100;
        useconds_t nr_usec = 0;
        char *tmp_file_path = NULL;
+       bool file_created = false;
 
        if (argc >= 2) {
+               /*
+                * If nr_iter is negative, do an infinite tracing loop.
+                */
                nr_iter = atoi(argv[1]);
        }
 
@@ -70,7 +75,7 @@ int main(int argc, char **argv)
                tmp_file_path = argv[3];
        }
 
-       for (i = 0; i < nr_iter; i++) {
+       for (i = 0; nr_iter < 0 || i < nr_iter; i++) {
                netint = htonl(i);
                tracepoint(tp, tptest, i, netint, values, text, strlen(text), dbl,
                                flt);
@@ -79,8 +84,9 @@ int main(int argc, char **argv)
                 * First loop we create the file if asked to indicate that at least one
                 * tracepoint has been hit.
                 */
-               if (i == 0 && tmp_file_path) {
+               if (!file_created && tmp_file_path) {
                        create_file(tmp_file_path);
+                       file_created = true;
                }
                usleep(nr_usec);
        }
index fe75461fc8603aafce928db1b292ae2cd2a3ea85..c3d8bd4d999edf6736715e20422d7e0044f8e76f 100644 (file)
@@ -311,7 +311,7 @@ function start_lttng_sessiond()
                else
                        $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
                fi
-               #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1 &
+               #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1
                status=$?
                ok $status "Start session daemon"
        fi
This page took 0.037101 seconds and 4 git commands to generate.