[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31481 - gnunet/src/integration-tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31481 - gnunet/src/integration-tests |
Date: |
Tue, 17 Dec 2013 16:00:28 +0100 |
Author: wachs
Date: 2013-12-17 16:00:28 +0100 (Tue, 17 Dec 2013)
New Revision: 31481
Modified:
gnunet/src/integration-tests/Makefile.am
gnunet/src/integration-tests/test_integration_disconnect.py.in
Log:
re-adding disconnect test
Modified: gnunet/src/integration-tests/Makefile.am
===================================================================
--- gnunet/src/integration-tests/Makefile.am 2013-12-17 14:19:53 UTC (rev
31480)
+++ gnunet/src/integration-tests/Makefile.am 2013-12-17 15:00:28 UTC (rev
31481)
@@ -16,15 +16,16 @@
if HAVE_PYTHON
check_SCRIPTS = \
test_integration_bootstrap_and_connect.py \
- test_integration_restart.py
+ test_integration_disconnect.py \
+ test_integration_restart.py
# test_integration_bootstrap_and_connect_and_disconnect.py \
# test_integration_bootstrap_and_connect_and_disconnect_nat.py \
# test_integration_clique.py \
# test_integration_clique_nat.py \
# test_integration_connect_on_restart.py
endif
-# test_integration_disconnect.py
+
if HAVE_MHD
if ENABLE_TEST_RUN
TESTS = \
Modified: gnunet/src/integration-tests/test_integration_disconnect.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_disconnect.py.in
2013-12-17 14:19:53 UTC (rev 31480)
+++ gnunet/src/integration-tests/test_integration_disconnect.py.in
2013-12-17 15:00:28 UTC (rev 31481)
@@ -19,6 +19,7 @@
#
#
import sys
+import signal
import os
import subprocess
import re
@@ -37,7 +38,7 @@
# in transport, core, topology, fs, the server is shutdown
#
# Conditions for successful exit:
-# Both peers have 0 connected peer in transport, core, topology, fs
+# Client peer has 0 connected peer in transport, core, topology, dht, fs
#definitions
@@ -51,21 +52,22 @@
tmp = "/tmp"
def cleanup ():
- shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True)
- shutil.rmtree (os.path.join (tmp, "c_no_nat_client"), True)
+ shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True)
+ shutil.rmtree (os.path.join (tmp, "c_no_nat_client"), True)
def success_disconnect_cont (check):
- global success
- success = True;
+ print 'Peers disconnected successfully'
+ global success
+ success = True;
def fail_disconnect_cont (check):
- global success
- success = False;
- check.evaluate(True)
+ global success
+ success = False;
+ print 'Peers failed to disconnect'
+ check.evaluate(True)
-
def check_disconnect ():
test.p ('Shutting down bootstrap server')
server.stop ()
@@ -74,18 +76,21 @@
check.add (StatisticsCondition (client, 'core', '# neighbour entries
allocated',0))
check.add (StatisticsCondition (client, 'core', '# peers connected',0))
check.add (StatisticsCondition (client, 'topology', '# peers connected',0))
+ check.add (StatisticsCondition (client, 'dht', '# peers connected',0))
check.add (StatisticsCondition (client, 'fs', '# peers connected',0))
check.run_blocking (check_timeout, success_disconnect_cont,
fail_disconnect_cont)
def success_connect_cont (check):
- check_disconnect ()
+ print 'Peers connected successfully'
+ check_disconnect ()
def fail_connect_cont (check):
- global success
- success= False;
- check.evaluate(True)
+ global success
+ success= False
+ print 'Peers failed to connected!'
+ check.evaluate(True)
def check_connect ():
@@ -94,12 +99,14 @@
check.add (StatisticsCondition (client, 'core', '# neighbour entries
allocated',1))
check.add (StatisticsCondition (client, 'core', '# peers connected',1))
check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
+ check.add (StatisticsCondition (client, 'dht', '# peers connected',1))
check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
check.add (StatisticsCondition (server, 'transport', '# peers connected',1))
check.add (StatisticsCondition (server, 'core', '# neighbour entries
allocated',1))
check.add (StatisticsCondition (server, 'core', '# peers connected',1))
check.add (StatisticsCondition (server, 'topology', '# peers connected',1))
+ check.add (StatisticsCondition (client, 'dht', '# peers connected',1))
check.add (StatisticsCondition (server, 'fs', '# peers connected',1))
check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont)
@@ -108,48 +115,82 @@
# Test execution
#
+def SigHandler(signum = None, frame = None):
+ global success
+ global server
+ global client
+
+ print 'Test was aborted!'
+ if (None != server):
+ server.stop ()
+ if (None != server):
+ client.stop ()
+ cleanup ()
+ sys.exit(success)
+
def run ():
global success
global test
global server
- global client
+ global client
- success = False
+ server = None
+ client = None
+ success = False
- test = Test ('test_integration_disconnect', verbose)
+ for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP,
signal.SIGQUIT]:
+ signal.signal(sig, SigHandler)
+
+ test = Test ('test_integration_bootstrap_and_connect.py', verbose)
+ cleanup ()
server = Peer(test, './confs/c_bootstrap_server.conf');
- server.start();
-
client = Peer(test, './confs/c_no_nat_client.conf');
- client.start();
+ if (True != server.start()):
+ print 'Failed to start server'
+ if (None != server):
+ server.stop ()
+ if (None != server):
+ client.stop ()
+ cleanup ()
+ sys.exit(success)
+ if (True != client.start()):
+ print 'Failed to start client'
+ if (None != server):
+ server.stop ()
+ if (None != server):
+ client.stop ()
+ cleanup ()
+ sys.exit(success)
if ((client.started == True) and (server.started == True)):
- test.p ('Peers started, running check')
- check_connect ()
-
- server.stop ()
+ test.p ('Peers started, running check')
+ time.sleep(5)
+ check_connect ()
+ server.stop ()
client.stop ()
cleanup ()
if (success == False):
print ('Test failed')
+ return False
+ else:
return True
- else:
- return False
-
try:
- run ()
+ run ()
except (KeyboardInterrupt, SystemExit):
- print 'Test interrupted'
- server.stop ()
- client.stop ()
- cleanup ()
+ print 'Test interrupted'
+ server.stop ()
+ client.stop ()
+ cleanup ()
if (success == False):
sys.exit(1)
else:
sys.exit(0)
+
+
+
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31481 - gnunet/src/integration-tests,
gnunet <=