/usr/lib/heartbeat/transient-test.sh is in cluster-glue 1.0.12-7build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
#
#
####FIXME
# Known problems within this testing:
# 1. Doesn't reflect "someone else's message" problems into error count.
# 2. Path to "ipctransient{client,server}" not flexible enough.
no_logs=0
exit_on_error=1
num_servers=10
num_clients=10
client_time=2
commpath_args=""
cmd=`basename $0`
USAGE="Usage: $cmd [-c clients] [-s servers] [-t timetowait] [-C commpath]"
while getopts c:s:C:t: c
do
case $c in
c)
num_clients=$OPTARG
;;
s)
num_servers=$OPTARG
;;
t)
client_time=$OPTARG
;;
C)
commpath_args="-$c $OPTARG"
;;
\?)
echo $USAGE
exit 2
;;
esac
done
shift `expr $OPTIND - 1`
total_failed=0
server_failed=0
server_loop_cnt=0
while [ $server_loop_cnt != $num_servers ]; do
echo "############ DEBUG: Starting server iter $server_loop_cnt"
if [ $no_logs = 1 ]; then
./ipctransientserver $commpath_args > /dev/null 2>&1 &
else
./ipctransientserver $commpath_args &
fi
server_pid=$!
sleep 5
client_failed=0
client_loop_cnt=0
while [ $client_loop_cnt != $num_clients ]; do
sleep 5
echo "############ DEBUG: Starting client iter $client_loop_cnt"
if [ $no_logs = 1 ]; then
./ipctransientclient $commpath_args > /dev/null 2>&1 &
else
./ipctransientclient $commpath_args &
fi
client_pid=$!
sleep $client_time
if [ $exit_on_error = 1 ];then
kill -0 $client_pid > /dev/null 2>&1
else
kill -9 $client_pid > /dev/null 2>&1
fi
rc=$?
if [ $rc = 0 ]; then
echo "############ ERROR: Iter $client_loop_cnt failed to receive all messages"
client_failed=`expr $client_failed + 1`
if [ $exit_on_error = 1 ];then
echo "terminating after first error..."
exit 0
fi
else
echo "############ INFO: Iter $client_loop_cnt passed"
fi
client_loop_cnt=`expr $client_loop_cnt + 1`;
done
server_loop_cnt=`expr $server_loop_cnt + 1`;
total_failed=`expr $total_failed + $client_failed`
kill -9 $server_pid > /dev/null 2>&1
rc=$?
if [ $rc = 0 ]; then
echo "############ ERROR: Server was already dead"
server_failed=`expr $server_failed + 1`
fi
done
total_failed=`expr $total_failed + $server_failed`
if [ $total_failed = 0 ]; then
echo "INFO: All tests passed"
else
echo "ERROR: $total_failed tests failed"
fi
exit $total_failed
|