aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests/test_integration_bootstrap_and_connect.py.in
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-23 13:35:18 +0000
committerLRN <lrn1986@gmail.com>2013-12-23 13:35:18 +0000
commit6d14d67719b6057939b1dd948e4e74663a1c19e8 (patch)
tree5a0ceff12c7bf8cd1e5033faa4971ef09d0574ab /src/integration-tests/test_integration_bootstrap_and_connect.py.in
parentf07469475bb254bae5b66a894087bad7d2d600bb (diff)
downloadgnunet-6d14d67719b6057939b1dd948e4e74663a1c19e8.tar.gz
gnunet-6d14d67719b6057939b1dd948e4e74663a1c19e8.zip
W32-compatible integartion tests, try to handle rmtree()ing of read-only files
Diffstat (limited to 'src/integration-tests/test_integration_bootstrap_and_connect.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_bootstrap_and_connect.py.in19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
index c3e2da73d..d086bcc53 100755
--- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in
+++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
@@ -54,15 +54,28 @@ check_timeout = 180
54 54
55if os.name == "nt": 55if os.name == "nt":
56 tmp = os.getenv ("TEMP") 56 tmp = os.getenv ("TEMP")
57 signals = [signal.SIGTERM, signal.SIGINT]
57else: 58else:
58 tmp = "/tmp" 59 tmp = "/tmp"
60 signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]
61
62def cleanup_onerror (function, path, excinfo):
63 import stat
64 if not os.path.exists (path):
65 pass
66 elif not os.access(path, os.W_OK):
67 # Is the error an access error ?
68 os.chmod (path, stat.S_IWUSR)
69 function (path)
70 else:
71 raise
59 72
60def cleanup (): 73def cleanup ():
61 retries = 10 74 retries = 10
62 path = os.path.join (tmp, "c_bootstrap_server") 75 path = os.path.join (tmp, "c_bootstrap_server")
63 test.p ("Removing " + path) 76 test.p ("Removing " + path)
64 while ((os.path.exists(path)) and (retries > 0)): 77 while ((os.path.exists(path)) and (retries > 0)):
65 shutil.rmtree ((path), False) 78 shutil.rmtree ((path), False, cleanup_onerror)
66 time.sleep (1) 79 time.sleep (1)
67 retries -= 1 80 retries -= 1
68 if (os.path.exists(path)): 81 if (os.path.exists(path)):
@@ -73,7 +86,7 @@ def cleanup ():
73 path = os.path.join (tmp, "c_no_nat_client") 86 path = os.path.join (tmp, "c_no_nat_client")
74 test.p ("Removing " + path) 87 test.p ("Removing " + path)
75 while ((os.path.exists(path)) and (retries > 0)): 88 while ((os.path.exists(path)) and (retries > 0)):
76 shutil.rmtree ((path), False) 89 shutil.rmtree ((path), False, cleanup_onerror)
77 time.sleep (1) 90 time.sleep (1)
78 retries -= 1 91 retries -= 1
79 if (os.path.exists(path)): 92 if (os.path.exists(path)):
@@ -135,7 +148,7 @@ def run ():
135 client = None 148 client = None
136 success = False 149 success = False
137 150
138 for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: 151 for sig in signals:
139 signal.signal(sig, SigHandler) 152 signal.signal(sig, SigHandler)
140 153
141 test = Test ('test_integration_bootstrap_and_connect.py', verbose) 154 test = Test ('test_integration_bootstrap_and_connect.py', verbose)