]> git.lttng.org Git - lttng-tools.git/commitdiff
Tests: Wait for specific PIDs of background applications
authorKienan Stewart <kstewart@efficios.com>
Thu, 14 Nov 2024 19:28:06 +0000 (14:28 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Dec 2024 15:55:31 +0000 (15:55 +0000)
When running lttng-relayd or any other SUT from utils.sh in a fashion
that doesn't take it out of the test's process tree (e.g. when started
without '-d' or '-b'), `wait` will hang on those processes are well.

Change-Id: I82e0365d5165088980c0fce8e451fa0557ee201a
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
18 files changed:
tests/destructive/metadata-regeneration
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/live/test_ust_tracefile_count
tests/regression/tools/mi/test_mi
tests/regression/tools/regen-metadata/test_ust
tests/regression/tools/relayd-grouping/test_ust
tests/regression/tools/snapshots/ust_test
tests/regression/tools/streaming/test_high_throughput_limits
tests/regression/tools/streaming/test_ust
tests/regression/ust/before-after/test_before_after
tests/regression/ust/buffers-pid/test_buffers_pid
tests/regression/ust/high-throughput/test_high_throughput
tests/regression/ust/java-jul/test_java_jul
tests/regression/ust/java-log4j/test_java_log4j
tests/regression/ust/java-log4j2/test_agent_log4j2_domain_log4j
tests/regression/ust/java-log4j2/test_agent_log4j2_domain_log4j2
tests/regression/ust/multi-session/test_multi_session
tests/regression/ust/python-logging/test_python_logging.in

index 5daa21b168c8447a38c7c7cd6cc4e21e8cf1b376..23c216e54c23c93216ae7e1a25913b0dbe838e05 100755 (executable)
@@ -126,7 +126,7 @@ function test_ust_local ()
 
        touch "${file_sync_before_last}"
        # Wait for the applications started in background
-       wait
+       wait "${!}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        validate_trace_date $DATE1 "$TRACE_PATH"
@@ -168,7 +168,7 @@ function test_ust_streaming ()
        touch "${file_sync_before_last}"
 
        # Wait for the applications started in background
-       wait
+       wait "${!}"
        stop_lttng_tracing_ok $SESSION_NAME
        validate_trace_date $DATE1 $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
 
index 69347a2b273c863b62c120db46ebcf82afd274c3..0dead2096478bd567bc534b2de7c61c6b133cf76 100755 (executable)
@@ -122,6 +122,7 @@ function test_exclusion_tracing_started
        $TESTAPP_BIN -i 1 -w 10000 \
                --create-in-main ${file_create_in_main} \
                --wait-before-first-event ${file_wait_before_first} 2>&1 &
+       tracee_pids+=("${!}")
 
        while [ ! -f "${file_create_in_main}" ]; do
                sleep 0.5
@@ -136,7 +137,8 @@ function test_exclusion_tracing_started
        touch ${file_wait_before_first}
 
        # Wait for the testapp to finish.
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok $SESSION_NAME
 
@@ -183,6 +185,7 @@ print_test_banner "$TEST_DESC"
 bail_out_if_no_babeltrace
 
 start_lttng_sessiond
+tracee_pids=()
 
 diag "Enable event without exclusion"
 dry_run
index 3225b65d6ecdb5de962d7449ca0155d42becda00..bf6d6d1d3eb0ae665e90d63342275001798cedda 100755 (executable)
@@ -52,9 +52,7 @@ start_lttng_relayd_notap "-o $TRACE_PATH"
 
 setup_live_tracing
 
-# Run app in background
 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
-
 while [ ! -f "${file_sync_after_first}" ]; do
        sleep 0.5
 done
@@ -62,9 +60,6 @@ done
 # Start the live test
 $TESTDIR/regression/tools/live/live_test
 
-# Wait for the applications started in background
-wait
-
 clean_live_tracing
 
 rm -f ${file_sync_after_first}
index faeb3d09bc5f7bac534cfa742e26ad7771233fb5..39f082e6ccf72999e9bf36ae3d5701595ed99fd0 100755 (executable)
@@ -538,6 +538,7 @@ function test_list_ust_event ()
 
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+       local pid
 
        OUTPUT_FILE="list_ust_event.xml"
 
@@ -548,6 +549,7 @@ function test_list_ust_event ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} & 2>/dev/null
+       pid="${!}"
 
        while [ ! -f "${file_sync_after_first}" ]; do
                sleep 0.5
@@ -577,8 +579,7 @@ function test_list_ust_event ()
        test "$num" -ge "12"
        ok $? "Mi test: $num / 12 ust event fields discovered"
 
-       #Wait for all background processes
-       wait
+       wait "${pid}"
 
        rm -f ${file_sync_after_first}
        rm -f ${file_sync_before_last}
index a482213236073c4c9a0ef310d402a1afd29afbdd..54931b7206a368a2eabd5b058a58e069207a7efe 100755 (executable)
@@ -42,6 +42,7 @@ function test_ust_streaming ()
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
        local metadata_path
+       local pid
 
        diag "Test UST streaming with metadata regeneration"
        create_lttng_session_uri $SESSION_NAME net://localhost
@@ -50,13 +51,14 @@ function test_ust_streaming ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+       pid="${!}"
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${pid}"
 
        # Expect a valid trace
        stop_lttng_tracing_ok $SESSION_NAME
@@ -86,6 +88,7 @@ function test_ust_local ()
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
        local metadata_path
+       local pid
 
        diag "Test UST local with metadata regeneration"
        create_lttng_session_ok $SESSION_NAME $TRACE_PATH
@@ -94,13 +97,14 @@ function test_ust_local ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 &
+       pid="${!}"
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${pid}"
 
        # Expect a valid trace
        stop_lttng_tracing_ok $SESSION_NAME
@@ -129,6 +133,7 @@ function test_ust_pid ()
 {
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+       local pid
 
        diag "Test UST per-pid with metadata regeneration (expect failure)"
        create_lttng_session_ok $SESSION_NAME $TRACE_PATH
@@ -138,13 +143,14 @@ function test_ust_pid ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+       pid="${!}"
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${pid}"
        regenerate_metadata_fail $SESSION_NAME
 
        stop_lttng_tracing_ok $SESSION_NAME
@@ -163,6 +169,7 @@ function test_ust_live ()
 {
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+       local pid
 
        diag "Test UST live with metadata regeneration (expect failure)"
        create_lttng_session_uri $SESSION_NAME net://localhost --live
@@ -171,13 +178,14 @@ function test_ust_live ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+       pid="${!}"
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${pid}"
        regenerate_metadata_fail $SESSION_NAME
 
        stop_lttng_tracing_ok $SESSION_NAME
index 8e2dca9cccef08696623a5bfcd1c5314d2cdefdf..6615652830ed1e3b2756080c2dbcb707f5880682 100755 (executable)
@@ -389,6 +389,7 @@ function test_ust_pid_streaming_snapshot ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
                --sync-after-first-event "$file_sync_after_first" \
                --sync-before-last-event "$file_sync_before_last" 2>&1 &
+       pid="${!}"
 
        while [ ! -f "${file_sync_after_first}" ]; do
                sleep 0.5
@@ -397,7 +398,7 @@ function test_ust_pid_streaming_snapshot ()
        lttng_snapshot_record "$session_name"
 
        touch "$file_sync_before_last"
-       wait
+       wait "${pid}"
 
        stop_lttng_tracing_ok "$session_name"
        destroy_lttng_session_ok "$session_name" --no-wait
index e495498045d19c9d54de4131b069ae6cbe081ad0..97f201442041fda50227a4d873a82126b914b628 100755 (executable)
@@ -63,10 +63,12 @@ function wait_test_apps()
 
 function stop_test_apps()
 {
-       diag "Stopping $TESTAPP_NAME"
-       kill "${APPS_PID[@]}"
-       wait "${APPS_PID[@]}"
-       APPS_PID=()
+       if [[ -n "${APPS_PID[*]}" ]]; then
+               diag "Stopping $TESTAPP_NAME"
+               kill "${APPS_PID[@]}"
+               wait "${APPS_PID[@]}"
+               APPS_PID=()
+       fi
 }
 
 function snapshot_add_output ()
index cf3a40ddc8d1a33766e64ec00511b65edf9b8119..b8b01ccb8a955a9a1afd0e2895d44aea2c925b58 100755 (executable)
@@ -105,6 +105,7 @@ function run_apps
                # the status reply from the consumer quite slow thus delaying the
                # registration done message.
                LTTNG_UST_REGISTER_TIMEOUT=-1 $TESTAPP_BIN -i "$NR_ITER" >/dev/null 2>&1 &
+               tracee_pids+=("${!}")
        done
 }
 
@@ -116,7 +117,8 @@ function test_high_throughput
        start_lttng_tracing_ok $SESSION_NAME
        run_apps
        diag "Waiting for applications to end"
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
        pass "waiting done"
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -179,6 +181,7 @@ check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
        trap interrupt_cleanup SIGTERM SIGINT
 
        BW_LIMITS=(3200 400 100)
+       tracee_pids=()
        for BW in "${BW_LIMITS[@]}";
        do
                diag "Test high-throughput with bandwidth limit set to ${BW}kbits"
index 27f6b679bc551abc8fdfa92677bc63b3031e4cd0..80b461b346570cb5a701fea6f77bb8d792517be0 100755 (executable)
@@ -31,6 +31,7 @@ fi
 function test_ust_before_start ()
 {
        local file_sync_before_last=$(mktemp -u -t "tmp.test_${FUNCNAME[0]}_sync_before_last.XXXXXX")
+       local tracee_pids=()
 
        diag "Test UST streaming BEFORE tracing starts"
        create_lttng_session_uri $SESSION_NAME net://localhost
@@ -38,13 +39,14 @@ function test_ust_before_start ()
 
        # Run 5 times with a 1 second delay
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 &
+       tracee_pids+=("${!}")
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -54,6 +56,7 @@ function test_ust_before_start ()
 function test_ust_after_start ()
 {
        local file_sync_after_first=$(mktemp -u -t "tmp.test_${FUNCNAME[0]}_sync_after_first.XXXXXX")
+       local tracee_pids=()
 
        diag "Test UST streaming AFTER tracing starts"
        create_lttng_session_uri $SESSION_NAME net://localhost
@@ -62,7 +65,8 @@ function test_ust_after_start ()
 
        # Run 5 times with a 1 second delay
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
-               --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
+                    --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
+       tracee_pids+=("${!}")
 
        while [ ! -f "${file_sync_after_first}" ]; do
                sleep 0.5
@@ -72,7 +76,7 @@ function test_ust_after_start ()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
        rm -f ${file_sync_after_first}
 }
 
index f7b95477964fbe627d9fd084ac86ff1a644a7528..f81c2b5131ffb6bd0b221f04931c84c6fece27eb 100755 (executable)
@@ -33,7 +33,7 @@ function test_before_apps()
        start_lttng_tracing_ok $SESSION_NAME
 
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
-       wait
+       wait "${!}"
        ok $? "Traced application stopped."
 
        stop_lttng_tracing_ok $SESSION_NAME
@@ -62,7 +62,7 @@ function test_after_apps()
 
        touch ${file_sync_before_last}
 
-       wait
+       wait "${!}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
index a18cdbf059a71ab8c00c4ac1fd135272556e06be..fcc8a871e783dac52ef096a49eb0c7284dc2d8f7 100755 (executable)
@@ -38,6 +38,7 @@ function enable_channel_per_pid()
 test_after_multiple_apps() {
        local out
        local i
+       local tracee_pids=()
 
        diag "Start multiple applications AFTER tracing is started"
 
@@ -50,8 +51,9 @@ test_after_multiple_apps() {
        for i in `seq 1 5`; do
                $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 &
                ok $? "Start application $i for tracing"
+               tracee_pids+=("${!}")
        done
-       wait
+       wait "${tracee_pids[@]}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -64,6 +66,7 @@ test_after_multiple_apps() {
 test_before_multiple_apps() {
        local out
        local i
+       local tracee_pids=()
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
 
@@ -74,6 +77,7 @@ test_before_multiple_apps() {
                        --sync-after-first-event ${file_sync_after_first}_${i} \
                        --sync-before-last-event ${file_sync_before_last}_${i} >/dev/null 2>&1 &
                ok $? "Start application $i for tracing"
+               tracee_pids+=("${!}")
        done
 
        # BEFORE application is spawned
@@ -87,7 +91,7 @@ test_before_multiple_apps() {
        done
 
        diag "Waiting for applications to end"
-       wait
+       wait "${tracee_pids[@]}"
        pass "Waiting done"
 
        stop_lttng_tracing_ok $SESSION_NAME
@@ -125,7 +129,7 @@ test_after_app() {
 
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
        ok $? "Start application to trace"
-       wait
+       wait "${!}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -137,6 +141,7 @@ test_after_app() {
 
 test_before_app() {
        local out
+       local pid
        local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
        local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
 
@@ -152,12 +157,13 @@ test_before_app() {
                --sync-after-first-event ${file_sync_after_first} \
                --sync-before-last-event ${file_sync_before_last} &
        ok $? "Start application to trace"
+       pid="${!}"
 
        start_lttng_tracing_ok $SESSION_NAME
 
        touch ${file_sync_before_last}
 
-       wait
+       wait "${pid}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -206,7 +212,7 @@ test_multiple_channels() {
 
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
        ok $? "Start application to trace"
-       wait
+       wait "${!}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        trace_match_only $EVENT_NAME $[NR_ITER * 5] $TRACE_PATH
index 750445a48ffd74c1e69d3b41d6745c83c7d13d4e..7ddfc416cc092cfb2b5bde5c2ac1cb804161a6e1 100755 (executable)
@@ -37,12 +37,14 @@ create_lttng_session_ok $SESSION_NAME $TRACE_PATH
 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
 start_lttng_tracing_ok $SESSION_NAME
 
+pids=()
 for i in `seq 1 $NR_APP`; do
        ./$CURDIR/$BIN_NAME >/dev/null 2>&1 &
+       pids+=("${!}")
 done
 
 diag "Waiting for applications to end"
-wait
+wait "${pids[@]}"
 pass "Wait for applications to end"
 
 stop_lttng_tracing_ok $SESSION_NAME
index 41e2656ffbc09590a747f44b83949b80c7f1598e..a4bc852069d1015ec585d516ff9d46f4a3bc92ec 100755 (executable)
@@ -34,6 +34,7 @@ function run_app
 function run_app_background
 {
        run_app $@ &
+       tracee_pids+=("${!}")
 }
 
 function enable_jul_loglevel_only()
@@ -94,7 +95,8 @@ function test_jul_before_start ()
        touch ${file_sync_before_last}
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -511,7 +513,7 @@ function test_jul_destroy_session()
        run_app_background 0 1
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -530,7 +532,7 @@ function test_jul_destroy_session()
        run_app_background 0 1
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -670,6 +672,7 @@ else
        withapp=1
 fi
 
+tracee_pids=()
 skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
 {
        start_lttng_sessiond
index fc857b1bdf75487c21995c4bb260306a56e7f565..b2e55c434bcfb74f3499a695bb9f39cafd87c0c5 100755 (executable)
@@ -47,6 +47,7 @@ function run_app
 function run_app_background
 {
        run_app "${@}" &
+       tracee_pids+=("${!}")
 }
 
 
@@ -72,7 +73,8 @@ function test_log4j_before_start ()
        touch "${file_sync_before_last}"
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -421,7 +423,8 @@ function test_log4j_destroy_session()
        # Run 5 times with a 1 second delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -436,7 +439,8 @@ function test_log4j_destroy_session()
        # Run 5 times with a 1 second delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -577,6 +581,7 @@ tests=(
        test_log4j_filter_loglevel
 )
 
+tracee_pids=()
 for fct_test in "${tests[@]}";
 do
        TRACE_PATH=$(mktemp -d -t tmp.test_java_log4j_trace_path.XXXXXX)
index 862e4be987941d28f450443ce5b01e801181f9bd..0d8b392b4a032189d1871604895a7ff7b981e3fc 100755 (executable)
@@ -48,6 +48,7 @@ function run_app
 function run_app_background
 {
        run_app "${@}" &
+       tracee_pids+=("${!}")
 }
 
 
@@ -73,7 +74,8 @@ function test_log4j2_before_start ()
        touch "${file_sync_before_last}"
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_before_start"
        destroy_lttng_session_ok "log4j2_before_start"
@@ -422,7 +424,8 @@ function test_log4j2_destroy_session()
        # Run 5 times with a 1ms delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_destroy_session"
        destroy_lttng_session_ok "log4j2_destroy_session"
@@ -437,7 +440,8 @@ function test_log4j2_destroy_session()
        # Run 5 times with a 1ms delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_destroy_session"
        destroy_lttng_session_ok "log4j2_destroy_session"
@@ -578,6 +582,7 @@ tests=(
        test_log4j2_filter_loglevel
 )
 
+tracee_pids=()
 for fct_test in "${tests[@]}";
 do
        TRACE_PATH=$(mktemp -d -t tmp.test_java_log4j2_trace_path.XXXXXX)
index c9b12d137993057ac3f512efa3ae3cd4681debf1..1e3fa44e23b7615f75a8341d393603ce67bc97ea 100755 (executable)
@@ -51,6 +51,7 @@ function run_app
 function run_app_background
 {
        run_app "${@}" &
+       tracee_pids+=("${!}")
 }
 
 
@@ -76,7 +77,8 @@ function test_log4j2_before_start ()
        touch "${file_sync_before_last}"
 
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_before_start"
        destroy_lttng_session_ok "log4j2_before_start"
@@ -425,7 +427,8 @@ function test_log4j2_destroy_session()
        # Run 5 times with a 1ms delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_destroy_session"
        destroy_lttng_session_ok "log4j2_destroy_session"
@@ -440,7 +443,8 @@ function test_log4j2_destroy_session()
        # Run 5 times with a 1ms delay
        run_app_background 0 1
        # Wait for the applications started in background
-       wait
+       wait "${tracee_pids[@]}"
+       tracee_pids=()
 
        stop_lttng_tracing_ok "log4j2_destroy_session"
        destroy_lttng_session_ok "log4j2_destroy_session"
@@ -581,6 +585,7 @@ tests=(
        test_log4j2_filter_loglevel
 )
 
+tracee_pids=()
 for fct_test in "${tests[@]}";
 do
        TRACE_PATH=$(mktemp --tmpdir -d tmp.test_java_log4j2_trace_path.XXXXXX)
index e407859c455c1a6349cc5df781f2f10125cb3c9d..7571e43bb8c417ceb295607dbfcdd5f600d574ba 100755 (executable)
@@ -34,8 +34,7 @@ test_multi_session() {
 
        "./$CURDIR/gen-nevents" $NR_ITER &
        ok $? "Start application to generate $NR_ITER events"
-
-       wait
+       wait "${!}"
        pass "Wait for events to record"
 
        for i in $(seq 0 3); do
index dc7cfaba65d41785e5fd1cd60b5a031626c3c8c8..c5ac818d083da5147edfd54d208e155ca72a0715 100755 (executable)
@@ -61,6 +61,7 @@ function run_app
 function run_app_background
 {
        run_app "$@" &
+       tracee_pids+=("${!}")
 }
 
 function enable_python_loglevel_only()
@@ -129,7 +130,7 @@ function test_python_before_start ()
 
        # Wait for the applications started in background
        echo "1" > ${go_file}
-       wait
+       wait "${tracee_pids[@]}"
 
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
@@ -762,6 +763,7 @@ else
        skip_agent=1
 fi
 
+tracee_pids=()
 skip $skip_agent "Python agent test skipped." $NUM_TESTS ||
 {
        start_lttng_sessiond
This page took 0.041508 seconds and 4 git commands to generate.