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 stall"
23 SESSION_NAME
="health_thread_stall"
25 HEALTH_CHECK_BIN
="health_check"
26 SESSIOND_PRELOAD
=".libs/libhealthstall.so"
28 source $TESTDIR/utils.sh
30 print_test_banner
"$TEST_DESC"
32 if [ ! -f "$SESSIOND_PRELOAD" ]; then
33 echo -e "libhealthstall.so not available for this test. Skipping."
37 function test_thread_stall
39 test_thread_stall_name
="$1"
40 test_thread_exit_code
="$2"
43 echo -e "=== Testing health failure with ${test_thread_stall_name}"
46 export LTTNG_TESTPOINT_ENABLE
=1
48 # Activate specific thread exit
49 export ${test_thread_stall_name}_STALL
=1
51 # Spawn sessiond with preload healthexit lib
52 export LD_PRELOAD
="$CURDIR/$SESSIOND_PRELOAD"
55 # Cleanup some env. var.
57 unset ${test_thread_stall_name}_STALL
59 # Check initial health status
60 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
62 echo -n "Validating that ${test_thread_stall_name} is stalled... "
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
76 echo -e "Health returned: $health_check_exit_code\n"
82 echo -n "Validating that ${test_thread_stall_name} is no longer stalled... "
87 # Check health status, exit code should now pass
88 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
90 health_check_exit_code
=$?
92 if [ $health_check_exit_code -eq 0 ]; then
97 echo -e "Health returned: $health_check_exit_code\n"
105 THREAD
=("LTTNG_THREAD_MANAGE_CLIENTS"
106 "LTTNG_THREAD_MANAGE_APPS"
107 # This thread is a little bit tricky to stall,
108 # need to send some commands and setup an app.
109 # "LTTNG_THREAD_REG_APPS"
110 "LTTNG_THREAD_MANAGE_KERNEL")
112 # Exit code value to indicate specific thread failure
118 THREAD_COUNT
=${#THREAD[@]}
120 while [ "$i" -lt "$THREAD_COUNT" ]; do
121 test_thread_stall
"${THREAD[$i]}" "${EXIT_CODE[$i]}"
123 if [ $?
-eq 1 ]; then
This page took 0.03657 seconds and 4 git commands to generate.