doxygen fix
[oweals/gnunet.git] / src / integration-tests / test_integration_clique.py.in
index ce254ca7b43efa8d9787283fdeeaba4d6744eb17..49a2c592c551346f2dd8edbc615ca8d201982d8e 100755 (executable)
@@ -42,7 +42,7 @@ from gnunet_testing import *
 
 testname = "test_integration_clique"
 verbose = True
-check_timeout = 120
+check_timeout = 30
 
 
 def cleanup ():
@@ -63,7 +63,7 @@ def success_cont (check):
 def fail_cont (check):    
     global success 
     success= False;
-    check.eval(True)        
+    check.evaluate(True)        
 
 
 def check_disconnect_client ():
@@ -87,7 +87,7 @@ def success_disconnect_server_cont (check):
 def fail_disconnect_server_cont (check):    
     global success 
     success= False;
-    check.eval(True)        
+    check.evaluate(True)        
 
         
 def check_disconnect_server ():
@@ -116,7 +116,7 @@ def success_connect_cont (check):
 def fail_connect_cont (check):    
     global success 
     success= False;
-    check.eval(True)
+    check.evaluate(True)
 
 
 def check_connect ():
@@ -144,33 +144,54 @@ def check_connect ():
 # 
 # Test execution
 # 
+def run ():
+       global success
+       global test
+       global server
+       global client
+       global client2  
+       
+       success = False
+       
+       test = Test ('test_integration_disconnect', verbose)
+       
+       server = Peer(test, './confs/c_bootstrap_server.conf');
+       server.start();
+       
+       client = Peer(test, './confs/c_no_nat_client.conf');
+       client.start();
+       
+       client2 = Peer(test, './confs/c_no_nat_client_2.conf');
+       client2.start();
+       
+       if ((client.started == True) and (client2.started == True) and (server.started == True)):
+           test.p ('Peers started, running check')
+           check_connect ()
+           
+       server.stop ()    
+       client.stop ()
+       client2.stop ()
+       
+       cleanup ()
+       
+       if (success == False):
+               print ('Test failed')
+               return False 
+       else:
+               return True
 
-success = False
-
-test = Test ('test_integration_disconnect', verbose)
-
-server = Peer(test, './confs/c_bootstrap_server.conf');
-server.start();
-
-client = Peer(test, './confs/c_no_nat_client.conf');
-client.start();
-
-client2 = Peer(test, './confs/c_no_nat_client_2.conf');
-client2.start();
-
-if ((client.started == True) and (client2.started == True) and (server.started == True)):
-    test.p ('Peers started, running check')
-    check_connect ()
     
-server.stop ()    
-client.stop ()
-client2.stop ()
-
-cleanup ()
-
+try:
+    run ()
+except (KeyboardInterrupt, SystemExit):    
+    print 'Test interrupted'
+    server.stop ()
+    client.stop ()
+    client2.stop ()
+    cleanup ()
 if (success == False):
-    print ('Test failed')
-    exit (1)
+       sys.exit(1)   
 else:
-    exit (0)
+       sys.exit(0)    
+