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"
21 TESTDIR
=$CURDIR/..
/..
/..
23 SESSION_NAME
="health_thread_stall"
25 HEALTH_CHECK_BIN
="health_check"
26 SESSIOND_PRELOAD
=".libs/libhealthstall.so"
29 source $TESTDIR/utils
/utils.sh
31 if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
32 BAIL_OUT
"libhealthstall.so not available for this test."
35 function test_thread_stall
37 test_thread_stall_name
="$1"
38 test_thread_exit_code
="$2"
40 diag
"Test health failure with ${test_thread_stall_name}"
43 export LTTNG_TESTPOINT_ENABLE
=1
45 # Activate specific thread exit
46 export ${test_thread_stall_name}_STALL
=1
48 # Spawn sessiond with preload healthexit lib
49 export LD_PRELOAD
="$CURDIR/$SESSIOND_PRELOAD"
52 # Cleanup some env. var.
54 unset ${test_thread_stall_name}_STALL
56 # Check initial health status
57 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
62 # Check health status, exit code should indicate failure
63 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
65 health_check_exit_code
=$?
67 if [ $health_check_exit_code -eq $test_thread_exit_code ]; then
68 pass
"Validate that ${test_thread_stall_name} is stalled"
70 fail
"Validate that ${test_thread_stall_name} is stalled"
71 diag
"Health returned: $health_check_exit_code"
80 # Check health status, exit code should now pass
81 $CURDIR/$HEALTH_CHECK_BIN &> /dev
/null
83 health_check_exit_code
=$?
85 if [ $health_check_exit_code -eq 0 ]; then
86 pass
"Validate that ${test_thread_stall_name} is no longer stalled"
89 fail
"Validate that ${test_thread_stall_name} is no longer stalled"
90 diag
"Health returned: $health_check_exit_code\n"
100 print_test_banner
"$TEST_DESC"
102 THREAD
=("LTTNG_THREAD_MANAGE_CLIENTS"
103 "LTTNG_THREAD_MANAGE_APPS"
104 # This thread is a little bit tricky to stall,
105 # need to send some commands and setup an app.
106 # "LTTNG_THREAD_REG_APPS"
109 # Exit code value to indicate specific thread failure
115 THREAD_COUNT
=${#THREAD[@]}
117 while [ "$i" -lt "$THREAD_COUNT" ]; do
118 test_thread_stall
"${THREAD[$i]}" "${EXIT_CODE[$i]}"
120 if [ $?
-eq 1 ]; then
127 # The manage kernel thread is only spawned if we are root
128 if [ "$(id -u)" == "0" ]; then
134 skip
$isroot "Root access is needed. Skipping LTTNG_THREAD_MANAGE_KERNEL tests." "4" ||
136 test_thread_stall
"LTTNG_THREAD_MANAGE_KERNEL" "8"
This page took 0.041275 seconds and 4 git commands to generate.