Fix: lttng: uninitialized pointer free'd when no sessiond is present
[lttng-tools.git] / tests / regression / tools / notification / test_notification_ust
index 70cbec6fed3d86803029d9c2043881f142a7620a..ad8b0b021d8e0ce44b82a6b9cfbcf7f0cad04b39 100755 (executable)
@@ -1,34 +1,24 @@
 #!/bin/bash
 #
-# Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# Copyright (C) 2017 Jonathan Rajotte-Julien <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
+# SPDX-License-Identifier: LGPL-2.1-only
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../../
 
+TMPDIR=$(mktemp -d)
+
 #This is needed since the testpoint create a pipe with the consumerd type suffixed
-TESTPOINT_BASE_PATH=$(readlink -f "$CURDIR/lttng.t_p_n")
+TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
 TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
-TESTPOIT_ARGS="CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LTTNG_TESTPOINT_ENABLE=1"
 TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
 
 
 TESTAPP_PATH="$TESTDIR/utils/testapp"
 TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-TESTAPP_STATE_PATH=$(mktemp -u "$CURDIR/application_state.XXXXXXXXXX")
+TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
 
 NR_ITER=1000
 NR_USEC_WAIT=5
@@ -44,7 +34,7 @@ DIR=$(readlink -f $TESTDIR)
 
 source $TESTDIR/utils/utils.sh
 
-function ust_event_generator_toogle_state
+function ust_event_generator_toggle_state
 {
        ust_event_generator_suspended=$((ust_event_generator_suspended==0))
 
@@ -53,17 +43,17 @@ function ust_event_generator
 {
        state_file=$1
        ust_event_generator_suspended=0
-       trap ust_event_generator_toogle_state SIGUSR1
-       trap "exit" SIGTERM SIGINT
+       trap ust_event_generator_toggle_state SIGUSR1
+
        while (true); do
                if [[ $ust_event_generator_suspended -eq "1" ]]; then
                        touch $state_file
                        sleep 0.5
                else
                        if [[ -f $state_file ]]; then
-                               rm $state_file 2> /dev/null
+                               rm -rf $state_file 2> /dev/null
                        fi
-                       taskset  -c 0 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT > /dev/null 2>&1
+                       taskset  -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
                fi
        done
 }
@@ -98,8 +88,8 @@ stop_lttng_sessiond_notap
 # Suppress kill message
 kill -9 $APP_PID
 wait $APP_PID 2> /dev/null
-rm ${consumerd_pipe[@]} 2> /dev/null
-rm ${TESTAPP_STATE_PATH} 2> /dev/null
+
+rm -rf $TMPDIR
 
 # Just in case cleanup
 rm -rf $TRACE_PATH
This page took 0.035664 seconds and 5 git commands to generate.