Tests: regression testing for lttng-relayd --group-output-by-*
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 19 Sep 2019 21:00:51 +0000 (17:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 8 Nov 2019 22:33:41 +0000 (17:33 -0500)
Each test is run for --group-output-by-host and
--group-output-by-session and also with automatic session name and
specific session name.

No need to test against kernel. Tracing domain does not have any influence
at lttng-relayd level.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/regression/Makefile.am
tests/regression/tools/Makefile.am
tests/regression/tools/relayd-grouping/Makefile.am [new file with mode: 0644]
tests/regression/tools/relayd-grouping/test_ust [new file with mode: 0755]

index c2176cb4e6cb5bff3431af03c0a778769bbda04f..e75ad55d0d531bd7111ef7f2ac39fd7d21962a94 100644 (file)
@@ -1167,6 +1167,7 @@ AC_CONFIG_FILES([
        tests/regression/tools/base-path/Makefile
        tests/regression/tools/metadata/Makefile
        tests/regression/tools/working-directory/Makefile
+       tests/regression/tools/relayd-grouping/Makefile
        tests/regression/ust/Makefile
        tests/regression/ust/nprocesses/Makefile
        tests/regression/ust/high-throughput/Makefile
index df5ae0943a4b614e69e0a4f661a6e92f9c897fc7..874e0c08b5995f59573a6251075a2557a4c20d13 100644 (file)
@@ -55,7 +55,8 @@ TESTS += ust/before-after/test_before_after \
        ust/rotation-destroy-flush/test_rotation_destroy_flush \
        ust/namespaces/test_ns_contexts \
        ust/namespaces/test_ns_contexts_change \
-       tools/metadata/test_ust
+       tools/metadata/test_ust \
+       tools/relayd-grouping/test_ust
 endif # HAVE_LIBLTTNG_UST_CTL
 
 if PYTHON_BINDING
index 6fd5f35057cadefc4880d17720d63aa6eb29af08..032ade6e7f43c8ca2d684963cc45bd2684b0d1e6 100644 (file)
@@ -1,3 +1,3 @@
 SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \
                wildcard crash regen-metadata regen-statedump notification rotation \
-               base-path metadata working-directory
+               base-path metadata working-directory relayd-grouping
diff --git a/tests/regression/tools/relayd-grouping/Makefile.am b/tests/regression/tools/relayd-grouping/Makefile.am
new file mode 100644 (file)
index 0000000..9885af1
--- /dev/null
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_ust
+EXTRA_DIST = test_ust
+
+all-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       cp -f $(srcdir)/$$script $(builddir); \
+               done; \
+       fi
+
+clean-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       rm -f $(builddir)/$$script; \
+               done; \
+       fi
diff --git a/tests/regression/tools/relayd-grouping/test_ust b/tests/regression/tools/relayd-grouping/test_ust
new file mode 100755 (executable)
index 0000000..6c7eb98
--- /dev/null
@@ -0,0 +1,710 @@
+#!/bin/bash
+#
+# 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
+
+TEST_DESC="LTTng relayd filesystem grouping - Userspace tracing"
+
+CURDIR=$(dirname "$0")/
+TESTDIR=$CURDIR/../../..
+NR_ITER=10
+NR_USEC_WAIT=100
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+EVENT_NAME="tp:tptest"
+CHANNEL_NAME="my_channel"
+
+XSD_PATH=$TESTDIR/../src/common/mi-lttng-3.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"
+
+if [ ! -x "$TESTAPP_BIN" ]; then
+       BAIL_OUT "No UST events binary detected."
+fi
+
+function get_auto_session_name ()
+{
+       local __result=$1
+
+       local lttng_bin=$LTTNG_BIN
+
+       LTTNG_BIN="${lttng_bin} --mi xml"
+       OUTPUT_DEST=$(mktemp)
+
+       list_lttng_with_opts
+       $XML_VALIDATE "$OUTPUT_DEST"
+       ok $? "Valid lttng list XML"
+
+       value=$($XML_EXTRACT "$OUTPUT_DEST" ${XPATH_SESSION}/lttng:name/text\(\))
+       ok $? "Extraction of session name"
+       OUTPUT_DEST=/dev/null
+       LTTNG_BIN=$lttng_bin
+
+       # Transfer value to passed arguments
+       eval "$__result='$value'"
+}
+
+function test_ust_uid_live ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer live [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost --live
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_pid_live ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer live [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost --live
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-pid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_live_custom_output ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local custom_output="my_live_custom_output"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer live, custom output [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost/$custom_output --live
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$custom_output"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer streaming [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_pid_streaming ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer streaming [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-pid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_custom_output ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local custom_output="custom_second_token"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer streaming, custom output [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost/$custom_output
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$custom_output"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_rotate ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer rotate [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       rotate_session_ok "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_rotate_custom_output ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local custom_output="rotate_custom_path"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer rotate, custom output [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost/$custom_output
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       rotate_session_ok "$session_name"
+
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$custom_output"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_pid_streaming_rotate ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer rotate with session_name [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-pid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       rotate_session_ok "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_snapshot ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer snapshot streaming using 'create --snapshot' [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost --snapshot
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-uid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       lttng_snapshot_record "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_pid_streaming_snapshot ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       local file_sync_after_first
+       local file_sync_before_last
+
+       file_sync_after_first=$(mktemp -u)
+       file_sync_before_last=$(mktemp -u)
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer snapshot streaming using 'create --snapshot' [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_uri "$session_name" net://localhost --snapshot
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_ust_lttng_channel_ok "$session_name" "$CHANNEL_NAME" "--buffers-pid"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT "$file_sync_after_first" "$file_sync_before_last" /dev/null 2>&1 &
+
+       while [ ! -f "${file_sync_after_first}" ]; do
+               sleep 0.5
+       done
+
+       lttng_snapshot_record "$session_name"
+
+       touch "$file_sync_before_last"
+       wait
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/snapshot-1*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*/snapshot-1*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+
+       rm -f "$file_sync_after_first"
+       rm -f "$file_sync_before_last"
+}
+
+function test_ust_uid_streaming_snapshot_add_output_default_name ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer snapshot using 'add-output' with default snapshot name [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_no_output "$session_name"
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_lttng_mmap_overwrite_ust_channel "$session_name" "$CHANNEL_NAME"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       lttng_snapshot_add_output_ok "$session_name" "net://localhost"
+       lttng_snapshot_record "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/snapshot-1*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*/snapshot-1*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_snapshot_add_output_custom_name ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local snapshot_name="this_is_my_snapshot"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer snapshot using 'add-output' with custom snapshot name [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_no_output "$session_name"
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_lttng_mmap_overwrite_ust_channel "$session_name" "$CHANNEL_NAME"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       lttng_snapshot_add_output_ok "$session_name" "net://localhost" "-n $snapshot_name"
+       lttng_snapshot_record "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$snapshot_name*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$session_name*/$snapshot_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+function test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output ()
+{
+       local session_name="$1"
+       local grouping="$2"
+       local snapshot_name="this_is_my_snapshot"
+       local custom_output="this/is/my/custom/path"
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer snapshot using 'add-output' with custom snapshot name and custom output path [$grouping][${session_name:-automatic session name}]"
+
+       create_lttng_session_no_output "$session_name"
+       if [ "$is_automatic_session" = true ]; then
+               get_auto_session_name session_name
+       fi
+
+       enable_lttng_mmap_overwrite_ust_channel "$session_name" "$CHANNEL_NAME"
+       enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME"
+       start_lttng_tracing_ok "$session_name"
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+
+       lttng_snapshot_add_output_ok "$session_name" "net://localhost/$custom_output" "-n $snapshot_name"
+       lttng_snapshot_record "$session_name"
+
+       stop_lttng_tracing_ok "$session_name"
+       destroy_lttng_session_ok "$session_name"
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$session_name/$HOSTNAME-*/$custom_output/$snapshot_name*"
+       else
+               validate_trace "$EVENT_NAME" "$TRACE_PATH/$HOSTNAME/$custom_output/$snapshot_name*"
+       fi
+
+       if [ "$grouping" = "$GROUP_BY_SESSION" ]; then
+               rm -rf "${TRACE_PATH:?}/$session_name"
+       else
+               rm -rf "${TRACE_PATH:?}/$HOSTNAME"
+       fi
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+
+tests=(
+       test_ust_uid_live
+       test_ust_pid_live
+       test_ust_uid_live_custom_output
+       test_ust_uid_streaming
+       test_ust_pid_streaming
+       test_ust_uid_streaming_custom_output
+       test_ust_uid_streaming_rotate
+       test_ust_uid_streaming_rotate_custom_output
+       test_ust_pid_streaming_rotate
+       test_ust_uid_streaming_snapshot
+       test_ust_pid_streaming_snapshot
+       test_ust_uid_streaming_snapshot_add_output_default_name
+       test_ust_uid_streaming_snapshot_add_output_custom_name
+       test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output
+)
+
+GROUP_BY_SESSION="--group-output-by-session"
+GROUP_BY_HOSTNAME="--group-output-by-host"
+
+grouping_types=(
+       $GROUP_BY_SESSION
+       $GROUP_BY_HOSTNAME
+)
+for fct_test in "${tests[@]}";
+do
+       for grouping in "${grouping_types[@]}";
+       do
+               TRACE_PATH=$(mktemp -d)
+               # Set the relayd in --group-output-by-session mode
+               start_lttng_relayd "-o $TRACE_PATH $grouping"
+               start_lttng_sessiond
+
+               name=""
+               # Perform test when session name is generated by the client
+               ${fct_test} "$name" "$grouping"
+               count=$(find "$TRACE_PATH/" -maxdepth 1 -mindepth 1 | wc -l)
+               is "$count" "0" "LTTng-relayd output directory empty"
+
+               # Perform test when session name is given
+               name="my-session"
+               ${fct_test} "$name" "$grouping"
+               count=$(find "$TRACE_PATH/" -maxdepth 1 -mindepth 1 | wc -l)
+               is "$count" "0" "LTTng-relayd output directory empty"
+
+               rm -rf "$TRACE_PATH"
+               stop_lttng_relayd
+               stop_lttng_sessiond
+       done
+done
+
This page took 0.048083 seconds and 4 git commands to generate.