From 62462d8259893dd3b3962d5ef39d04d7fc3d7a3e Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 17 Dec 2013 09:01:53 +0000 Subject: additional signal handlers for test --- src/integration-tests/Makefile.am | 4 ++-- .../test_integration_bootstrap_and_connect.py.in | 27 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am index 3748636e9..de579c939 100644 --- a/src/integration-tests/Makefile.am +++ b/src/integration-tests/Makefile.am @@ -14,8 +14,8 @@ noinst_SCRIPTS = \ gnunet_pyexpect.py if HAVE_PYTHON -check_SCRIPTS = -# test_integration_bootstrap_and_connect.py +check_SCRIPTS = \ + test_integration_bootstrap_and_connect.py # test_integration_bootstrap_and_connect_and_disconnect.py \ # test_integration_bootstrap_and_connect_and_disconnect_nat.py \ # test_integration_restart.py \ diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in index 25a1fc5dd..afc55ca40 100755 --- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in +++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in @@ -18,6 +18,7 @@ # Boston, MA 02111-1307, USA. # # +import signal import sys import os import subprocess @@ -48,7 +49,7 @@ from gnunet_testing import * #definitions testname = "test_integration_bootstrap_and_connect" -verbose = True +verbose = False check_timeout = 180 if os.name == "nt": @@ -81,10 +82,12 @@ def cleanup (): def success_cont (check): global success success = True; + print 'Peers connected successfully' def fail_cont (check): global success success = False; + print 'Peers did not connect' check.evaluate(True) def check (): @@ -93,13 +96,14 @@ def check (): 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 (server, 'dht', '# peers connected',1)) check.add (StatisticsCondition (server, 'fs', '# peers connected',1)) check.run_blocking (check_timeout, success_cont, fail_cont) @@ -108,13 +112,32 @@ def check (): # 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 + server = None + client = None success = False + + 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 () -- cgit v1.2.3