tests: add base-path tests
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Aug 2019 19:34:48 +0000 (15:34 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 00:00:57 +0000 (20:00 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/regression/tools/Makefile.am
tests/regression/tools/base-path/Makefile.am [new file with mode: 0644]
tests/regression/tools/base-path/test_ust [new file with mode: 0755]
tests/utils/utils.sh

index 214d58ac8856503307c06dd550b15581d958ec0f..f001bd6c3141bf680a017ee977dea5e8cf4218ef 100644 (file)
@@ -1132,6 +1132,7 @@ AC_CONFIG_FILES([
        tests/regression/tools/regen-statedump/Makefile
        tests/regression/tools/notification/Makefile
        tests/regression/tools/rotation/Makefile
+       tests/regression/tools/base-path/Makefile
        tests/regression/ust/Makefile
        tests/regression/ust/nprocesses/Makefile
        tests/regression/ust/high-throughput/Makefile
index dea9938869f92bdb8d5ccff4bd6df55d65b26766..856eecc086a01ba29888d535721f256b01eb37f1 100644 (file)
@@ -1,2 +1,3 @@
 SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \
-               wildcard crash regen-metadata regen-statedump notification rotation
+               wildcard crash regen-metadata regen-statedump notification rotation \
+               base-path
diff --git a/tests/regression/tools/base-path/Makefile.am b/tests/regression/tools/base-path/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/base-path/test_ust b/tests/regression/tools/base-path/test_ust
new file mode 100755 (executable)
index 0000000..d7e324e
--- /dev/null
@@ -0,0 +1,162 @@
+#!/bin/bash
+#
+# Copyright (C) - 2019 Mathieu Desnoyers <mathieu.desnoyers@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="Streaming Base Path Override - User space tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+NR_ITER=5
+NR_USEC_WAIT=0
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+EVENT_NAME="tp:tptest"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=32
+
+source $TESTDIR/utils/utils.sh
+
+if [ ! -x "$TESTAPP_BIN" ]; then
+       BAIL_OUT "No UST events binary detected."
+fi
+
+function ust_app_stream_base_path ()
+{
+       local session_name=$(randstring 16 0)
+       local base_path="my/custom/path1"
+
+       diag "Test base path override for trace streaming"
+       create_lttng_session_uri $session_name net://localhost/$base_path
+       enable_ust_lttng_event_ok $session_name $EVENT_NAME
+
+       start_lttng_tracing_ok $session_name
+
+       $TESTAPP_BIN > /dev/null 2>&1
+
+       stop_lttng_tracing_ok $session_name
+       destroy_lttng_session_ok $session_name
+
+       # validate test
+       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
+       if [ $? -eq 0 ]; then
+               # only delete if successful
+               rm -rf $TRACE_PATH
+       fi
+}
+
+function ust_app_snapshot_create_base_path ()
+{
+       local session_name=$(randstring 16 0)
+       local base_path="my/custom/path2"
+
+       diag "Test base path override for remote trace snapshot (URI on create)"
+       create_lttng_session_uri $session_name net://localhost/$base_path \
+                       --snapshot
+       enable_ust_lttng_event_ok $session_name $EVENT_NAME
+
+       start_lttng_tracing_ok $session_name
+
+       $TESTAPP_BIN > /dev/null 2>&1
+
+       stop_lttng_tracing_ok $session_name
+
+       lttng_snapshot_record $session_name
+
+       destroy_lttng_session_ok $session_name
+
+       # validate test
+       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
+       if [ $? -eq 0 ]; then
+               # only delete if successful
+               rm -rf $TRACE_PATH
+       fi
+}
+
+function ust_app_snapshot_base_path ()
+{
+       local session_name=$(randstring 16 0)
+       local base_path="my/custom/path3"
+
+       diag "Test base path override for remote trace snapshot (URI on snapshot)"
+       create_lttng_session_no_output $session_name --snapshot
+       enable_ust_lttng_event_ok $session_name $EVENT_NAME
+
+       start_lttng_tracing_ok $session_name
+
+       $TESTAPP_BIN > /dev/null 2>&1
+
+       stop_lttng_tracing_ok $session_name
+
+       lttng_snapshot_record $session_name net://localhost/$base_path
+
+       destroy_lttng_session_ok $session_name
+
+       # validate test
+       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
+       if [ $? -eq 0 ]; then
+               # only delete if successful
+               rm -rf $TRACE_PATH
+       fi
+}
+
+function ust_app_snapshot_add_output_base_path ()
+{
+       local session_name=$(randstring 16 0)
+       local base_path="my/custom/path3"
+
+       diag "Test base path override for remote trace snapshot (URI on add-output)"
+       create_lttng_session_no_output $session_name --snapshot
+       enable_ust_lttng_event_ok $session_name $EVENT_NAME
+
+       start_lttng_tracing_ok $session_name
+
+       $TESTAPP_BIN > /dev/null 2>&1
+
+       stop_lttng_tracing_ok $session_name
+
+       lttng_snapshot_add_output_ok $session_name net://localhost/$base_path
+       lttng_snapshot_record $session_name
+
+       destroy_lttng_session_ok $session_name
+
+       # validate test
+       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
+       if [ $? -eq 0 ]; then
+               # only delete if successful
+               rm -rf $TRACE_PATH
+       fi
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_relayd "-o $TRACE_PATH"
+start_lttng_sessiond
+
+tests=( ust_app_stream_base_path
+       ust_app_snapshot_create_base_path
+       ust_app_snapshot_base_path
+       ust_app_snapshot_add_output_base_path )
+for fct_test in ${tests[@]};
+do
+       ${fct_test}
+done
+
+stop_lttng_sessiond
+stop_lttng_relayd
index 9b93857c255569e7445d9d9f9a968d8eb6f1e0be..9ece4d35200af26bb476a667bc76df5e58b931d5 100644 (file)
@@ -752,8 +752,9 @@ function list_lttng_with_opts ()
 function create_lttng_session_no_output ()
 {
        local sess_name=$1
+       local opts="${@:2}"
 
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name --no-output 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name --no-output $opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
        ok $? "Create session $sess_name in no-output mode"
 }
 
@@ -1287,7 +1288,7 @@ function lttng_snapshot_record ()
        local sess_name=$1
        local trace_path=$2
 
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot record -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot record -s $sess_name $trace_path 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
        ok $? "Snapshot recorded"
 }
 
This page took 0.033398 seconds and 5 git commands to generate.