From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx> --- :100644 100644 2e5b355... a5c8449... M configure.ac :100644 100644 0edc478... 6603890... M cts/agents/Makefile.am :100644 000000 1ccc5bd... 0000000... D cts/agents/cmap-dispatch-deadlock.sh :000000 100644 0000000... e5e4567... A cts/agents/cmap-dispatch-deadlock.sh.in :100755 000000 ad6dc84... 0000000... D cts/agents/shm_leak_audit.sh :000000 100644 0000000... 0272705... A cts/agents/shm_leak_audit.sh.in :100644 100644 21d1e22... 804ad7c... M init/Makefile.am :100755 100755 84de9ae... 3711821... M init/corosync-notifyd.in :100755 100755 a9840bd... cfd51f2... M init/corosync.in :100644 100644 a7c3c63... 777a1f0... M test/Makefile.am :100644 100644 7bd7c9d... bea065b... M test/ploadstart.sh :100644 100644 6abc972... e994516... M tools/Makefile.am :100644 100644 d6b24aa... c098958... M tools/corosync-xmlproc.sh configure.ac | 2 + cts/agents/Makefile.am | 14 +++++++ cts/agents/cmap-dispatch-deadlock.sh | 57 ------------------------------- cts/agents/cmap-dispatch-deadlock.sh.in | 57 +++++++++++++++++++++++++++++++ cts/agents/shm_leak_audit.sh | 55 ----------------------------- cts/agents/shm_leak_audit.sh.in | 55 +++++++++++++++++++++++++++++ init/Makefile.am | 1 + init/corosync-notifyd.in | 2 +- init/corosync.in | 2 +- test/Makefile.am | 2 +- test/ploadstart.sh | 2 +- tools/Makefile.am | 4 ++- tools/corosync-xmlproc.sh | 2 +- 13 files changed, 137 insertions(+), 118 deletions(-) diff --git a/configure.ac b/configure.ac index 2e5b355..a5c8449 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,7 @@ AC_CHECK_PROGS([DOT], [dot]) AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([AWK], [awk]) AC_CHECK_PROGS([SED], [sed]) +AC_PATH_PROG([BASHPATH], [bash]) # Checks for compiler characteristics. AC_PROG_GCC_TRADITIONAL @@ -602,6 +603,7 @@ CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS" LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS" # substitute what we need: +AC_SUBST([BASHPATH]) AC_SUBST([INITDDIR]) AC_SUBST([SYSTEMDDIR]) INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR}) diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am index 0edc478..6603890 100644 --- a/cts/agents/Makefile.am +++ b/cts/agents/Makefile.am @@ -31,6 +31,9 @@ MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = cmap-dispatch-deadlock.sh.in \ + shm_leak_audit.sh.in + TEST_AGENTS = cpg_test_agent \ sam_test_agent \ votequorum_test_agent @@ -51,6 +54,14 @@ noinst_PROGRAMS = $(TEST_AGENTS) noinst_SCRIPTS = $(SHELL_TESTS) endif +cmap-dispatch-deadlock.sh: cmap-dispatch-deadlock.sh.in + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ + chmod 755 $@ + +shm_leak_audit.sh: shm_leak_audit.sh.in + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ + chmod 755 $@ + AM_CPPFLAGS = -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_builddir)/include/corosync @@ -77,6 +88,9 @@ votequorum_test_agent_LDADD = $(LIBQB_LIBS) \ $(top_builddir)/lib/libvotequorum.la \ $(top_builddir)/common_lib/libcorosync_common.la +clean-local: + rm -f shm_leak_audit.sh cmap-dispatch-deadlock.sh + lint: -splint $(LINT_FLAGS) $(CFLAGS) *.c diff --git a/cts/agents/cmap-dispatch-deadlock.sh b/cts/agents/cmap-dispatch-deadlock.sh deleted file mode 100644 index 1ccc5bd..0000000 --- a/cts/agents/cmap-dispatch-deadlock.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -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 diff --git a/cts/agents/cmap-dispatch-deadlock.sh.in b/cts/agents/cmap-dispatch-deadlock.sh.in new file mode 100644 index 0000000..e5e4567 --- /dev/null +++ b/cts/agents/cmap-dispatch-deadlock.sh.in @@ -0,0 +1,57 @@ +#!@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 diff --git a/cts/agents/shm_leak_audit.sh b/cts/agents/shm_leak_audit.sh deleted file mode 100755 index ad6dc84..0000000 --- a/cts/agents/shm_leak_audit.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - - -service corosync status >/dev/null -CS_STATUS=$? - -if [ $CS_STATUS -eq 0 ] -then - # corosync running - active=$(corosync-cmapctl runtime.connections.active | cut -d= -f2) - if [ $active -lt 2 ] - then - FILES=$(ls /dev/shm/qb-*) - for f in $FILES - do - if [[ "$f" =~ "blackbox" ]] - then - true - else - echo $f - fi - done - else - pids=$(corosync-cmapctl runtime.connections. | grep client_pid | cut -d= -f2) - - FILES=$(ls /dev/shm/qb-*) - for f in $FILES - do - found=0 - for p in $pids - do - if [[ "$f" =~ "$p" ]] - then - found=1 - elif [[ "$f" =~ "blackbox" ]] - then - found=1 - fi - done - if [ $found -eq 0 ] - then - echo $f - fi - done - fi -else - FILES=$(ls /dev/shm/qb-*) - for f in $FILES - do - echo $f - done -fi - -exit 0 - diff --git a/cts/agents/shm_leak_audit.sh.in b/cts/agents/shm_leak_audit.sh.in new file mode 100644 index 0000000..0272705 --- /dev/null +++ b/cts/agents/shm_leak_audit.sh.in @@ -0,0 +1,55 @@ +#!@BASHPATH@ + + +service corosync status >/dev/null +CS_STATUS=$? + +if [ $CS_STATUS -eq 0 ] +then + # corosync running + active=$(corosync-cmapctl runtime.connections.active | cut -d= -f2) + if [ $active -lt 2 ] + then + FILES=$(ls /dev/shm/qb-*) + for f in $FILES + do + if [[ "$f" =~ "blackbox" ]] + then + true + else + echo $f + fi + done + else + pids=$(corosync-cmapctl runtime.connections. | grep client_pid | cut -d= -f2) + + FILES=$(ls /dev/shm/qb-*) + for f in $FILES + do + found=0 + for p in $pids + do + if [[ "$f" =~ "$p" ]] + then + found=1 + elif [[ "$f" =~ "blackbox" ]] + then + found=1 + fi + done + if [ $found -eq 0 ] + then + echo $f + fi + done + fi +else + FILES=$(ls /dev/shm/qb-*) + for f in $FILES + do + echo $f + done +fi + +exit 0 + diff --git a/init/Makefile.am b/init/Makefile.am index 21d1e22..804ad7c 100644 --- a/init/Makefile.am +++ b/init/Makefile.am @@ -53,6 +53,7 @@ initscript_SCRIPTS = corosync corosync-notifyd -e 's#@''INITDDIR@#$(INITDDIR)#g' \ -e 's#@''INITWRAPPERSDIR@#$(INITWRAPPERSDIR)#g' \ -e 's#@''LOCALSTATEDIR@#$(localstatedir)#g' \ + -e 's#@''BASHPATH@#${BASHPATH}#g' \ > $@-t mv $@-t $@ diff --git a/init/corosync-notifyd.in b/init/corosync-notifyd.in index 84de9ae..3711821 100755 --- a/init/corosync-notifyd.in +++ b/init/corosync-notifyd.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Authors: # Angus Salkeld <asalkeld@xxxxxxxxxx> diff --git a/init/corosync.in b/init/corosync.in index a9840bd..cfd51f2 100755 --- a/init/corosync.in +++ b/init/corosync.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Authors: # Andrew Beekhof <abeekhof@xxxxxxxxxx> diff --git a/test/Makefile.am b/test/Makefile.am index a7c3c63..777a1f0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -64,7 +64,7 @@ cpgbenchzc_LDADD = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la testsam_LDADD = $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la ploadstart: ploadstart.sh - cp $^ $@ + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ chmod 755 $@ LINT_FILES1:=$(filter-out sa_error.c, $(wildcard *.c)) diff --git a/test/ploadstart.sh b/test/ploadstart.sh index 7bd7c9d..bea065b 100644 --- a/test/ploadstart.sh +++ b/test/ploadstart.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ set -e diff --git a/tools/Makefile.am b/tools/Makefile.am index 6abc972..e994516 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -47,7 +47,9 @@ EXTRA_DIST = $(bin_SCRIPTS) corosync-xmlproc.sh \ corosync-blackbox.sh corosync-xmlproc: corosync-xmlproc.sh - sed -e 's#@''DATADIR@#${datadir}#g' $< > $@ + sed -e 's#@''DATADIR@#${datadir}#g' \ + -e 's#@''BASHPATH@#${BASHPATH}#g' \ + $< > $@ corosync-blackbox: corosync-blackbox.sh sed -e 's#@''LOCALSTATEDIR@#${localstatedir}#g' $< > $@ diff --git a/tools/corosync-xmlproc.sh b/tools/corosync-xmlproc.sh index d6b24aa..c098958 100644 --- a/tools/corosync-xmlproc.sh +++ b/tools/corosync-xmlproc.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Copyright (c) 2011 Red Hat, Inc. # -- 1.7.7.6 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss