[CRIU] [PATCH] zdtm.py: call clean_tests_root() from one process only
Andrei Vagin
avagin at openvz.org
Wed Aug 31 14:26:06 PDT 2016
From: Andrei Vagin <avagin at virtuozzo.com>
An atexit hook is executed for forked processes too,
clean_tests_root() has to be called only once.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index abcd5ed..3189aff 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -45,11 +45,12 @@ def traceit(f, e, a):
# Root dir for ns and uns flavors. All tests
# sit in the same dir
tests_root = None
+tests_root_pid = -1
def clean_tests_root():
global tests_root
- if tests_root:
+ if tests_root and tests_root_pid == os.getpid():
os.rmdir(tests_root)
@@ -57,6 +58,7 @@ def make_tests_root():
global tests_root
if not tests_root:
tests_root = tempfile.mkdtemp("", "criu-root-", "/tmp")
+ tests_root_pid = os.getpid()
atexit.register(clean_tests_root)
return tests_root
--
2.7.4
More information about the CRIU
mailing list