summaryrefslogtreecommitdiffstats
path: root/test/asf
diff options
context:
space:
mode:
authorDmitry Valter <d-valter@yandex-team.ru>2023-01-27 12:49:55 +0000
committerDave Wallace <dwallacelf@gmail.com>2023-02-14 01:26:01 +0000
commit71d02aa63183a513dbca98fa53719f7e29271faa (patch)
tree5b550b2a5ff06f68ea2ec190cd1b62b3095e4e20 /test/asf
parent8de66c090ef25977d8cc9c10084edbe146999c61 (diff)
tests: support tmp-dir on different filesystem
Support running tests with `--tmp-dir` on a filesystem different from /tmp. os.rename withs only within a single FS whereas shutil.move works accross different filesystems. Type: improvement Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru> Change-Id: I5371f5d75386bd2b82a75b3e6c1f2c850bc62356
Diffstat (limited to 'test/asf')
-rw-r--r--test/asf/asfframework.py2
-rw-r--r--test/asf/test_api_trace.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/test/asf/asfframework.py b/test/asf/asfframework.py
index b662042bc4a..5c64454df9f 100644
--- a/test/asf/asfframework.py
+++ b/test/asf/asfframework.py
@@ -855,7 +855,7 @@ class VppTestCase(CPUInterface, unittest.TestCase):
vpp_api_trace_log = "%s/%s" % (self.tempdir, api_trace)
self.logger.info(self.vapi.ppcli("api trace save %s" % api_trace))
self.logger.info("Moving %s to %s\n" % (tmp_api_trace, vpp_api_trace_log))
- os.rename(tmp_api_trace, vpp_api_trace_log)
+ shutil.move(tmp_api_trace, vpp_api_trace_log)
except VppTransportSocketIOError:
self.logger.debug(
"VppTransportSocketIOError: Vpp dead. Cannot log show commands."
diff --git a/test/asf/test_api_trace.py b/test/asf/test_api_trace.py
index 35fb3c0261a..e38b81a4c7d 100644
--- a/test/asf/test_api_trace.py
+++ b/test/asf/test_api_trace.py
@@ -3,6 +3,7 @@ import unittest
from asfframework import VppTestCase, VppTestRunner
from vpp_papi import VppEnum
import json
+import shutil
class TestJsonApiTrace(VppTestCase):
@@ -28,7 +29,7 @@ class TestJsonApiTrace(VppTestCase):
tmp_api_trace = "/tmp/%s" % fname
fpath = "%s/%s" % (self.tempdir, fname)
self.vapi.cli("api trace save-json {}".format(fname))
- os.rename(tmp_api_trace, fpath)
+ shutil.move(tmp_api_trace, fpath)
with open(fpath, encoding="utf-8") as f:
s = f.read()
trace = json.loads(s)