Test is disabled by default because it depends on SMP and about 2GB RAM.
It's also testing race, so test is unreliable.

Signed-off-by: Jan Friesse <[email protected]>
---
 cts/agents/Makefile.am                 |    4 +-
 cts/agents/confdb-dispatch-deadlock.sh |   57 ++++++++++++++++++++++++++++++++
 cts/corotests.py                       |   17 +++++++++
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 cts/agents/confdb-dispatch-deadlock.sh

diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am
index 1d73a9b..e3f1502 100644
--- a/cts/agents/Makefile.am
+++ b/cts/agents/Makefile.am
@@ -41,7 +41,7 @@ EXTRA_DIST            = syncv2.c
 if INSTALL_TESTAGENTS
 agentdir = $(datadir)/$(PACKAGE)/tests
 bin_PROGRAMS = $(TEST_AGENTS)
-dist_agent_SCRIPTS = mem_leak_test.sh net_breaker.sh
+dist_agent_SCRIPTS = mem_leak_test.sh net_breaker.sh 
confdb-dispatch-deadlock.sh
 
 AM_CFLAGS              = -fPIC
 SERVICE_LCRSO          = syncv2
@@ -50,7 +50,7 @@ LCRSO                 = $(SERVICE_LCRSO:%=service_%.lcrso)
 LCRSO_OBJS             = $(SOURCES:%.c=%.o)
 else
 noinst_PROGRAMS = $(TEST_AGENTS)
-noinst_SCRIPTS = mem_leak_test.sh net_breaker.sh
+noinst_SCRIPTS = mem_leak_test.sh net_breaker.sh confdb-dispatch-deadlock.sh
 LCRSO =
 LCRSO_OBJS =
 endif
diff --git a/cts/agents/confdb-dispatch-deadlock.sh 
b/cts/agents/confdb-dispatch-deadlock.sh
new file mode 100644
index 0000000..4ba0c2d
--- /dev/null
+++ b/cts/agents/confdb-dispatch-deadlock.sh
@@ -0,0 +1,57 @@
+#!/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-objctl -c test.abd || 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-objctl -w test.abd=$a ; done) &
+    wait_list="$wait_list $!"
+done
+
+notify_list=""
+
+for i in {1..2};do
+    sleep 600000 | corosync-objctl -t test > /dev/null &
+    notify_list="$notify_list $!"
+done
+
+wait $wait_list
+
+rec_pkill "$$"
+
+echo "OK"
+exit 0
diff --git a/cts/corotests.py b/cts/corotests.py
index 241832e..cbd7493 100644
--- a/cts/corotests.py
+++ b/cts/corotests.py
@@ -629,6 +629,22 @@ class ServiceLoadTest(CoroTest):
 
         return self.success()
 
+class ConfdbDispatchDeadlock(CoroTest):
+    '''
+    run confdb-dispatch-deadlock.sh
+    '''
+    def __init__(self, cm):
+        CoroTest.__init__(self,cm)
+        self.name="ConfdbDispatchDeadlock"
+
+    def __call__(self, node):
+        self.incr("calls")
+
+        result = self.CM.rsh(node, 
"/usr/share/corosync/tests/confdb-dispatch-deadlock.sh")
+        if result is 0:
+            return self.success()
+        else:
+            return self.failure('Deadlock detected')
 
 ###################################################################
 class ConfdbReplaceTest(CoroTest):
@@ -1544,6 +1560,7 @@ AllTestClasses.append(ResourcePollAdjust)
 AllTestClasses.append(ServiceLoadTest)
 AllTestClasses.append(MemLeakObject)
 AllTestClasses.append(MemLeakSession)
+#AllTestClasses.append(ConfdbDispatchDeadlock)
 AllTestClasses.append(FlipTest)
 AllTestClasses.append(RestartTest)
 AllTestClasses.append(StartOnebyOne)
-- 
1.7.1

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to