tests: Use `--no-wait` when destroying sessions in relayd-grouping
[lttng-tools.git] / tests / regression / tools / relayd-grouping / test_ust
index 5749f5a475ed84048091ab17fa9581c332d600ce..fe40bd5510a24d8e8fb875263647429b42121e21 100755 (executable)
@@ -1,19 +1,8 @@
 #!/bin/bash
 #
-# Copyright (C) 2018 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+# Copyright (C) 2018 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
 #
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+# SPDX-License-Identifier: LGPL-2.1-only
 
 TEST_DESC="LTTng relayd filesystem grouping - Userspace tracing"
 
@@ -27,15 +16,9 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 EVENT_NAME="tp:tptest"
 CHANNEL_NAME="my_channel"
 
-XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd
-
-XML_VALIDATE="$TESTDIR/regression/tools/mi/validate_xml $XSD_PATH"
-XML_EXTRACT="$TESTDIR/regression/tools/mi/extract_xml"
-
 XPATH_CMD_OUTPUT="//lttng:command/lttng:output"
 XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session"
 
-
 NUM_TESTS=688
 
 source "$TESTDIR/utils/utils.sh"
@@ -51,14 +34,15 @@ function get_auto_session_name ()
        local lttng_bin=$LTTNG_BIN
 
        LTTNG_BIN="${lttng_bin} --mi xml"
-       OUTPUT_DEST=$(mktemp)
+       OUTPUT_DEST=$(mktemp -t "tmp.${FUNCNAME[0]}_output.XXXXXX")
 
-       list_lttng_with_opts
-       $XML_VALIDATE "$OUTPUT_DEST"
+       list_lttng_ok
+       $MI_VALIDATE "$OUTPUT_DEST"
        ok $? "Valid lttng list XML"
 
        value=$($XML_EXTRACT "$OUTPUT_DEST" ${XPATH_SESSION}/lttng:name/text\(\))
        ok $? "Extraction of session name"
+       rm -f $OUTPUT_DEST
        OUTPUT_DEST=/dev/null
        LTTNG_BIN=$lttng_bin
 
@@ -90,7 +74,7 @@ function test_ust_uid_live ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -129,7 +113,7 @@ function test_ust_pid_live ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -169,7 +153,7 @@ function test_ust_uid_live_custom_output ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
@@ -208,7 +192,7 @@ function test_ust_uid_streaming ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -247,7 +231,7 @@ function test_ust_pid_streaming ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -287,7 +271,7 @@ function test_ust_uid_streaming_custom_output ()
        $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
@@ -327,7 +311,7 @@ function test_ust_uid_streaming_rotate ()
        rotate_session_ok "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -369,7 +353,7 @@ function test_ust_uid_streaming_rotate_custom_output ()
 
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
@@ -409,7 +393,7 @@ function test_ust_pid_streaming_rotate ()
        rotate_session_ok "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -449,7 +433,7 @@ function test_ust_uid_streaming_snapshot ()
        lttng_snapshot_record "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
@@ -473,8 +457,8 @@ function test_ust_pid_streaming_snapshot ()
        local file_sync_after_first
        local file_sync_before_last
 
-       file_sync_after_first=$(mktemp -u)
-       file_sync_before_last=$(mktemp -u)
+       file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
+       file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
 
        if [ -z "$session_name" ]; then
                is_automatic_session=true
@@ -505,7 +489,7 @@ function test_ust_pid_streaming_snapshot ()
        wait
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/snapshot-1*"
@@ -550,7 +534,7 @@ function test_ust_uid_streaming_snapshot_add_output_default_name ()
        lttng_snapshot_record "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/snapshot-1*"
@@ -593,7 +577,7 @@ function test_ust_uid_streaming_snapshot_add_output_custom_name ()
        lttng_snapshot_record "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        # When session name is automatic, the actual directory is "auto", not
        # auto-<datetime>.
@@ -639,7 +623,7 @@ function test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output ()
        lttng_snapshot_record "$session_name"
 
        stop_lttng_tracing_ok "$session_name"
-       destroy_lttng_session_ok "$session_name"
+       destroy_lttng_session_ok "$session_name" --no-wait
 
        if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
                validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output/$snapshot_name*"
@@ -658,6 +642,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
 
 tests=(
        test_ust_uid_live
@@ -687,7 +672,7 @@ for fct_test in "${tests[@]}";
 do
        for grouping in "${grouping_types[@]}";
        do
-               TRACE_PATH=$(mktemp -d)
+               TRACE_PATH=$(mktemp -d -t tmp.test_relayd_grouping_ust_trace_path.XXXXXX)
                # Set the relayd in --group-output-by-session mode
                start_lttng_relayd "-o $TRACE_PATH $grouping"
                start_lttng_sessiond
This page took 0.027705 seconds and 4 git commands to generate.