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
This commit is contained in:
Dmitry Valter
2023-01-27 12:49:55 +00:00
committed by Dave Wallace
parent 8de66c090e
commit 71d02aa631
4 changed files with 6 additions and 4 deletions

View File

@ -931,7 +931,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."