tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / tools / base-path / test_ust
index d7e324e7baff74b470b807b19ed49b95ff047479..26996b4ae902af69ec0c1ecb9633531675069ac9 100755 (executable)
@@ -1,25 +1,13 @@
 #!/bin/bash
 #
-# Copyright (C) 2019 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+# 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
+# SPDX-License-Identifier: LGPL-2.1-only
+
 TEST_DESC="Streaming Base Path Override - User space tracing"
 
-CURDIR=$(dirname $0)/
+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"
@@ -27,9 +15,9 @@ EVENT_NAME="tp:tptest"
 
 TRACE_PATH=$(mktemp -d)
 
-NUM_TESTS=32
+NUM_TESTS=37
 
-source $TESTDIR/utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
 
 if [ ! -x "$TESTAPP_BIN" ]; then
        BAIL_OUT "No UST events binary detected."
@@ -37,7 +25,7 @@ fi
 
 function ust_app_stream_base_path ()
 {
-       local session_name=$(randstring 16 0)
+       local session_name="ust_app_stream_base_path"
        local base_path="my/custom/path1"
 
        diag "Test base path override for trace streaming"
@@ -52,16 +40,15 @@ function ust_app_stream_base_path ()
        destroy_lttng_session_ok $session_name
 
        # validate test
-       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-       if [ $? -eq 0 ]; then
+       if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
                # only delete if successful
-               rm -rf $TRACE_PATH
+               rm -rf "$TRACE_PATH"
        fi
 }
 
 function ust_app_snapshot_create_base_path ()
 {
-       local session_name=$(randstring 16 0)
+       local session_name="ust_app_snapshot_create_base_path"
        local base_path="my/custom/path2"
 
        diag "Test base path override for remote trace snapshot (URI on create)"
@@ -80,16 +67,15 @@ function ust_app_snapshot_create_base_path ()
        destroy_lttng_session_ok $session_name
 
        # validate test
-       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-       if [ $? -eq 0 ]; then
+       if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
                # only delete if successful
-               rm -rf $TRACE_PATH
+               rm -rf "$TRACE_PATH"
        fi
 }
 
 function ust_app_snapshot_base_path ()
 {
-       local session_name=$(randstring 16 0)
+       local session_name="ust_app_snapshot_base_path"
        local base_path="my/custom/path3"
 
        diag "Test base path override for remote trace snapshot (URI on snapshot)"
@@ -107,17 +93,16 @@ function ust_app_snapshot_base_path ()
        destroy_lttng_session_ok $session_name
 
        # validate test
-       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-       if [ $? -eq 0 ]; then
+       if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
                # only delete if successful
-               rm -rf $TRACE_PATH
+               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"
+       local session_name="ust_app_snapshot_add_output_base_path"
+       local base_path="my/custom/path4"
 
        diag "Test base path override for remote trace snapshot (URI on add-output)"
        create_lttng_session_no_output $session_name --snapshot
@@ -135,10 +120,30 @@ function ust_app_snapshot_add_output_base_path ()
        destroy_lttng_session_ok $session_name
 
        # validate test
-       validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-       if [ $? -eq 0 ]; then
+       if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
+               # only delete if successful
+               rm -rf "$TRACE_PATH"
+       fi
+}
+
+function ust_app_stream_base_path_via_load ()
+{
+       local session_name="load-stream-extra-path"
+       local base_path="my/custom/path5"
+
+       diag "Test base path override for trace streaming using lttng load"
+       lttng_load_ok "-i $CURDIR/$session_name.lttng"
+       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
+       if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
                # only delete if successful
-               rm -rf $TRACE_PATH
+               rm -rf "$TRACE_PATH"
        fi
 }
 
@@ -152,8 +157,10 @@ 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[@]};
+       ust_app_snapshot_add_output_base_path
+       ust_app_stream_base_path_via_load
+)
+for fct_test in "${tests[@]}";
 do
        ${fct_test}
 done
This page took 0.025384 seconds and 4 git commands to generate.