diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 13:14:28 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 13:14:28 +0000 |
commit | 38c5aeaf3d64107f73ac1446d702676b3a492161 (patch) | |
tree | 3c5045b75fedb80348c77a59bd0b12d43aeb89d4 /src/integration-tests | |
parent | 98850ede1551a3ee4490c15363455d9105e63ce0 (diff) | |
download | gnunet-38c5aeaf3d64107f73ac1446d702676b3a492161.tar.gz gnunet-38c5aeaf3d64107f73ac1446d702676b3a492161.zip |
restart test
Diffstat (limited to 'src/integration-tests')
-rw-r--r-- | src/integration-tests/Makefile.am | 11 | ||||
-rwxr-xr-x | src/integration-tests/test_integration_restart.py.in | 60 |
2 files changed, 56 insertions, 15 deletions
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am index de579c939..c986b2c3a 100644 --- a/src/integration-tests/Makefile.am +++ b/src/integration-tests/Makefile.am | |||
@@ -15,10 +15,10 @@ noinst_SCRIPTS = \ | |||
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_restart.py |
20 | # test_integration_bootstrap_and_connect_and_disconnect.py \ | ||
20 | # test_integration_bootstrap_and_connect_and_disconnect_nat.py \ | 21 | # test_integration_bootstrap_and_connect_and_disconnect_nat.py \ |
21 | # test_integration_restart.py \ | ||
22 | # test_integration_clique.py \ | 22 | # test_integration_clique.py \ |
23 | # test_integration_clique_nat.py \ | 23 | # test_integration_clique_nat.py \ |
24 | # test_integration_connect_on_restart.py | 24 | # test_integration_connect_on_restart.py |
@@ -46,10 +46,13 @@ gnunet_pyexpect.py: gnunet_pyexpect.py.in Makefile | |||
46 | $(do_subst) < $(srcdir)/gnunet_pyexpect.py.in > gnunet_pyexpect.py | 46 | $(do_subst) < $(srcdir)/gnunet_pyexpect.py.in > gnunet_pyexpect.py |
47 | chmod +x gnunet_pyexpect.py | 47 | chmod +x gnunet_pyexpect.py |
48 | 48 | ||
49 | test_integration_bootstrap_andconnect.py: test_integration_bootstrap_and_connect.py.in Makefile | 49 | test_integration_bootstrap_and_connect.py: test_integration_bootstrap_and_connect.py.in Makefile |
50 | $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py | 50 | $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py |
51 | chmod +x test_integration_bootstrap_and_connect.py | 51 | chmod +x test_integration_bootstrap_and_connect.py |
52 | 52 | ||
53 | |||
54 | |||
55 | |||
53 | test_integration_bootstrap_and_connect_and_disconnect.py: test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile | 56 | test_integration_bootstrap_and_connect_and_disconnect.py: test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile |
54 | $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > test_integration_bootstrap_and_connect_and_disconnect.py | 57 | $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > test_integration_bootstrap_and_connect_and_disconnect.py |
55 | chmod +x test_integration_bootstrap_and_connect_and_disconnect.py | 58 | chmod +x test_integration_bootstrap_and_connect_and_disconnect.py |
diff --git a/src/integration-tests/test_integration_restart.py.in b/src/integration-tests/test_integration_restart.py.in index 49a967228..62bd4bd98 100755 --- a/src/integration-tests/test_integration_restart.py.in +++ b/src/integration-tests/test_integration_restart.py.in | |||
@@ -24,6 +24,7 @@ import subprocess | |||
24 | import re | 24 | import re |
25 | import shutil | 25 | import shutil |
26 | import time | 26 | import time |
27 | import signal | ||
27 | from gnunet_testing import Peer | 28 | from gnunet_testing import Peer |
28 | from gnunet_testing import Test | 29 | from gnunet_testing import Test |
29 | from gnunet_testing import Check | 30 | from gnunet_testing import Check |
@@ -43,7 +44,7 @@ from gnunet_testing import * | |||
43 | 44 | ||
44 | 45 | ||
45 | testname = "test_integration_restart" | 46 | testname = "test_integration_restart" |
46 | verbose = False | 47 | verbose = True |
47 | check_timeout = 180 | 48 | check_timeout = 180 |
48 | 49 | ||
49 | if os.name == "nt": | 50 | if os.name == "nt": |
@@ -75,7 +76,7 @@ def cleanup (): | |||
75 | 76 | ||
76 | def success_restart_cont (check): | 77 | def success_restart_cont (check): |
77 | global success | 78 | global success |
78 | test.p ('Shutting down client & server') | 79 | print 'Peers connected successfully after restart' |
79 | server.stop () | 80 | server.stop () |
80 | client.stop () | 81 | client.stop () |
81 | success = True; | 82 | success = True; |
@@ -84,11 +85,12 @@ def success_restart_cont (check): | |||
84 | def fail_restart_cont (check): | 85 | def fail_restart_cont (check): |
85 | global success | 86 | global success |
86 | success = False; | 87 | success = False; |
88 | print 'Peers failed to connect after restart' | ||
87 | check.evaluate(True) | 89 | check.evaluate(True) |
88 | 90 | ||
89 | 91 | ||
90 | def success_connect_cont (check): | 92 | def success_connect_cont (check): |
91 | test.p ('Shutting down client & server for restart') | 93 | print 'Peers connected successfully' |
92 | server.stop () | 94 | server.stop () |
93 | client.stop () | 95 | client.stop () |
94 | 96 | ||
@@ -115,9 +117,10 @@ def success_connect_cont (check): | |||
115 | 117 | ||
116 | 118 | ||
117 | def fail_connect_cont (check): | 119 | def fail_connect_cont (check): |
118 | global success | 120 | global success |
119 | success= False; | 121 | success= False; |
120 | check.evaluate(True) | 122 | print 'Peers failed to connect' |
123 | check.evaluate(True) | ||
121 | 124 | ||
122 | 125 | ||
123 | def check_connect (): | 126 | def check_connect (): |
@@ -140,6 +143,20 @@ def check_connect (): | |||
140 | # Test execution | 143 | # Test execution |
141 | # | 144 | # |
142 | 145 | ||
146 | |||
147 | def SigHandler(signum = None, frame = None): | ||
148 | global success | ||
149 | global server | ||
150 | global client | ||
151 | |||
152 | print 'Test was aborted!' | ||
153 | if (None != server): | ||
154 | server.stop () | ||
155 | if (None != server): | ||
156 | client.stop () | ||
157 | cleanup () | ||
158 | sys.exit(success) | ||
159 | |||
143 | def run (): | 160 | def run (): |
144 | global success | 161 | global success |
145 | global test | 162 | global test |
@@ -147,6 +164,12 @@ def run (): | |||
147 | global client | 164 | global client |
148 | 165 | ||
149 | success = False | 166 | success = False |
167 | server = None | ||
168 | client = None | ||
169 | |||
170 | for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: | ||
171 | signal.signal(sig, SigHandler) | ||
172 | |||
150 | 173 | ||
151 | test = Test ('test_integration_disconnect', verbose) | 174 | test = Test ('test_integration_disconnect', verbose) |
152 | cleanup () | 175 | cleanup () |
@@ -156,14 +179,28 @@ def run (): | |||
156 | client = Peer(test, './confs/c_no_nat_client.conf'); | 179 | client = Peer(test, './confs/c_no_nat_client.conf'); |
157 | client.start(); | 180 | client.start(); |
158 | 181 | ||
182 | |||
183 | if (True != server.start()): | ||
184 | print 'Failed to start server' | ||
185 | if (None != server): | ||
186 | server.stop () | ||
187 | if (None != server): | ||
188 | client.stop () | ||
189 | cleanup () | ||
190 | sys.exit(success) | ||
191 | if (True != client.start()): | ||
192 | print 'Failed to start client' | ||
193 | if (None != server): | ||
194 | server.stop () | ||
195 | if (None != server): | ||
196 | client.stop () | ||
197 | cleanup () | ||
198 | sys.exit(success) | ||
199 | |||
200 | check_connect () | ||
159 | 201 | ||
160 | if ((client.started == True) and (server.started == True)): | ||
161 | test.p ('Peers started, running check') | ||
162 | check_connect () | ||
163 | |||
164 | server.stop () | 202 | server.stop () |
165 | client.stop () | 203 | client.stop () |
166 | |||
167 | cleanup () | 204 | cleanup () |
168 | 205 | ||
169 | if (success == False): | 206 | if (success == False): |
@@ -184,4 +221,5 @@ if (success == False): | |||
184 | sys.exit(1) | 221 | sys.exit(1) |
185 | else: | 222 | else: |
186 | sys.exit(0) | 223 | sys.exit(0) |
224 | |||
187 | \ No newline at end of file | 225 | \ No newline at end of file |