From 23064dd22af4d5206ee52c887e6c413f42de6389 Mon Sep 17 00:00:00 2001 From: Jakub Grajciar Date: Tue, 9 Oct 2018 12:28:21 +0200 Subject: Test FW: Use unittest temp dir as unix runtime dir Change-Id: I5273d5f3f59cc3c43da0a15bb0c4a4056098adcf Signed-off-by: Jakub Grajciar (cherry picked from commit 997439170aa3bb562c84e882c45331ba476e7c8e) --- test/framework.py | 15 ++++++++------- test/test_memif.py | 45 ++++++++++++++++++++++++--------------------- test/vpp_memif.py | 3 ++- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/test/framework.py b/test/framework.py index da34724befd..a7f4fc774b4 100644 --- a/test/framework.py +++ b/test/framework.py @@ -284,13 +284,14 @@ class VppTestCase(unittest.TestCase): cls.vpp_cmdline = [cls.vpp_bin, "unix", "{", "nodaemon", debug_cli, "full-coredump", - coredump_size, "}", "api-trace", "{", "on", "}", - "api-segment", "{", "prefix", cls.shm_prefix, "}", - "cpu", "{", "main-core", str(cpu_core_number), "}", - "statseg", "{", "socket-name", cls.stats_sock, "}", - "plugins", "{", "plugin", "dpdk_plugin.so", "{", - "disable", "}", "plugin", "unittest_plugin.so", - "{", "enable", "}", "}", ] + coredump_size, "runtime-dir", cls.tempdir, "}", + "api-trace", "{", "on", "}", "api-segment", "{", + "prefix", cls.shm_prefix, "}", "cpu", "{", + "main-core", str(cpu_core_number), "}", "statseg", + "{", "socket-name", cls.stats_sock, "}", "plugins", + "{", "plugin", "dpdk_plugin.so", "{", "disable", + "}", "plugin", "unittest_plugin.so", "{", "enable", + "}", "}", ] if plugin_path is not None: cls.vpp_cmdline.extend(["plugin_path", plugin_path]) cls.logger.info("vpp_cmdline: %s" % cls.vpp_cmdline) diff --git a/test/test_memif.py b/test/test_memif.py index 8fe229986aa..6d462bae018 100644 --- a/test/test_memif.py +++ b/test/test_memif.py @@ -54,14 +54,14 @@ class TestMemif(VppTestCase): dump = self.vapi.memif_socket_filename_dump() self.assertTrue( self._check_socket_filename( - dump, 0, "/run/vpp/memif.sock")) + dump, 0, self.tempdir + "/memif.sock")) memif_sockets = [] # existing path memif_sockets.append( VppSocketFilename( - self, 1, "/run/vpp/memif1.sock")) - # default path ("/run/vpp") + self, 1, self.tempdir + "/memif1.sock")) + # default path (test tempdir) memif_sockets.append( VppSocketFilename( self, @@ -91,7 +91,7 @@ class TestMemif(VppTestCase): dump = self.vapi.memif_socket_filename_dump() self.assertTrue( self._check_socket_filename( - dump, 0, "/run/vpp/memif.sock")) + dump, 0, self.tempdir + "/memif.sock")) def _create_delete_test_one_interface(self, memif): memif.add_vpp_config() @@ -150,8 +150,8 @@ class TestMemif(VppTestCase): # existing path memif_sockets.append( VppSocketFilename( - self, 1, "/run/vpp/memif1.sock")) - # default path ("/run/vpp") + self, 1, self.tempdir + "/memif1.sock")) + # default path (test tempdir) memif_sockets.append( VppSocketFilename( self, @@ -178,18 +178,16 @@ class TestMemif(VppTestCase): def test_memif_connect(self): """ Memif connect """ - memif = VppMemif( - self, - MEMIF_ROLE.SLAVE, - MEMIF_MODE.ETHERNET, - ring_size=1024, - buffer_size=2048) - remote_memif = VppMemif( - self.remote_test, - MEMIF_ROLE.MASTER, - MEMIF_MODE.ETHERNET, - ring_size=1024, - buffer_size=2048) + memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET, + ring_size=1024, buffer_size=2048) + + remote_socket = VppSocketFilename(self.remote_test, 1, + self.tempdir + "/memif.sock") + remote_socket.add_vpp_config() + + remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER, + MEMIF_MODE.ETHERNET, socket_id=1, + ring_size=1024, buffer_size=2048) self._connect_test_interface_pair(memif, remote_memif) @@ -219,9 +217,14 @@ class TestMemif(VppTestCase): def test_memif_ping(self): """ Memif ping """ - memif = VppMemif(self, MEMIF_ROLE.MASTER, MEMIF_MODE.ETHERNET) - remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.SLAVE, - MEMIF_MODE.ETHERNET) + memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET) + + remote_socket = VppSocketFilename(self.remote_test, 1, + self.tempdir + "/memif.sock") + remote_socket.add_vpp_config() + + remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER, + MEMIF_MODE.ETHERNET, socket_id=1) memif.add_vpp_config() memif.config_ip4() diff --git a/test/vpp_memif.py b/test/vpp_memif.py index 2095480a7c2..24e8d19b1c7 100644 --- a/test/vpp_memif.py +++ b/test/vpp_memif.py @@ -50,7 +50,8 @@ class VppSocketFilename(VppObject): rv = self._test.vapi.memif_socket_filename_add_del( 1, self.socket_id, self.socket_filename) if self.add_default_folder: - self.socket_filename = "/run/vpp/" + self.socket_filename + self.socket_filename = self._test.tempdir + "/" \ + + self.socket_filename return rv def remove_vpp_config(self): -- cgit 1.2.3-korg