Backport: Tests: lttng-relayd --group-output-per-session
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Sun, 24 Jun 2018 14:23:29 +0000 (10:23 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 21 Sep 2018 04:00:52 +0000 (00:00 -0400)
Backport: Remove rotation related tests

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@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_kernel [new file with mode: 0755]
tests/regression/tools/relayd-grouping/test_ust [new file with mode: 0755]

index 4697f9bd67e48429675d8e015358b20c33e2a955..6455e574cd8cca23cebd2fe9fc73ca92473f4578 100644 (file)
@@ -1025,6 +1025,7 @@ AC_CONFIG_FILES([
        tests/regression/tools/regen-metadata/Makefile
        tests/regression/tools/regen-statedump/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 8dab7f591e81030e9bf48de263c4c615680d4cdf..1be72094a1fcb826becd1eacc7ae94652baa1946 100644 (file)
@@ -24,7 +24,9 @@ TESTS = tools/filtering/test_invalid_filter \
        tools/crash/test_crash \
        tools/regen-metadata/test_ust \
        tools/regen-statedump/test_ust \
-       tools/working-directory/test_relayd_workding_directory
+       tools/working-directory/test_relayd_workding_directory \
+       tools/relayd-grouping/test_ust \
+       tools/relayd-grouping/test_kernel
 
 if HAVE_LIBLTTNG_UST_CTL
 SUBDIRS += ust
index 8d7f4ff5a962b20e177a056d0c4896d8270c9568..954dfac3b5deac28e3a4026f034f6943d4b53969 100644 (file)
@@ -1,2 +1,2 @@
 SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \
-               wildcard crash regen-metadata regen-statedump working-directory
+               wildcard crash regen-metadata regen-statedump 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..d4a92eb
--- /dev/null
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_ust test_kernel
+EXTRA_DIST = test_ust test_kernel
+
+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_kernel b/tests/regression/tools/relayd-grouping/test_kernel
new file mode 100755 (executable)
index 0000000..2331792
--- /dev/null
@@ -0,0 +1,286 @@
+#!/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 - Kernel tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+EVENT_NAME="lttng_test_filter_event"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=67
+
+source $TESTDIR/utils/utils.sh
+
+function test_kernel_live_static_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+
+       diag "Test kernel live with session name"
+
+       create_lttng_session_uri $session_name net://localhost --live
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_kernel_live_static_name_custom_output ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       local custom_output="my_live_custom_output"
+
+       diag "Test kernel live with session name, custom output"
+
+       create_lttng_session_uri $session_name net://localhost/$custom_output --live
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_kernel_streaming_static_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+
+       diag "Test kernel streaming with session name"
+
+       create_lttng_session_uri $session_name net://localhost
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_kernel_streaming_static_name_custom_output ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       local custom_output="custom_second_token"
+
+       diag "Test kernel streaming with session name, custom output"
+
+       create_lttng_session_uri $session_name net://localhost/$custom_output
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_kernel_streaming_rotate_static_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+
+       diag "Test kernel rotate with session name"
+
+       create_lttng_session_uri $session_name net://localhost
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+       rotate_session_ok $session_name
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_kernel_streaming_rotate_static_name_custom_output ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       local custom_output="rotate_custom_path"
+
+       diag "Test kernel rotate with session name, custom output"
+
+       create_lttng_session_uri $session_name net://localhost/$custom_output
+       lttng_enable_kernel_channel_ok $session_name $channel_name 
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+       rotate_session_ok $session_name
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_kernel_streaming_snapshot_static_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+
+       diag "Test kernel snapshot streaming with session name using 'create --snapshot'"
+
+       create_lttng_session_uri $session_name net://localhost --snapshot
+       lttng_enable_kernel_channel_ok $session_name $channel_name
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+       lttng_snapshot_record $session_name
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1*
+}
+
+function test_kernel_streaming_snapshot_add_output_default_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       diag "Test kernel snapshot using 'add-output' with default snapshot name"
+
+       create_lttng_session_no_output $session_name
+       enable_lttng_mmap_overwrite_kernel_channel $session_name $channel_name
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       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
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1*
+}
+
+function test_kernel_streaming_snapshot_add_output_custom_name ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       local snapshot_name="this_is_my_snapshot"
+       diag "Test kernel snapshot using 'add-output' with custom snapshot name"
+
+       create_lttng_session_no_output $session_name
+       enable_lttng_mmap_overwrite_kernel_channel $session_name $channel_name
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       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
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$snapshot_name*
+}
+
+function test_kernel_streaming_snapshot_add_output_custom_name_custom_output ()
+{
+       local session_name=$(randstring 16 0)
+       local channel_name=$(randstring 8 0)
+       local snapshot_name="this_is_my_snapshot"
+       local custom_output="this/is/my/custom/path"
+       diag "Test kernel snapshot using 'add-output' with custom snapshot name and custom output"
+
+       create_lttng_session_no_output $session_name
+       enable_lttng_mmap_overwrite_kernel_channel $session_name $channel_name
+       enable_kernel_lttng_event_ok $session_name $EVENT_NAME $channel_name
+       start_lttng_tracing_ok $session_name
+
+       echo -n "10" > /proc/lttng-test-filter-event
+
+       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
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output/$snapshot_name*
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+if [ "$(id -u)" == "0" ]; then
+       isroot=1
+else
+       isroot=0
+fi
+
+skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+{
+       validate_lttng_modules_present
+
+       start_lttng_relayd "-o $TRACE_PATH --group-output-by-session"
+       start_lttng_sessiond
+       modprobe lttng-test
+
+       tests=(
+               test_kernel_live_static_name
+               test_kernel_live_static_name_custom_output
+               test_kernel_streaming_static_name
+               test_kernel_streaming_static_name_custom_output
+#              Rotation does not exists on stable 2.9
+#              test_kernel_streaming_rotate_static_name
+#              test_kernel_streaming_rotate_static_name_custom_output
+               test_kernel_streaming_snapshot_static_name
+               test_kernel_streaming_snapshot_add_output_default_name
+               test_kernel_streaming_snapshot_add_output_custom_name
+               test_kernel_streaming_snapshot_add_output_custom_name_custom_output
+       )
+       for fct_test in ${tests[@]};
+       do
+               ${fct_test}
+       done
+
+       rm -rf $TRACE_PATH
+
+       rmmod lttng-test
+       stop_lttng_sessiond
+       stop_lttng_relayd
+}
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..d26c5bc
--- /dev/null
@@ -0,0 +1,662 @@
+#!/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"
+
+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"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=229
+
+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
+
+       LTTNG_BIN="lttng --mi xml"
+       OUTPUT_DEST=$(mktemp -u)
+
+       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"
+
+       eval $__result="'$value'"
+}
+
+function test_ust_uid_live_automatic_name ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer live with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+       set +x
+}
+
+function test_ust_uid_live ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer live with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_pid_live ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer live with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_uid_live_custom_output ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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 with session name, custom output"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_ust_uid_streaming ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer streaming with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_pid_streaming ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer streaming with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_uid_streaming_custom_output ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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 with session name, custom output"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_ust_uid_streaming_rotate ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer rotate with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_uid_streaming_rotate_custom_output ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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 with session name, custom output"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output
+}
+
+function test_ust_pid_streaming_rotate ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer rotate with 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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_uid_streaming_snapshot ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST uid buffer snapshot streaming with session name using 'create --snapshot'"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*
+}
+
+function test_ust_pid_streaming_snapshot ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       local file_sync_after_first=$(mktemp -u)
+       local file_sync_before_last=$(mktemp -u)
+       local is_automatic_session=false
+
+       if [ -z "$session_name" ]; then
+               is_automatic_session=true
+       fi
+
+       diag "Test UST pid buffer snapshot streaming with session name using 'create --snapshot'"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1*
+
+       rm -rf ${file_sync_after_first}
+       rm -rf ${file_sync_before_last}
+}
+
+function test_ust_uid_streaming_snapshot_add_output_default_name ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1*
+}
+
+function test_ust_uid_streaming_snapshot_add_output_custom_name ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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"
+
+       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 [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$snapshot_name*
+}
+
+function test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output ()
+{
+       local session_name="$1"
+       local channel_name=$(randstring 8 0)
+       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"
+
+       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
+
+       # When session name is automatic, the actual directory is "auto", not
+       # auto-<datetime>.
+       if [ "$is_automatic_session" = true ]; then
+               session_name="auto"
+       fi
+       validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output/$snapshot_name*
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+# Set the relayd in --group-output-by-session mode
+start_lttng_relayd "-o $TRACE_PATH --group-output-by-session"
+start_lttng_sessiond
+
+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
+#      Rotation does not exist on stable 2.9
+#      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
+)
+
+name=""
+# Perform test when session name is generated by the client
+for fct_test in ${tests[@]};
+do
+       ${fct_test} "$name"
+       rm -rf $TRACE_PATH/auto/
+       count=$(ls -1 $TRACE_PATH/ | wc -l)
+       is $count "0" "LTTng-relayd output directory empty"
+done
+
+# Perform test when session name is given
+for fct_test in ${tests[@]};
+do
+       name=$(randstring 16 0)
+       ${fct_test} "$name"
+       rm -rf $TRACE_PATH/$name/
+       count=$(ls -1 $TRACE_PATH/ | wc -l)
+       is $count "0" "LTTng-relayd output directory empty"
+done
+
+rm -rf $TRACE_PATH
+
+stop_lttng_sessiond
+stop_lttng_relayd
This page took 0.036888 seconds and 5 git commands to generate.