mirror_corosync/cts/agents/cmap-dispatch-deadlock.sh.in
Fabio M. Di Nitto c8a620fd24 build: make path to bash configurable at build time
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:49 +02:00

58 lines
980 B
Bash

#!@BASHPATH@
export TIMEOUT=600
export PID=$$
up_to=200
rec_plist() {
if [ "$2" == "" ];then
pl="`ps ax -o pid= -o ppid= -o comm=`"
else
pl=$2
fi
list=`echo "$pl" | egrep "^ *[0-9]+ +$1" | awk '{ print $1 }'`
tmplist=$list
for i in $tmplist;do
[ "$i" != "$1" ] && [ "$i" != "$$" ] && list="$list "`rec_plist $i "$pl"`
done
echo $list
}
rec_pkill() {
kill -9 `rec_plist "$1"` 2> /dev/null
}
exit_timeout() {
echo "ERR: Timeout. Test failed $PID"
rec_pkill "$$"
exit 1
}
corosync-cmapctl -s test.abd "str" "test" || exit 2
trap exit_timeout SIGUSR1
(sleep $TIMEOUT ; kill -SIGUSR1 $PID) &
wait_list=""
for e in {1..40};do
(for a in `seq 1 $up_to`;do corosync-cmapctl -s test.abd "str" $a ; done) &
wait_list="$wait_list $!"
done
notify_list=""
for i in {1..2};do
sleep 600000 | corosync-cmapctl -t test > /dev/null &
notify_list="$notify_list $!"
done
wait $wait_list
rec_pkill "$$"
echo "OK"
exit 0