aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-17 13:14:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-17 13:14:28 +0000
commit38c5aeaf3d64107f73ac1446d702676b3a492161 (patch)
tree3c5045b75fedb80348c77a59bd0b12d43aeb89d4 /src/integration-tests
parent98850ede1551a3ee4490c15363455d9105e63ce0 (diff)
downloadgnunet-38c5aeaf3d64107f73ac1446d702676b3a492161.tar.gz
gnunet-38c5aeaf3d64107f73ac1446d702676b3a492161.zip
restart test
Diffstat (limited to 'src/integration-tests')
-rw-r--r--src/integration-tests/Makefile.am11
-rwxr-xr-xsrc/integration-tests/test_integration_restart.py.in60
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
16if HAVE_PYTHON 16if HAVE_PYTHON
17check_SCRIPTS = \ 17check_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
49test_integration_bootstrap_andconnect.py: test_integration_bootstrap_and_connect.py.in Makefile 49test_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
53test_integration_bootstrap_and_connect_and_disconnect.py: test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile 56test_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
24import re 24import re
25import shutil 25import shutil
26import time 26import time
27import signal
27from gnunet_testing import Peer 28from gnunet_testing import Peer
28from gnunet_testing import Test 29from gnunet_testing import Test
29from gnunet_testing import Check 30from gnunet_testing import Check
@@ -43,7 +44,7 @@ from gnunet_testing import *
43 44
44 45
45testname = "test_integration_restart" 46testname = "test_integration_restart"
46verbose = False 47verbose = True
47check_timeout = 180 48check_timeout = 180
48 49
49if os.name == "nt": 50if os.name == "nt":
@@ -75,7 +76,7 @@ def cleanup ():
75 76
76def success_restart_cont (check): 77def 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):
84def fail_restart_cont (check): 85def 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
90def success_connect_cont (check): 92def 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
117def fail_connect_cont (check): 119def 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
123def check_connect (): 126def check_connect ():
@@ -140,6 +143,20 @@ def check_connect ():
140# Test execution 143# Test execution
141# 144#
142 145
146
147def 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
143def run (): 160def 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)
185else: 222else:
186 sys.exit(0) 223 sys.exit(0)
224
187 \ No newline at end of file 225 \ No newline at end of file