Commit 7df7d9bb authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

zdtm.py: call clean_tests_root() from one process only

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: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 2e4639f7
......@@ -51,16 +51,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment