gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31470 - gnunet/src/integration-tests
Date: Tue, 17 Dec 2013 10:01:53 +0100

Author: wachs
Date: 2013-12-17 10:01:53 +0100 (Tue, 17 Dec 2013)
New Revision: 31470

Modified:
   gnunet/src/integration-tests/Makefile.am
   gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in
Log:
additional signal handlers for test


Modified: gnunet/src/integration-tests/Makefile.am
===================================================================
--- gnunet/src/integration-tests/Makefile.am    2013-12-17 08:25:15 UTC (rev 
31469)
+++ gnunet/src/integration-tests/Makefile.am    2013-12-17 09:01:53 UTC (rev 
31470)
@@ -14,8 +14,8 @@
  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 \

Modified: 
gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in   
2013-12-17 08:25:15 UTC (rev 31469)
+++ gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in   
2013-12-17 09:01:53 UTC (rev 31470)
@@ -18,6 +18,7 @@
 #    Boston, MA 02111-1307, USA.
 #
 # 
+import signal
 import sys
 import os
 import subprocess
@@ -48,7 +49,7 @@
 #definitions
 
 testname = "test_integration_bootstrap_and_connect"
-verbose = True
+verbose = False
 check_timeout = 180
 
 if os.name == "nt":
@@ -81,10 +82,12 @@
 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 @@
   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 @@
 # 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 ()
        




reply via email to

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