3 # Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com>
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License, version 2 only, as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 TEST_DESC
="Health check - Thread exit"
21 TESTDIR
=$CURDIR/..
/..
/..
23 SESSION_NAME
="health_thread_exit"
25 HEALTH_CHECK_BIN
="health_check"
26 SESSIOND_PRELOAD
=".libs/libhealthexit.so"
28 source $TESTDIR/utils
/utils.sh
30 print_test_banner
"$TEST_DESC"
32 if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
33 echo -e "libhealthexit.so not available for this test. Skipping."
37 function test_thread_exit
39 test_thread_exit_name
="$1"
40 test_thread_exit_code
="$2"
43 echo -e "=== Testing health failure with ${test_thread_exit_name}"
46 export LTTNG_TESTPOINT_ENABLE
=1
48 # Activate specific thread exit
49 export ${test_thread_exit_name}_EXIT
=1
51 # Spawn sessiond with preload healthexit lib
52 export LD_PRELOAD
="$CURDIR/$SESSIOND_PRELOAD"
55 # Cleanup some env. var.
57 unset ${test_thread_exit_name}_EXIT
59 # Check initial health status
60 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
62 echo -n "Validating thread ${test_thread_exit_name} failure... "
67 # Check health status, exit code should indicate failure
68 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
70 health_check_exit_code
=$?
72 if [ $health_check_exit_code -eq $test_thread_exit_code ]; then
77 echo -e "Health returned: $health_check_exit_code\n"
84 THREAD
=("LTTNG_THREAD_MANAGE_CLIENTS"
85 "LTTNG_THREAD_MANAGE_APPS"
86 "LTTNG_THREAD_REG_APPS"
87 "LTTNG_THREAD_MANAGE_KERNEL")
89 # Exit code value to indicate specific thread failure
92 THREAD_COUNT
=${#THREAD[@]}
94 while [ "$i" -lt "$THREAD_COUNT" ]; do
95 test_thread_exit
"${THREAD[$i]}" "${EXIT_CODE[$i]}"
104 # Special case manage consumer, need to spawn consumer via commands.
105 #"LTTNG_THREAD_MANAGE_CONSUMER"
This page took 0.032914 seconds and 5 git commands to generate.