diff options
author | LRN <lrn1986@gmail.com> | 2013-12-23 13:35:18 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-12-23 13:35:18 +0000 |
commit | 6d14d67719b6057939b1dd948e4e74663a1c19e8 (patch) | |
tree | 5a0ceff12c7bf8cd1e5033faa4971ef09d0574ab /src/integration-tests/test_integration_clique.py.in | |
parent | f07469475bb254bae5b66a894087bad7d2d600bb (diff) | |
download | gnunet-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_clique.py.in')
-rwxr-xr-x | src/integration-tests/test_integration_clique.py.in | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/integration-tests/test_integration_clique.py.in b/src/integration-tests/test_integration_clique.py.in index 85da2f803..12f99a837 100755 --- a/src/integration-tests/test_integration_clique.py.in +++ b/src/integration-tests/test_integration_clique.py.in | |||
@@ -49,13 +49,23 @@ testname = "test_integration_clique" | |||
49 | verbose = True | 49 | verbose = True |
50 | check_timeout = 180 | 50 | check_timeout = 180 |
51 | 51 | ||
52 | def cleanup_onerror (function, path, excinfo): | ||
53 | import stat | ||
54 | if not os.path.exists (path): | ||
55 | pass | ||
56 | elif not os.access(path, os.W_OK): | ||
57 | # Is the error an access error ? | ||
58 | os.chmod (path, stat.S_IWUSR) | ||
59 | function (path) | ||
60 | else: | ||
61 | raise | ||
52 | 62 | ||
53 | def cleanup (): | 63 | def cleanup (): |
54 | retries = 10 | 64 | retries = 10 |
55 | path = os.path.join (tmp, "c_bootstrap_server") | 65 | path = os.path.join (tmp, "c_bootstrap_server") |
56 | test.p ("Removing " + path) | 66 | test.p ("Removing " + path) |
57 | while ((os.path.exists(path)) and (retries > 0)): | 67 | while ((os.path.exists(path)) and (retries > 0)): |
58 | shutil.rmtree ((path), False) | 68 | shutil.rmtree ((path), False, cleanup_onerror) |
59 | time.sleep (1) | 69 | time.sleep (1) |
60 | retries -= 1 | 70 | retries -= 1 |
61 | if (os.path.exists(path)): | 71 | if (os.path.exists(path)): |
@@ -64,7 +74,7 @@ def cleanup (): | |||
64 | path = os.path.join (tmp, "c_no_nat_client") | 74 | path = os.path.join (tmp, "c_no_nat_client") |
65 | test.p ("Removing " + path) | 75 | test.p ("Removing " + path) |
66 | while ((os.path.exists(path)) and (retries > 0)): | 76 | while ((os.path.exists(path)) and (retries > 0)): |
67 | shutil.rmtree ((path), False) | 77 | shutil.rmtree ((path), False, cleanup_onerror) |
68 | time.sleep (1) | 78 | time.sleep (1) |
69 | retries -= 1 | 79 | retries -= 1 |
70 | if (os.path.exists(path)): | 80 | if (os.path.exists(path)): |
@@ -73,7 +83,7 @@ def cleanup (): | |||
73 | path = os.path.join (tmp, "c_nat_client") | 83 | path = os.path.join (tmp, "c_nat_client") |
74 | test.p ("Removing " + path) | 84 | test.p ("Removing " + path) |
75 | while ((os.path.exists(path)) and (retries > 0)): | 85 | while ((os.path.exists(path)) and (retries > 0)): |
76 | shutil.rmtree ((path), False) | 86 | shutil.rmtree ((path), False, cleanup_onerror) |
77 | time.sleep (1) | 87 | time.sleep (1) |
78 | retries -= 1 | 88 | retries -= 1 |
79 | if (os.path.exists(path)): | 89 | if (os.path.exists(path)): |