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_disconnect_nat.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_disconnect_nat.py.in')
-rwxr-xr-x | src/integration-tests/test_integration_disconnect_nat.py.in | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/integration-tests/test_integration_disconnect_nat.py.in b/src/integration-tests/test_integration_disconnect_nat.py.in index 0130c618d..c7223c2ae 100755 --- a/src/integration-tests/test_integration_disconnect_nat.py.in +++ b/src/integration-tests/test_integration_disconnect_nat.py.in | |||
@@ -48,12 +48,25 @@ check_timeout = 180 | |||
48 | 48 | ||
49 | if os.name == "nt": | 49 | if os.name == "nt": |
50 | tmp = os.getenv ("TEMP") | 50 | tmp = os.getenv ("TEMP") |
51 | signals = [signal.SIGTERM, signal.SIGINT] | ||
51 | else: | 52 | else: |
52 | tmp = "/tmp" | 53 | tmp = "/tmp" |
54 | signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT] | ||
55 | |||
56 | def cleanup_onerror (function, path, excinfo): | ||
57 | import stat | ||
58 | if not os.path.exists (path): | ||
59 | pass | ||
60 | elif not os.access(path, os.W_OK): | ||
61 | # Is the error an access error ? | ||
62 | os.chmod (path, stat.S_IWUSR) | ||
63 | function (path) | ||
64 | else: | ||
65 | raise | ||
53 | 66 | ||
54 | def cleanup (): | 67 | def cleanup (): |
55 | shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True) | 68 | shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), False, cleanup_onerror) |
56 | shutil.rmtree (os.path.join (tmp, "c_nat_client"), True) | 69 | shutil.rmtree (os.path.join (tmp, "c_nat_client"), False, cleanup_onerror) |
57 | 70 | ||
58 | 71 | ||
59 | def success_disconnect_cont (check): | 72 | def success_disconnect_cont (check): |
@@ -142,7 +155,7 @@ def run (): | |||
142 | nat_client = None | 155 | nat_client = None |
143 | success = False | 156 | success = False |
144 | 157 | ||
145 | for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: | 158 | for sig in signals: |
146 | signal.signal(sig, SigHandler) | 159 | signal.signal(sig, SigHandler) |
147 | 160 | ||
148 | test = Test ('test_integration_bootstrap_and_connect.py', verbose) | 161 | test = Test ('test_integration_bootstrap_and_connect.py', verbose) |