gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31475 - gnunet/src/integration-tests


From: gnunet
Subject: [GNUnet-SVN] r31475 - gnunet/src/integration-tests
Date: Tue, 17 Dec 2013 14:14:29 +0100

Author: wachs
Date: 2013-12-17 14:14:28 +0100 (Tue, 17 Dec 2013)
New Revision: 31475

Modified:
   gnunet/src/integration-tests/Makefile.am
   gnunet/src/integration-tests/test_integration_restart.py.in
Log:
restart test


Modified: gnunet/src/integration-tests/Makefile.am
===================================================================
--- gnunet/src/integration-tests/Makefile.am    2013-12-17 12:34:35 UTC (rev 
31474)
+++ gnunet/src/integration-tests/Makefile.am    2013-12-17 13:14:28 UTC (rev 
31475)
@@ -15,10 +15,10 @@
 
 if HAVE_PYTHON
 check_SCRIPTS = \
-  test_integration_bootstrap_and_connect.py
-# test_integration_bootstrap_and_connect_and_disconnect.py \
+  test_integration_bootstrap_and_connect.py \
+  test_integration_restart.py
+#  test_integration_bootstrap_and_connect_and_disconnect.py \
 # test_integration_bootstrap_and_connect_and_disconnect_nat.py \
-# test_integration_restart.py \
 # test_integration_clique.py \
 # test_integration_clique_nat.py \
 # test_integration_connect_on_restart.py
@@ -46,10 +46,13 @@
        $(do_subst) < $(srcdir)/gnunet_pyexpect.py.in > gnunet_pyexpect.py
        chmod +x gnunet_pyexpect.py
 
-test_integration_bootstrap_andconnect.py: 
test_integration_bootstrap_and_connect.py.in Makefile
+test_integration_bootstrap_and_connect.py: 
test_integration_bootstrap_and_connect.py.in Makefile
        $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > 
test_integration_bootstrap_and_connect.py
        chmod +x test_integration_bootstrap_and_connect.py
 
+
+
+
 test_integration_bootstrap_and_connect_and_disconnect.py: 
test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile
        $(do_subst) < 
$(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > 
test_integration_bootstrap_and_connect_and_disconnect.py
        chmod +x test_integration_bootstrap_and_connect_and_disconnect.py

Modified: gnunet/src/integration-tests/test_integration_restart.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_restart.py.in 2013-12-17 
12:34:35 UTC (rev 31474)
+++ gnunet/src/integration-tests/test_integration_restart.py.in 2013-12-17 
13:14:28 UTC (rev 31475)
@@ -24,6 +24,7 @@
 import re
 import shutil
 import time
+import signal
 from gnunet_testing import Peer
 from gnunet_testing import Test
 from gnunet_testing import Check
@@ -43,7 +44,7 @@
 
 
 testname = "test_integration_restart"
-verbose = False
+verbose = True
 check_timeout = 180
 
 if os.name == "nt":
@@ -75,7 +76,7 @@
 
 def success_restart_cont (check):
        global success 
-       test.p ('Shutting down client & server')
+       print 'Peers connected successfully after restart'
        server.stop ()
        client.stop ()
        success = True; 
@@ -84,11 +85,12 @@
 def fail_restart_cont (check):    
        global success 
        success = False;
+       print 'Peers failed to connect after restart'
        check.evaluate(True)   
     
 
 def success_connect_cont (check):
-       test.p ('Shutting down client & server for restart')
+       print 'Peers connected successfully'
        server.stop ()
        client.stop ()
        
@@ -115,9 +117,10 @@
 
 
 def fail_connect_cont (check):    
-    global success 
-    success= False;
-    check.evaluate(True)
+       global success 
+       success= False;
+       print 'Peers failed to connect'
+       check.evaluate(True)
 
 
 def check_connect ():
@@ -140,6 +143,20 @@
 # 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
@@ -147,7 +164,13 @@
        global client
        
        success = False
+       server = None
+       client = None   
+
+       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+               signal.signal(sig, SigHandler)
        
+       
        test = Test ('test_integration_disconnect', verbose)
        cleanup ()
        server = Peer(test, './confs/c_bootstrap_server.conf');
@@ -156,14 +179,28 @@
        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 ()
-               
+       check_connect ()
+       
        server.stop ()    
        client.stop ()
-       
        cleanup ()
        
        if (success == False):
@@ -184,4 +221,5 @@
        sys.exit(1)   
 else:
        sys.exit(0)    
+
        
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]