diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 09:01:53 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 09:01:53 +0000 |
commit | 62462d8259893dd3b3962d5ef39d04d7fc3d7a3e (patch) | |
tree | 9643c3d4b7ab4aaaee00d1d273b45f58f0dbe21f /src/integration-tests | |
parent | 53737cd73f2d854b7887cceb66de65963883fd02 (diff) | |
download | gnunet-62462d8259893dd3b3962d5ef39d04d7fc3d7a3e.tar.gz gnunet-62462d8259893dd3b3962d5ef39d04d7fc3d7a3e.zip |
additional signal handlers for test
Diffstat (limited to 'src/integration-tests')
-rw-r--r-- | src/integration-tests/Makefile.am | 4 | ||||
-rwxr-xr-x | src/integration-tests/test_integration_bootstrap_and_connect.py.in | 27 |
2 files changed, 27 insertions, 4 deletions
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 = \ | |||
14 | gnunet_pyexpect.py | 14 | gnunet_pyexpect.py |
15 | 15 | ||
16 | if HAVE_PYTHON | 16 | if HAVE_PYTHON |
17 | check_SCRIPTS = | 17 | check_SCRIPTS = \ |
18 | # test_integration_bootstrap_and_connect.py | 18 | test_integration_bootstrap_and_connect.py |
19 | # test_integration_bootstrap_and_connect_and_disconnect.py \ | 19 | # test_integration_bootstrap_and_connect_and_disconnect.py \ |
20 | # test_integration_bootstrap_and_connect_and_disconnect_nat.py \ | 20 | # test_integration_bootstrap_and_connect_and_disconnect_nat.py \ |
21 | # test_integration_restart.py \ | 21 | # 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 @@ | |||
18 | # Boston, MA 02111-1307, USA. | 18 | # Boston, MA 02111-1307, USA. |
19 | # | 19 | # |
20 | # | 20 | # |
21 | import signal | ||
21 | import sys | 22 | import sys |
22 | import os | 23 | import os |
23 | import subprocess | 24 | import subprocess |
@@ -48,7 +49,7 @@ from gnunet_testing import * | |||
48 | #definitions | 49 | #definitions |
49 | 50 | ||
50 | testname = "test_integration_bootstrap_and_connect" | 51 | testname = "test_integration_bootstrap_and_connect" |
51 | verbose = True | 52 | verbose = False |
52 | check_timeout = 180 | 53 | check_timeout = 180 |
53 | 54 | ||
54 | if os.name == "nt": | 55 | if os.name == "nt": |
@@ -81,10 +82,12 @@ def cleanup (): | |||
81 | def success_cont (check): | 82 | def success_cont (check): |
82 | global success | 83 | global success |
83 | success = True; | 84 | success = True; |
85 | print 'Peers connected successfully' | ||
84 | 86 | ||
85 | def fail_cont (check): | 87 | def fail_cont (check): |
86 | global success | 88 | global success |
87 | success = False; | 89 | success = False; |
90 | print 'Peers did not connect' | ||
88 | check.evaluate(True) | 91 | check.evaluate(True) |
89 | 92 | ||
90 | def check (): | 93 | def check (): |
@@ -93,13 +96,14 @@ def check (): | |||
93 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1)) | 96 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1)) |
94 | check.add (StatisticsCondition (client, 'core', '# peers connected',1)) | 97 | check.add (StatisticsCondition (client, 'core', '# peers connected',1)) |
95 | check.add (StatisticsCondition (client, 'topology', '# peers connected',1)) | 98 | check.add (StatisticsCondition (client, 'topology', '# peers connected',1)) |
99 | check.add (StatisticsCondition (client, 'dht', '# peers connected',1)) | ||
96 | check.add (StatisticsCondition (client, 'fs', '# peers connected',1)) | 100 | check.add (StatisticsCondition (client, 'fs', '# peers connected',1)) |
97 | 101 | ||
98 | |||
99 | check.add (StatisticsCondition (server, 'transport', '# peers connected',1)) | 102 | check.add (StatisticsCondition (server, 'transport', '# peers connected',1)) |
100 | check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',1)) | 103 | check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',1)) |
101 | check.add (StatisticsCondition (server, 'core', '# peers connected',1)) | 104 | check.add (StatisticsCondition (server, 'core', '# peers connected',1)) |
102 | check.add (StatisticsCondition (server, 'topology', '# peers connected',1)) | 105 | check.add (StatisticsCondition (server, 'topology', '# peers connected',1)) |
106 | check.add (StatisticsCondition (server, 'dht', '# peers connected',1)) | ||
103 | check.add (StatisticsCondition (server, 'fs', '# peers connected',1)) | 107 | check.add (StatisticsCondition (server, 'fs', '# peers connected',1)) |
104 | 108 | ||
105 | check.run_blocking (check_timeout, success_cont, fail_cont) | 109 | check.run_blocking (check_timeout, success_cont, fail_cont) |
@@ -108,13 +112,32 @@ def check (): | |||
108 | # Test execution | 112 | # Test execution |
109 | # | 113 | # |
110 | 114 | ||
115 | def SigHandler(signum = None, frame = None): | ||
116 | global success | ||
117 | global server | ||
118 | global client | ||
119 | |||
120 | print 'Test was aborted!' | ||
121 | if (None != server): | ||
122 | server.stop () | ||
123 | if (None != server): | ||
124 | client.stop () | ||
125 | cleanup () | ||
126 | sys.exit(success) | ||
127 | |||
111 | def run (): | 128 | def run (): |
112 | global success | 129 | global success |
113 | global test | 130 | global test |
114 | global server | 131 | global server |
115 | global client | 132 | global client |
116 | 133 | ||
134 | server = None | ||
135 | client = None | ||
117 | success = False | 136 | success = False |
137 | |||
138 | for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: | ||
139 | signal.signal(sig, SigHandler) | ||
140 | |||
118 | test = Test ('test_integration_bootstrap_and_connect.py', verbose) | 141 | test = Test ('test_integration_bootstrap_and_connect.py', verbose) |
119 | cleanup () | 142 | cleanup () |
120 | 143 | ||