summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2018-10-09 12:28:21 +0200
committerNeale Ranns <nranns@cisco.com>2018-10-10 13:41:11 +0000
commit997439170aa3bb562c84e882c45331ba476e7c8e (patch)
tree868936a7ccb9f3b1a9c2fcc670bf100d24ee21a8
parent46fb787e21c758f6e88729ea34d3d721cd9b34eb (diff)
Test FW: Use unittest temp dir as unix runtime dir
Change-Id: I5273d5f3f59cc3c43da0a15bb0c4a4056098adcf Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
-rw-r--r--test/framework.py15
-rw-r--r--test/test_memif.py45
-rw-r--r--test/vpp_memif.py3
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):