From: Kienan Stewart Date: Tue, 19 Dec 2023 19:01:47 +0000 (-0500) Subject: tests: tools/clear/test_ust wait for specific test app pid X-Git-Tag: v2.13.12~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f03ea3f43450abb1a1ea704044e1e8c78cfc0b4c;p=lttng-tools.git tests: tools/clear/test_ust wait for specific test app pid Observed issue ============== When debugging failing tests manually, one step that is sometimes done is to quickly swap the commands that start the relay or sessiond in `tests/utils/utils.sh` (eg. in `start_lttng_relayd_opt`) for the version which uses a verbose output to a logfile. When doing this, the `relayd` wasn't using the background `process_mode`, and was a child of the running test. This caused `test_ust_local_snapshot_per_pid` in `tests/regression/tools/clear/test_ust` to hang as it waited for all child processes to terminate. Solution ======== The test has been updated to wait for only the specific test application pid. Known drawbacks =============== None. Change-Id: I8761649a52fceda92a5545c71818dc2eb027bfcf Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/tools/clear/test_ust b/tests/regression/tools/clear/test_ust index efff8fcee..378a4ed41 100755 --- a/tests/regression/tools/clear/test_ust +++ b/tests/regression/tools/clear/test_ust @@ -637,6 +637,7 @@ function test_ust_local_snapshot_per_pid () --sync-before-last-event-touch ${file_sync_before_last_touch} \ --sync-before-exit ${file_sync_before_exit} \ --sync-before-exit-touch ${file_sync_before_exit_touch} >/dev/null 2>&1 & + local app_pid="${!}" # Continue only when there is only the last event remaining. while [ ! -f "${file_sync_before_last_touch}" ]; do @@ -680,7 +681,7 @@ function test_ust_local_snapshot_per_pid () # Release the application. touch ${file_sync_before_exit} - wait + wait "${app_pid}" destroy_lttng_session_ok $SESSION_NAME rm -f ${file_sync_before_last} diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index faa87e783..48a60fe9b 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -623,7 +623,7 @@ function start_lttng_relayd_opt() if [ -z $(lttng_pgrep "$RELAYD_MATCH") ]; then # shellcheck disable=SC2086 $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST - #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 & + #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode $opt -vvv >>/tmp/relayd.log 2>&1 & if [ $? -eq 1 ]; then if [ $withtap -eq "1" ]; then fail "Start lttng-relayd (process mode: $process_mode opt: $opt)"