From cdcf8972424da5cba4c0210d7fdfa2e7123aa748 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Wed, 6 Sep 2023 11:56:45 -0400 Subject: [PATCH] tests: Use destroy with no-wait during filter tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Motivation ========== The regression/tool/sfiltering/test_valid_filter test is one of the longest running tests in the test suite, largely due to the number of filters tested. The session destroy step for each test takes in the order of 500-600ms on my development machine and accounts for an important sum of time across a run as each filter test will create and destroy a session. Solution ======== By passing "--no-wait" to the session destroy command, the step time is reduced from 500-600ms to ~20ms. The overall test time is reduced (when running without root tests) from ~150s to ~40s. Using "--no-wait" with the session destroy seems safe in this case as the session stop is called before, which will finalize the writes to disk. Known drawbacks =============== The patch causes errors similar to the following to be logged to stderr: ``` PERROR - 11:55:26.730314528 [Rotation]: sendmsg: Broken pipe (in lttcomm_send_unix_sock() at unix.cpp:300) Error: Failed to send result of the destruction of session "valid_filter" to client ``` Change-Id: Ic005116bbe910cb3da3e99aa85dc90244ed72f5b Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- tests/regression/tools/filtering/test_valid_filter | 2 +- tests/utils/utils.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index cd5b1a3b9..0c7ac0bdd 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -110,7 +110,7 @@ function test_valid_filter stop_lttng_tracing_ok $SESSION_NAME # Destroy session - destroy_lttng_session_ok $SESSION_NAME + destroy_lttng_session_ok $SESSION_NAME --no-wait stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name` diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 27816dedd..c1d702e82 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1691,9 +1691,10 @@ function destroy_lttng_session () local withtap=$1 local expected_to_fail=$2 local sess_name=$3 + shift 3 _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ - destroy $sess_name + destroy $sess_name $@ ret=$? if [[ $expected_to_fail -eq "1" ]]; then test "$ret" -ne "0" -- 2.34.1