gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31703 - gnunet/src/integration-tests
Date: Mon, 23 Dec 2013 14:35:18 +0100

Author: LRN
Date: 2013-12-23 14:35:18 +0100 (Mon, 23 Dec 2013)
New Revision: 31703

Modified:
   gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in
   gnunet/src/integration-tests/test_integration_clique.py.in
   gnunet/src/integration-tests/test_integration_disconnect.py.in
   gnunet/src/integration-tests/test_integration_disconnect_nat.py.in
   gnunet/src/integration-tests/test_integration_reconnect.py.in
   gnunet/src/integration-tests/test_integration_reconnect_nat.py.in
Log:
W32-compatible integartion tests, try to handle rmtree()ing of read-only files

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-23 11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in   
2013-12-23 13:35:18 UTC (rev 31703)
@@ -54,15 +54,28 @@
 
 if os.name == "nt":
   tmp = os.getenv ("TEMP")
+  signals = [signal.SIGTERM, signal.SIGINT]
 else:
   tmp = "/tmp"
+  signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
+
 def cleanup ():
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -73,7 +86,7 @@
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -135,7 +148,7 @@
        client = None
        success = False  
        
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+       for sig in signals:
                signal.signal(sig, SigHandler)
 
        test = Test ('test_integration_bootstrap_and_connect.py', verbose)

Modified: gnunet/src/integration-tests/test_integration_clique.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_clique.py.in  2013-12-23 
11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_clique.py.in  2013-12-23 
13:35:18 UTC (rev 31703)
@@ -49,13 +49,23 @@
 verbose = True
 check_timeout = 180
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
 
 def cleanup ():
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -64,7 +74,7 @@
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -73,7 +83,7 @@
     path = os.path.join (tmp, "c_nat_client")  
     test.p ("Removing " + path)      
     while ((os.path.exists(path)) and (retries > 0)):
-        shutil.rmtree ((path), False)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):

Modified: gnunet/src/integration-tests/test_integration_disconnect.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_disconnect.py.in      
2013-12-23 11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_disconnect.py.in      
2013-12-23 13:35:18 UTC (rev 31703)
@@ -48,12 +48,25 @@
 
 if os.name == "nt":
   tmp = os.getenv ("TEMP")
+  signals = [signal.SIGTERM, signal.SIGINT]
 else:
   tmp = "/tmp"
+  signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
+
 def cleanup ():
-  shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True)
-  shutil.rmtree (os.path.join (tmp, "c_no_nat_client"), True)
+  shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), False, 
cleanup_onerror)
+  shutil.rmtree (os.path.join (tmp, "c_no_nat_client"), False, cleanup_onerror)
 
 
 def success_disconnect_cont (check):
@@ -138,7 +151,7 @@
        client = None
        success = False  
        
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+       for sig in signals:
                signal.signal(sig, SigHandler)
 
        test = Test ('test_integration_bootstrap_and_connect.py', verbose)

Modified: gnunet/src/integration-tests/test_integration_disconnect_nat.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_disconnect_nat.py.in  
2013-12-23 11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_disconnect_nat.py.in  
2013-12-23 13:35:18 UTC (rev 31703)
@@ -48,12 +48,25 @@
 
 if os.name == "nt":
   tmp = os.getenv ("TEMP")
+  signals = [signal.SIGTERM, signal.SIGINT]
 else:
   tmp = "/tmp"
+  signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
+
 def cleanup ():
-  shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True)
-  shutil.rmtree (os.path.join (tmp, "c_nat_client"), True)
+  shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), False, 
cleanup_onerror)
+  shutil.rmtree (os.path.join (tmp, "c_nat_client"), False, cleanup_onerror)
 
 
 def success_disconnect_cont (check):
@@ -142,7 +155,7 @@
        nat_client = None
        success = False  
        
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+       for sig in signals:
                signal.signal(sig, SigHandler)
 
        test = Test ('test_integration_bootstrap_and_connect.py', verbose)

Modified: gnunet/src/integration-tests/test_integration_reconnect.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_reconnect.py.in       
2013-12-23 11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_reconnect.py.in       
2013-12-23 13:35:18 UTC (rev 31703)
@@ -49,15 +49,28 @@
 
 if os.name == "nt":
   tmp = os.getenv ("TEMP")
+  signals = [signal.SIGTERM, signal.SIGINT]
 else:
   tmp = "/tmp"
+  signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
+
 def cleanup ():
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -68,7 +81,7 @@
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -167,7 +180,7 @@
        server = None
        client = None   
 
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+       for sig in signals:
                signal.signal(sig, SigHandler)
        
        

Modified: gnunet/src/integration-tests/test_integration_reconnect_nat.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_reconnect_nat.py.in   
2013-12-23 11:14:37 UTC (rev 31702)
+++ gnunet/src/integration-tests/test_integration_reconnect_nat.py.in   
2013-12-23 13:35:18 UTC (rev 31703)
@@ -49,15 +49,28 @@
 
 if os.name == "nt":
   tmp = os.getenv ("TEMP")
+  signals = [signal.SIGTERM, signal.SIGINT]
 else:
   tmp = "/tmp"
+  signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
 
+def cleanup_onerror (function, path, excinfo):
+  import stat
+  if not os.path.exists (path):
+    pass
+  elif not os.access(path, os.W_OK):
+    # Is the error an access error ?
+    os.chmod (path, stat.S_IWUSR)
+    function (path)
+  else:
+    raise
+
 def cleanup ():
     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)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -68,7 +81,7 @@
     path = os.path.join (tmp, "c_nat_client")  
     test.p ("Removing " + path)      
     while ((os.path.exists(path)) and (retries > 0)):
-        shutil.rmtree ((path), False)
+        shutil.rmtree ((path), False, cleanup_onerror)
         time.sleep (1)
         retries -= 1
     if (os.path.exists(path)):
@@ -167,7 +180,7 @@
        server = None
        client = None   
 
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+       for sig in signals:
                signal.signal(sig, SigHandler)
        
        




reply via email to

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