tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / ust / multi-session / test_multi_session
index 18e220dcf0e602f99e4786e56a00cc178429bebe..ba73b7d2086e746b1d2ec7329df0fc23adba6129 100755 (executable)
@@ -1,19 +1,9 @@
 #!/bin/bash
 #
-# Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
+# Copyright (C) 2012 David Goulet <dgoulet@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="UST tracer - Multi-session"
 
 CURDIR=$(dirname $0)/
@@ -21,14 +11,12 @@ TESTDIR=$CURDIR/../../..
 NR_ITER=100
 SESSION_NAME="multi-session"
 EVENT_NAME="ust_gen_nevents:tptest"
+NUM_TESTS=28
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/gen-nevents" ]; then
-       echo -e "No UST nevents binary detected. Passing."
-       exit 0
+       BAIL_OUT "No UST nevents binary detected."
 fi
 
 # MUST set TESTDIR before calling those functions
@@ -38,34 +26,29 @@ test_multi_session() {
 
        # BEFORE application is spawned
        for i in `seq 0 3`; do
-               create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i"
-               enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i"
-               start_lttng_tracing "$SESSION_NAME-$i"
+               create_lttng_session_ok "$SESSION_NAME-$i" "$TRACE_PATH/$i"
+               enable_ust_lttng_event_ok "$SESSION_NAME-$i" "$EVENT_NAME$i"
+               start_lttng_tracing_ok "$SESSION_NAME-$i"
        done
 
-       echo -n "Starting application generating $NR_ITER events... "
        ./$CURDIR/gen-nevents $NR_ITER &
-       print_ok
+       ok $? "Start application to generate $NR_ITER events"
 
-       # At least hit one event
-       echo -n "Waiting for events to record "
-       while [ -n "$(pidof gen-nevents)" ]; do
-               echo -n "."
-               sleep 0.1
-       done
-       print_ok
+       wait
+       pass "Wait for events to record"
 
        for i in `seq 0 3`; do
-               stop_lttng_tracing "$SESSION_NAME-$i"
-               destroy_lttng_session "$SESSION_NAME-$i"
+               stop_lttng_tracing_ok "$SESSION_NAME-$i"
+               destroy_lttng_session_ok "$SESSION_NAME-$i"
                out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l)
                if [ $out -ne $NR_ITER ]; then
-                       echo -n "No event found. Suppose to have at least one... "
-                       print_fail
+                       fail "Trace validation of $SESSION_NAME-$i"
+                       diag "No events found."
                        out=1
+                       break
                else
-                       echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... "
-                       print_ok
+                       pass "Trace validation of $SESSION_NAME-$i"
+                       diag "Found $out event(s) for $SESSION_NAME-$i."
                        out=0
                fi
        done
@@ -75,6 +58,10 @@ test_multi_session() {
 
 # MUST set TESTDIR before calling those functions
 
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 TRACE_PATH=$(mktemp -d)
This page took 0.026675 seconds and 5 git commands to generate.