From 516fade932f96a93fb29f5dae3f0e9c9b49ccf92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Fri, 21 Apr 2023 15:56:06 +0200 Subject: [PATCH] zdtm: Allow overriding /tmp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use $TMPDIR for tests_root as the host's /tmp might not have enough features or space. Signed-off-by: Michał Mirosław --- test/zdtm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/zdtm.py b/test/zdtm.py index 33859f61e..2a657e44d 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -79,7 +79,8 @@ def clean_tests_root(): def make_tests_root(): global tests_root if not tests_root: - tests_root = (os.getpid(), tempfile.mkdtemp("", "criu-root-", "/tmp")) + tmpdir = os.environ.get("TMPDIR", "/tmp") + tests_root = (os.getpid(), tempfile.mkdtemp("", "criu-root-", tmpdir)) atexit.register(clean_tests_root) os.mkdir(os.path.join(tests_root[1], "root")) os.chmod(tests_root[1], 0o777) @@ -404,7 +405,7 @@ class zdtm_test: self.__flavor = flavor self.__freezer = freezer self._bins = [name] - self._env = {} + self._env = {'TMPDIR': os.environ.get('TMPDIR', '/tmp')} self._deps = desc.get('deps', []) self.auto_reap = True self.__timeout = int(self.__desc.get('timeout') or 30) @@ -828,7 +829,7 @@ class groups_test(zdtm_test): self._bins += self.__subs self._deps += get_test_desc('zdtm/lib/groups')['deps'] - self._env = {'ZDTM_TESTS': self.__real_name} + self._env['ZDTM_TESTS'] = self.__real_name def __get_start_cmd(self, name): tdir = os.path.dirname(name)