[CRIU] [PATCH] [v2] zdtm.py: call clean_tests_root() from one process only
Andrei Vagin
avagin at openvz.org
Wed Aug 31 16:20:01 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.
v2: fix flak8 warnings
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index abcd5ed..56ad841 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -49,16 +49,16 @@ tests_root = None
def clean_tests_root():
global tests_root
- if tests_root:
- os.rmdir(tests_root)
+ if tests_root and tests_root[0] == os.getpid():
+ os.rmdir(tests_root[1])
def make_tests_root():
global tests_root
if not tests_root:
- tests_root = tempfile.mkdtemp("", "criu-root-", "/tmp")
+ tests_root = (os.getpid(), tempfile.mkdtemp("", "criu-root-", "/tmp"))
atexit.register(clean_tests_root)
- return tests_root
+ return tests_root[1]
# Report generation
--
2.7.4
More information about the CRIU
mailing list