Tests: use babeltrace2 for all tests
[lttng-tools.git] / tests / regression / tools / snapshots / ust_test
index aa9d4763e6c762419cf678f77e5c7db68eba4cf1..e2e84b5c343017177f890a782d8d941f00ec9233 100755 (executable)
@@ -1,19 +1,9 @@
 #!/bin/bash
 #
-# Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
+# Copyright (C) 2013 Julien Desfossez <jdesfossez@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="Snapshots - UST tracing"
 
 CURDIR=$(dirname $0)/
@@ -26,30 +16,30 @@ TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 APPS_PID=
 
-NUM_TESTS=100
+NUM_TESTS=105
 
-TRACE_PATH=$(mktemp -d)
+TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_ust_trace_path.XXXXXX)
 
 source $TESTDIR/utils/utils.sh
 
 if [ ! -x "$TESTAPP_BIN" ]; then
-       BAIL_OUT "No UST events binary detected."
+       BAIL_OUT "No UST events binary detected"
 fi
 
 # Need the number of snapshot to do.
 if [ -z $1 ]; then
-       BAIL_OUT "A number of snapshot is needed."
+       BAIL_OUT "A number of snapshot is needed"
 fi
 NR_SNAPSHOT=$1
 
-NUM_TESTS=$(($NUM_TESTS + ($NR_SNAPSHOT * 2)))
+NUM_TESTS=$(($NUM_TESTS + ($NR_SNAPSHOT * 3)))
 
 function start_test_app()
 {
-       local tmp_file=$(mktemp -u)
+       local tmp_file=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_tmp_file.XXXXXX")
 
        # Start application with a temporary file.
-       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file &
+       $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file &
        ret=$?
        APPS_PID="${APPS_PID} ${!}"
        ok $ret "Start application to trace"
@@ -203,6 +193,7 @@ function test_ust_local_snapshot ()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Validate test
+       validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
        validate_trace $EVENT_NAME $TRACE_PATH/
        if [ $? -eq 0 ]; then
                # Only delete if successful
@@ -247,9 +238,9 @@ function test_ust_local_snapshot_small_discard_buffers ()
        rm -rf $TRACE_PATH/
 
        if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
-               fail "First snapshot event do not match."
+               fail "First snapshot event do not match"
        else
-               pass "First snapshot event match."
+               pass "First snapshot event match"
        fi
 
        stop_lttng_tracing_ok $SESSION_NAME
@@ -292,9 +283,9 @@ function test_ust_local_snapshot_small_overwrite_buffers ()
        rm -rf $TRACE_PATH/
 
        if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
-               pass "First snapshot event do not match."
+               pass "First snapshot event do not match"
        else
-               fail "First snapshot event match."
+               fail "First snapshot event match"
        fi
 
        stop_lttng_tracing_ok $SESSION_NAME
@@ -345,6 +336,7 @@ function test_ust_local_snapshot_max_size ()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Validate test
+       validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
        validate_trace $EVENT_NAME $TRACE_PATH/
 
        if [ $? -eq 0 ]; then
@@ -368,13 +360,14 @@ function test_ust_local_snapshot_large_metadata ()
        enable_ust_lttng_event_ok $SESSION_NAME $LM_EVENT $CHANNEL_NAME
        start_lttng_tracing_ok $SESSION_NAME
        lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
-       $LM_BIN 1 1
+       $LM_BIN --iter 1 --wait 1
        ok $? "Start application to trace"
        lttng_snapshot_record $SESSION_NAME
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
 
        # Validate test
+       validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
        validate_trace $LM_EVENT $TRACE_PATH/
        if [ $? -eq 0 ]; then
                # Only delete if successful
@@ -410,6 +403,7 @@ function test_ust_per_uid_local_snapshot ()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Validate test
+       validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
        validate_trace $EVENT_NAME $TRACE_PATH/
        if [ $? -eq 0 ]; then
                # Only delete if successful
@@ -440,6 +434,7 @@ function test_ust_per_uid_local_snapshot_post_mortem ()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Validate test
+       validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
        validate_trace $EVENT_NAME $TRACE_PATH/
        if [ $? -eq 0 ]; then
                # Only delete if successful
@@ -467,6 +462,7 @@ function test_ust_local_snapshots ()
                rm -rf $TRACE_PATH/snapshot/* 2>/dev/null
                lttng_snapshot_record $SESSION_NAME
                # Validate test
+               validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" $((i - 1))
                validate_trace $EVENT_NAME $TRACE_PATH/
                if [ $? -eq 0 ]; then
                        # Only delete if successful
@@ -483,6 +479,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 tests=( test_ust_list_output
        test_ust_local_snapshot
This page took 0.025169 seconds and 4 git commands to generate.