- typo
[oweals/gnunet.git] / src / integration-tests / test_integration_connect_on_restart.py.in
index 7215b9bf38e43ad0315ac2fb76754a191f346830..3fe5756e6efc9f9602d799c84f103ba4654f0486 100755 (executable)
@@ -45,16 +45,42 @@ testname = "test_integration_clique"
 verbose = True
 check_timeout = 180
 
+if os.name == "nt":
+  tmp = os.getenv ("TEMP")
+else:
+  tmp = "/tmp"
 
 def cleanup ():
-       if os.name == "nt":
-           shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_bootstrap_server"), True)
-           shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_no_nat_client"), True)
-           shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_no_nat_client_2"), True)
-       else:
-           shutil.rmtree ("/tmp/c_bootstrap_server/", True)
-           shutil.rmtree ("/tmp/c_no_nat_client/", True)
-           shutil.rmtree ("/tmp/c_no_nat_client_2/", True)
+    retries = 10
+    path = os.path.join (tmp, "c_bootstrap_server")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path)
+    
+    retries = 10
+    path = os.path.join (tmp, "c_no_nat_client")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path)
+    
+        retries = 10
+    path = os.path.join (tmp, "c_no_nat_client_2")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path)
+    shutil.rmtree (os.path.join (tmp, "c_no_nat_client_2"), True)
 
 
 def success_cont (check):
@@ -136,6 +162,7 @@ def run ():
        success = False
        
        test = Test ('test_integration_disconnect', verbose)
+       cleanup ()
        
        server = Peer(test, './confs/c_bootstrap_server.conf');
        server.start();