port: add support for BSD mktemp
[lttng-tools.git] / tests / regression / tools / health / test_health.sh
index 5010a9136b7ee94ec7cc13e9bf07f68826676b25..b4b416f929f7c5924611fda3f62f05ce91173104 100644 (file)
@@ -1,42 +1,18 @@
-# Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
-# Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+# Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
+# Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program 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 General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# SPDX-License-Identifier: GPL-2.0-only
 
 TESTDIR=${CURDIR}/../../..
-LTTNG_BIN="lttng"
 UST_EVENT_NAME="tp:tptest"
 KERNEL_EVENT_NAME="sched_switch"
 CHANNEL_NAME="testchan"
 HEALTH_CHECK_BIN="health_check"
-NUM_TESTS=90
+NUM_TESTS=96
 SLEEP_TIME=30
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
-       BAIL_OUT "${CURDIR}/${SESSIOND_PRELOAD} is missing."
-fi
-
-function lttng_create_session_uri
-{
-       # Create session with default path
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME \
-               -U net://localhost >/dev/null 2>&1
-       ok $? "Create session with default path"
-}
-
 function report_errors
 {
        test_thread_error_string="$1"
@@ -94,7 +70,7 @@ function test_health
        # Activate specific thread test
        export ${test_thread_name}_${test_suffix}=1
 
-       # Spawn sessiond with preload healthexit lib
+       # Spawn sessiond with preloaded testpoint override lib
        export LD_PRELOAD="$CURDIR/$SESSIOND_PRELOAD"
 
        diag "Start session daemon"
@@ -111,7 +87,7 @@ function test_health
                        diag "With kernel consumer daemon"
                        lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME
                }
-               start_lttng_tracing $SESSION_NAME
+               start_lttng_tracing_ok $SESSION_NAME
        fi
 
        if [ ${test_relayd} -eq 1 ]; then
@@ -146,9 +122,15 @@ function test_health
        fi
 
        if [ ${test_relayd} -eq 1 ]; then
-               stop_lttng_relayd_nocheck
+               # We may fail to stop relayd here, and this is OK, since
+               # it may have been killed volountarily by testpoint.
+               stop_lttng_relayd_cleanup $KILL_SIGNAL
        fi
-       stop_lttng_sessiond
+
+       if [ ${test_consumerd} -eq 1 ]; then
+               stop_lttng_consumerd $KILL_SIGNAL
+       fi
+       stop_lttng_sessiond $KILL_SIGNAL
 
        unset LTTNG_TESTPOINT_ENABLE
        unset ${test_thread_name}_${test_suffix}
@@ -161,10 +143,17 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+if [ -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
+       foundobj=1
+else
+       foundobj=0
+fi
+
+skip $foundobj "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0
+
 THREAD=("LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS"
        "LTTNG_SESSIOND_THREAD_MANAGE_APPS"
        "LTTNG_SESSIOND_THREAD_REG_APPS"
-       "LTTNG_SESSIOND_THREAD_HT_CLEANUP"
        "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY"
        "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH"
        "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL"
@@ -185,7 +174,6 @@ ERROR_STRING=(
        "Thread \"Session daemon command\" is not responding in component \"sessiond\"."
        "Thread \"Session daemon application manager\" is not responding in component \"sessiond\"."
        "Thread \"Session daemon application registration\" is not responding in component \"sessiond\"."
-       "Thread \"Session daemon hash table cleanup\" is not responding in component \"sessiond\"."
        "Thread \"Session daemon application notification manager\" is not responding in component \"sessiond\"."
        "Thread \"Session daemon application registration dispatcher\" is not responding in component \"sessiond\"."
        "Thread \"Session daemon kernel\" is not responding in component \"sessiond\"."
@@ -224,7 +212,6 @@ NEEDS_ROOT=(
        0
        0
        0
-       0
        1
 
        0
@@ -246,7 +233,6 @@ TEST_CONSUMERD=(
        0
        0
        0
-       0
 
        1
        1
@@ -267,7 +253,6 @@ TEST_RELAYD=(
        0
        0
        0
-       0
 
        0
        0
@@ -281,10 +266,10 @@ TEST_RELAYD=(
        1
 )
 
-STDOUT_PATH=$(mktemp)
-STDERR_PATH=$(mktemp)
-TRACE_PATH=$(mktemp -d)
-HEALTH_PATH=$(mktemp -d)
+STDOUT_PATH=$(mktemp -t tmp.test_health_stdout_path.XXXXXX)
+STDERR_PATH=$(mktemp -t tmp.test_health_stderr_path.XXXXXX)
+TRACE_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX)
+HEALTH_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX)
 
 if [ "$(id -u)" == "0" ]; then
        isroot=1
This page took 0.024869 seconds and 4 git commands to generate.