test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test
@ 2020-03-02 22:58 xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 2/4] tests: modify the suite of cryptodev virtio perf test xinfengx
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: xinfengx @ 2020-03-02 22:58 UTC (permalink / raw)
  To: dts; +Cc: xinfengx

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 tests/TestSuite_virtio_unit_cryptodev_func.py | 85 +++++++++++--------
 1 file changed, 49 insertions(+), 36 deletions(-)

diff --git a/tests/TestSuite_virtio_unit_cryptodev_func.py b/tests/TestSuite_virtio_unit_cryptodev_func.py
index a9d1ee1..b828d6f 100644
--- a/tests/TestSuite_virtio_unit_cryptodev_func.py
+++ b/tests/TestSuite_virtio_unit_cryptodev_func.py
@@ -53,24 +53,31 @@ class VirtioCryptodevUnitTest(TestCase):
         self.verify(len(self.dut_ports) >= 1, 'Insufficient ports for test')
         self.cores = self.dut.get_core_list("1S/3C/1T")
         self.mem_channel = self.dut.get_memory_channels()
-        self.bind_script_path = self.dut.get_dpdk_bind_script()
-
-        self.vfio_pci = self.get_suite_cfg()["vfio_pci"]
-        for each in self.vfio_pci.split():
-            cmd = "echo {} > /sys/bus/pci/devices/{}/driver/unbind".format(each, each.replace(":", "\:"))
-            self.dut_execut_cmd(cmd)
 
         if not cc.is_build_skip(self):
-            self.tar_dpdk()
             self.dut.skip_setup = False
             cc.build_dpdk_with_cryptodev(self)
-            self.build_vhost_app()
-
         cc.bind_qat_device(self)
+        self.build_vhost_app()
 
-        self.launch_vhost_switch()
-        self.bind_vfio_pci()
+        self.vf_assign_method = "vfio-pci"
+        self.dut.setup_modules(None, self.vf_assign_method, None)
+
+        self.dut.restore_interfaces()
+        self.used_dut_port = self.dut_ports[0]
+        self.dut.generate_sriov_vfs_by_port(
+            self.used_dut_port, 1, driver='default')
+        self.sriov_vfs_port = self.dut.ports_info[
+            self.used_dut_port]['vfs_port']
+        for port in self.sriov_vfs_port:
+            port.bind_driver(self.vf_assign_method)
 
+        intf = self.dut.ports_info[self.used_dut_port]['intf']
+        vf_mac = "52:00:00:00:00:01"
+        self.dut.send_expect("ip link set %s vf 0 mac %s" %
+                (intf, vf_mac), "# ")
+
+        self.launch_vhost_switch()
         self.vm0, self.vm0_dut = self.launch_virtio_dut("vm0")
 
     def set_up(self):
@@ -79,27 +86,20 @@ class VirtioCryptodevUnitTest(TestCase):
     def dut_execut_cmd(self, cmdline, ex='#', timout=30):
         return self.dut.send_expect(cmdline, ex, timout)
 
-    def tar_dpdk(self):
-        self.dut_execut_cmd("rm -rf %s" % self.target, '#', 100)
-        self.dut_execut_cmd("tar -czf %s/dep/dpdk.tar.gz ../dpdk" % os.getcwd(), '#', 100)
-
     def build_user_dpdk(self, user_dut):
         user_dut.send_expect(
             "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/' config/common_base", '#', 30)
-        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 600)
-        assert ("Error" not in out), "Compilation error..."
+        user_dut.send_expect(
+            "sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' config/common_base", '#', 30)
+        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 900)
+        self.verify("Error" not in out, "compilation error 1")
+        self.verify("No such file" not in out, "compilation error 2")
 
     def build_vhost_app(self):
-        self.dut_execut_cmd("export RTE_SDK=`pwd`")
-        self.dut_execut_cmd("export RTE_TARGET=%s" % self.target)
         out = self.dut_execut_cmd("make -C ./examples/vhost_crypto")
-        self.verify("Error" not in out, "compilation error")
 
-    def build_user_app(self, user_dut):
-        user_dut.send_expect("export RTE_SDK=`pwd`", '#', 30)
-        user_dut.send_expect("export RTE_TARGET=%s" % self.target, '#', 30)
-        out = user_dut.send_expect("make -C ./%s test-build" % self.target, '#', 600)
-        self.verify("Error" not in out, "compilation error")
+        self.verify("Error" not in out, "compilation error 1")
+        self.verify("No such file" not in out, "compilation error 2")
 
     def get_vhost_eal(self):
         default_eal_opts = {
@@ -129,16 +129,14 @@ class VirtioCryptodevUnitTest(TestCase):
 
     def launch_vhost_switch(self):
         eal_opt_str = self.get_vhost_eal()
+
         config = '"(%s,0,0),(%s,0,0)"' % tuple(self.cores[-2:])
         socket_file = "%s,/tmp/vm0_crypto0.sock --socket-file=%s,/tmp/vm0_crypto1.sock" % tuple(self.cores[-2:])
         self.vhost_switch_cmd = cc.get_dpdk_app_cmd_str(self.sample_app, eal_opt_str,
                                     '--config %s --socket-file %s' % (config, socket_file))
 
-        self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
-
-    def bind_vfio_pci(self):
-        subprocess.getoutput("modprobe vfio-pci")
-        subprocess.getoutput('%s -b vfio-pci %s' % (os.path.join(self.dut.base_dir, self.bind_script_path), self.vfio_pci))
+        out = self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
+        self.logger.info(out)
 
     def set_virtio_pci(self, dut):
         out = dut.send_expect("lspci -d:1054|awk '{{print $1}}'", "# ", 10)
@@ -150,26 +148,37 @@ class VirtioCryptodevUnitTest(TestCase):
             dut.send_expect(cmd, "# ", 10)
         dut.send_expect('echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id', "# ", 10)
 
+        return virtio_list
+
     def launch_virtio_dut(self, vm_name):
         # start vm
         vm = QEMUKvm(self.dut, vm_name, 'virtio_unit_cryptodev_func')
+        vf0 = {'opt_host': self.sriov_vfs_port[0].pci}
+        vm.set_vm_device(driver=self.vf_assign_method, **vf0)
+        skip_setup = self.dut.skip_setup
 
         try:
-            vm_dut = vm.start(set_target=False)
+            self.dut.skip_setup = True
+            vm_dut = vm.start()
             if vm_dut is None:
                 print(('{} start failed'.format(vm_name)))
         except Exception as err:
             raise err
 
+        self.dut.skip_setup = skip_setup
         vm_dut.restore_interfaces()
 
         if not self.dut.skip_setup:
             self.build_user_dpdk(vm_dut)
-            self.build_user_app(vm_dut)
 
         vm_dut.setup_modules(self.target, "igb_uio", None)
         vm_dut.bind_interfaces_linux('igb_uio')
-        self.set_virtio_pci(vm_dut)
+        vm.virtio_list = self.set_virtio_pci(vm_dut)
+        self.logger.info("{} virtio list: {}".format(vm_name, vm.virtio_list))
+        vm.cores = vm_dut.get_core_list("all")
+        self.logger.info("{} core list: {}".format(vm_name, vm.cores))
+        vm.ports = [port["pci"] for port in vm_dut.ports_info]
+        self.logger.info("{} port list: {}".format(vm_name, vm.ports))
 
         return vm, vm_dut
 
@@ -180,7 +189,7 @@ class VirtioCryptodevUnitTest(TestCase):
     def __run_unit_test(self, testsuite, eal_opt_str='', timeout=600):
         self.logger.info("STEP_TEST: " + testsuite)
         self.vm0_dut.send_expect("dmesg -C", "# ", 30)
-        cmd_str = cc.get_dpdk_app_cmd_str(self.user_app, "--log-level 8", eal_opt_str)
+        cmd_str = cc.get_dpdk_app_cmd_str(self.user_app, "--log-level 6", eal_opt_str)
         info = self.vm0_dut.send_expect(cmd_str, "RTE>>", 30)
         self.logger.info(info)
 
@@ -202,11 +211,15 @@ class VirtioCryptodevUnitTest(TestCase):
         pass
 
     def tear_down_all(self):
-        if self.vm0:
+        if getattr(self, 'vm0', None):
+            self.vm0_dut.kill_all()
             self.vm0.stop()
-            self.dut.virt_exit()
             self.vm0 = None
 
+        if getattr(self, 'used_dut_port', None) != None:
+            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+            self.used_dut_port = None
+
         self.dut_execut_cmd("^C", "# ")
         self.dut_execut_cmd("killall -s INT vhost-crypto")
         self.dut_execut_cmd("killall -s INT qemu-system-x86_64")
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dts] [PATCH 2/4] tests: modify the suite of cryptodev virtio perf test
  2020-03-02 22:58 [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test xinfengx
@ 2020-03-02 22:58 ` xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 3/4] tests: modify the suite of cryptodev virtio ipsec test xinfengx
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: xinfengx @ 2020-03-02 22:58 UTC (permalink / raw)
  To: dts; +Cc: xinfengx

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 tests/TestSuite_virtio_perf_cryptodev_func.py | 88 +++++++++++--------
 1 file changed, 51 insertions(+), 37 deletions(-)

diff --git a/tests/TestSuite_virtio_perf_cryptodev_func.py b/tests/TestSuite_virtio_perf_cryptodev_func.py
index a8cbdf2..830d62d 100644
--- a/tests/TestSuite_virtio_perf_cryptodev_func.py
+++ b/tests/TestSuite_virtio_perf_cryptodev_func.py
@@ -82,23 +82,30 @@ class VirtioCryptodevPerfTest(TestCase):
         self.cores = self.dut.get_core_list("1S/3C/1T")
         self.mem_channel = self.dut.get_memory_channels()
 
-        self.bind_script_path = self.dut.get_dpdk_bind_script()
-
-        self.vfio_pci = self.get_suite_cfg()["vfio_pci"]
-        for each in self.vfio_pci.split():
-            cmd = "echo {} > /sys/bus/pci/devices/{}/driver/unbind".format(each, each.replace(":", "\:"))
-            self.dut_execut_cmd(cmd)
-
         if not cc.is_build_skip(self):
-            self.tar_dpdk()
             self.dut.skip_setup = False
             cc.build_dpdk_with_cryptodev(self)
-            self.build_vhost_app()
-        cc.bind_qat_device(self, "vfio-pci")
+        self.build_vhost_app()
+        cc.bind_qat_device(self)
+
+        self.vf_assign_method = "vfio-pci"
+        self.dut.setup_modules(None, self.vf_assign_method, None)
+
+        self.dut.restore_interfaces()
+        self.used_dut_port = self.dut_ports[0]
+        self.dut.generate_sriov_vfs_by_port(
+            self.used_dut_port, 1, driver='default')
+        self.sriov_vfs_port = self.dut.ports_info[
+            self.used_dut_port]['vfs_port']
+        for port in self.sriov_vfs_port:
+            port.bind_driver(self.vf_assign_method)
+
+        intf = self.dut.ports_info[self.used_dut_port]['intf']
+        vf_mac = "52:00:00:00:00:01"
+        self.dut.send_expect("ip link set %s vf 0 mac %s" %
+                (intf, vf_mac), "# ")
 
         self.launch_vhost_switch()
-        self.bind_vfio_pci()
-
         self.vm0, self.vm0_dut = self.launch_virtio_dut("vm0")
 
     def set_up(self):
@@ -107,27 +114,21 @@ class VirtioCryptodevPerfTest(TestCase):
     def dut_execut_cmd(self, cmdline, ex='#', timout=30):
         return self.dut.send_expect(cmdline, ex, timout)
 
-    def tar_dpdk(self):
-        self.dut_execut_cmd("tar -czf %s/dep/dpdk.tar.gz ../dpdk" % os.getcwd(), '#', 100)
-
     def build_user_dpdk(self, user_dut):
         user_dut.send_expect(
             "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/' config/common_base", '#', 30)
+        user_dut.send_expect(
+            "sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' config/common_base", '#', 30)
+        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 900)
 
-        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 600)
-        assert ("Error" not in out), "Compilation error..."
+        self.verify("Error" not in out, "compilation error 1")
+        self.verify("No such file" not in out, "compilation error 2")
 
     def build_vhost_app(self):
-        self.dut_execut_cmd("export RTE_SDK=`pwd`")
-        self.dut_execut_cmd("export RTE_TARGET=%s" % self.target)
         out = self.dut_execut_cmd("make -C ./examples/vhost_crypto")
-        self.verify("Error" not in out, "compilation error")
 
-    def build_user_app(self, user_dut):
-        user_dut.send_expect("export RTE_SDK=`pwd`", '#', 30)
-        user_dut.send_expect("export RTE_TARGET=%s" % self.target, '#', 30)
-        out = user_dut.send_expect("make -C ./%s test-build" % self.target, '#', 600)
-        self.verify("Error" not in out, "compilation error")
+        self.verify("Error" not in out, "compilation error 1")
+        self.verify("No such file" not in out, "compilation error 2")
 
     def get_vhost_eal(self):
         default_eal_opts = {
@@ -160,13 +161,10 @@ class VirtioCryptodevPerfTest(TestCase):
         config = '"(%s,0,0),(%s,0,0)"' % tuple(self.cores[-2:])
         socket_file = "%s,/tmp/vm0_crypto0.sock --socket-file=%s,/tmp/vm0_crypto1.sock" % tuple(self.cores[-2:])
         self.vhost_switch_cmd = cc.get_dpdk_app_cmd_str(self.sample_app, eal_opt_str,
-                                    '--config %s --socket-file %s' % (config, socket_file))
+                '--config %s --socket-file %s' % (config, socket_file))
 
-        self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
-
-    def bind_vfio_pci(self):
-        subprocess.getoutput("modprobe vfio-pci")
-        subprocess.getoutput('%s -b vfio-pci %s' % (os.path.join(self.dut.base_dir, self.bind_script_path), self.vfio_pci))
+        out = self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
+        self.logger.info(out)
 
     def set_virtio_pci(self, dut):
         out = dut.send_expect("lspci -d:1054|awk '{{print $1}}'", "# ", 10)
@@ -178,26 +176,38 @@ class VirtioCryptodevPerfTest(TestCase):
             dut.send_expect(cmd, "# ", 10)
         dut.send_expect('echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id', "# ", 10)
 
+        return virtio_list
+
     def launch_virtio_dut(self, vm_name):
         # start vm
         vm = QEMUKvm(self.dut, vm_name, 'virtio_perf_cryptodev_func')
 
+        vf0 = {'opt_host': self.sriov_vfs_port[0].pci}
+        vm.set_vm_device(driver=self.vf_assign_method, **vf0)
+        skip_setup = self.dut.skip_setup
+
         try:
-            vm_dut = vm.start(set_target=False)
+            self.dut.skip_setup = True
+            vm_dut = vm.start()
             if vm_dut is None:
                 print(('{} start failed'.format(vm_name)))
         except Exception as err:
             raise err
 
+        self.dut.skip_setup = skip_setup
         vm_dut.restore_interfaces()
 
         if not self.dut.skip_setup:
             self.build_user_dpdk(vm_dut)
-            self.build_user_app(vm_dut)
 
         vm_dut.setup_modules(self.target, "igb_uio", None)
         vm_dut.bind_interfaces_linux('igb_uio')
-        self.set_virtio_pci(vm_dut)
+        vm.virtio_list = self.set_virtio_pci(vm_dut)
+        self.logger.info("{} virtio list: {}".format(vm_name, vm.virtio_list))
+        vm.cores = vm_dut.get_core_list("all")
+        self.logger.info("{} core list: {}".format(vm_name, vm.cores))
+        vm.ports = [port["pci"] for port in vm_dut.ports_info]
+        self.logger.info("{} port list: {}".format(vm_name, vm.ports))
 
         return vm, vm_dut
 
@@ -216,7 +226,7 @@ class VirtioCryptodevPerfTest(TestCase):
         if cc.is_test_skip(self):
             return
 
-        eal_opt_str = cc.get_eal_opt_str(self, {"vdev":None})
+        eal_opt_str = cc.get_eal_opt_str(self, {"w": self.vm0.virtio_list[0], "vdev":None})
         crypto_perf_opt_str = cc.get_opt_str(self, self._default_crypto_perf_opts)
         out = self._run_crypto_perf(eal_opt_str, crypto_perf_opt_str)
         self.logger.info(out)
@@ -240,11 +250,15 @@ class VirtioCryptodevPerfTest(TestCase):
         pass
 
     def tear_down_all(self):
-        if self.vm0:
+        if getattr(self, 'vm0', None):
+            self.vm0_dut.kill_all()
             self.vm0.stop()
-            self.dut.virt_exit()
             self.vm0 = None
 
+        if getattr(self, 'used_dut_port', None) != None:
+            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+            self.used_dut_port = None
+
         self.dut_execut_cmd("^C", "# ")
         self.dut_execut_cmd("killall -s INT vhost-crypto")
         self.dut_execut_cmd("killall -s INT qemu-system-x86_64")
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dts] [PATCH 3/4] tests: modify the suite of cryptodev virtio ipsec test
  2020-03-02 22:58 [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 2/4] tests: modify the suite of cryptodev virtio perf test xinfengx
@ 2020-03-02 22:58 ` xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites xinfengx
  2020-03-11  4:31 ` [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test Tu, Lijuan
  3 siblings, 0 replies; 6+ messages in thread
From: xinfengx @ 2020-03-02 22:58 UTC (permalink / raw)
  To: dts; +Cc: xinfengx

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 .../TestSuite_virtio_ipsec_cryptodev_func.py  | 90 +++++++++++--------
 1 file changed, 52 insertions(+), 38 deletions(-)

diff --git a/tests/TestSuite_virtio_ipsec_cryptodev_func.py b/tests/TestSuite_virtio_ipsec_cryptodev_func.py
index efbc48a..d812e36 100644
--- a/tests/TestSuite_virtio_ipsec_cryptodev_func.py
+++ b/tests/TestSuite_virtio_ipsec_cryptodev_func.py
@@ -58,12 +58,14 @@ class VirtioCryptodevIpsecTest(TestCase):
         self.dut.skip_setup = True
 
         self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 4, 'Insufficient ports for test')
         self.cores = self.dut.get_core_list("1S/5C/1T")
         self.mem_channel = self.dut.get_memory_channels()
         self.port_mask = utils.create_mask([self.dut_ports[0]])
+        self.dst_mac = self.dut.get_mac_address(self.dut_ports[0])
 
         self.tx_port = self.tester.get_local_port(self.dut_ports[0])
-        self.rx_port = self.tester.get_local_port(self.dut_ports[1])
+        self.rx_port = self.tester.get_local_port(self.dut_ports[-1])
 
         self.tx_interface = self.tester.get_interface(self.tx_port)
         self.rx_interface = self.tester.get_interface(self.rx_port)
@@ -71,22 +73,16 @@ class VirtioCryptodevIpsecTest(TestCase):
         self.logger.info("tx interface = " + self.tx_interface)
         self.logger.info("rx interface = " + self.rx_interface)
 
-        self.bind_script_path = self.dut.get_dpdk_bind_script()
-        self.vfio_pci = self.get_suite_cfg()["vfio_pci"]
-        for each in self.vfio_pci.split():
-            cmd = "echo {} > /sys/bus/pci/devices/{}/driver/unbind".format(each, each.replace(":", "\:"))
-            self.dut_execut_cmd(cmd)
-        self.dut.restore_interfaces()
+        self.sriov_port = self.bind_vfio_pci()
 
         if not cc.is_build_skip(self):
-            self.tar_dpdk()
             self.dut.skip_setup = False
             cc.build_dpdk_with_cryptodev(self)
-            self.build_vhost_app()
-        cc.bind_qat_device(self, "vfio-pci")
+        cc.bind_qat_device(self)
+        self.build_vhost_app()
+        self.bind_vfio_pci()
 
         self.launch_vhost_switch()
-        self.bind_vfio_pci()
 
         self.vm0, self.vm0_dut = self.launch_virtio_dut("vm0")
         self.vm1, self.vm1_dut = self.launch_virtio_dut("vm1")
@@ -97,28 +93,22 @@ class VirtioCryptodevIpsecTest(TestCase):
     def dut_execut_cmd(self, cmdline, ex='#', timout=30):
         return self.dut.send_expect(cmdline, ex, timout)
 
-    def tar_dpdk(self):
-        self.dut_execut_cmd("tar -czf %s/dep/dpdk.tar.gz ../dpdk" % os.getcwd(), '#', 100)
-
     def build_user_dpdk(self, user_dut):
         user_dut.send_expect(
             "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/' config/common_base", '#', 30)
-        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 900)
+        user_dut.send_expect(
+            "sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' config/common_base", '#', 30)
+        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 1200)
+        #user_dut.build_install_dpdk(self.target)
+        out = user_dut.build_dpdk_apps("./examples/ipsec-secgw")
         self.logger.info(out)
-        assert ("Error" not in out), "Compilation error..."
+        self.verify("Error" not in out, "Compilation error 1")
+        self.verify("No such" not in out, "Compilation error 2")
 
     def build_vhost_app(self):
         out = self.dut.build_dpdk_apps("./examples/vhost_crypto")
-        self.verify("Error" not in out, "Compilation error")
-        self.verify("No such" not in out, "Compilation error")
-
-    def build_user_app(self, user_dut):
-        user_dut.send_expect("export RTE_SDK=`pwd`", '#', 30)
-        user_dut.send_expect("export RTE_TARGET=%s" % self.target, '#', 30)
-        out = user_dut.send_expect("make -C ./examples/ipsec-secgw", '#', 600)
-        self.logger.info(out)
-        self.verify("Error" not in out, "Compilation error")
-        self.verify("No such" not in out, "Compilation error")
+        self.verify("Error" not in out, "Compilation error 1")
+        self.verify("No such" not in out, "Compilation error 2")
 
     def get_vhost_eal(self):
         default_eal_opts = {
@@ -197,13 +187,19 @@ class VirtioCryptodevIpsecTest(TestCase):
         --socket-file=%s,/tmp/vm1_crypto1.sock"% tuple(self.cores[-4:])
         self.vhost_switch_cmd = cc.get_dpdk_app_cmd_str(self.sample_app, eal_opt_str,
                                     '--config %s --socket-file %s' % (config, socket_file))
-
         self.dut_execut_cmd("rm -r /tmp/*")
-        self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
+        out = self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
+        self.logger.info(out)
 
     def bind_vfio_pci(self):
-        subprocess.getoutput("modprobe vfio-pci")
-        subprocess.getoutput('%s -b vfio-pci %s' % (os.path.join(self.dut.base_dir, self.bind_script_path), self.vfio_pci))
+        self.vf_assign_method = "vfio-pci"
+        self.dut.setup_modules(None, self.vf_assign_method, None)
+
+        sriov_ports = []
+        for port in self.dut.ports_info:
+            port["port"].bind_driver("vfio-pci")
+            sriov_ports.append(port["port"])
+        return sriov_ports
 
     def set_virtio_pci(self, dut):
         out = dut.send_expect("lspci -d:1054|awk '{{print $1}}'", "# ", 10)
@@ -219,18 +215,30 @@ class VirtioCryptodevIpsecTest(TestCase):
 
     def launch_virtio_dut(self, vm_name):
         vm = QEMUKvm(self.dut, vm_name, 'virtio_ipsec_cryptodev_func')
+        if vm_name == "vm0":
+            vf0 = {'opt_host': self.sriov_port[0].pci}
+            vf1 = {'opt_host': self.sriov_port[1].pci}
+        elif vm_name == "vm1":
+            vf0 = {'opt_host': self.sriov_port[2].pci}
+            vf1 = {'opt_host': self.sriov_port[3].pci}
+
+        vm.set_vm_device(driver=self.vf_assign_method, **vf0)
+        vm.set_vm_device(driver=self.vf_assign_method, **vf1)
+        skip_setup = self.dut.skip_setup
 
         try:
-            vm_dut = vm.start(set_target=False)
+            self.dut.skip_setup = True
+            vm_dut = vm.start()
             if vm_dut is None:
                 print(('{} start failed'.format(vm_name)))
         except Exception as err:
             raise err
+
+        self.dut.skip_setup = skip_setup
         vm_dut.restore_interfaces()
 
         if not self.dut.skip_setup:
             self.build_user_dpdk(vm_dut)
-            self.build_user_app(vm_dut)
 
         vm_dut.setup_modules(self.target, "igb_uio", None)
         vm_dut.bind_interfaces_linux('igb_uio')
@@ -253,17 +261,16 @@ class VirtioCryptodevIpsecTest(TestCase):
         payload = 256 * ['11']
 
         pkt = Packet()
-
         pkt.assign_layers(["ether", "ipv4", "udp", "raw"])
         pkt.config_layer("ether", {"src": "52:00:00:00:00:00", "dst": "52:00:00:00:00:01"})
         src_ip = "192.168.105.200"
         dst_ip = "192.168.105.100"
         pkt.config_layer("ipv4", {"src": src_ip, "dst": dst_ip})
-        pkt.config_layer("udp", {"dst": 0})
+        pkt.config_layer("udp", {"src": 1111, "dst": 2222})
         pkt.config_layer("raw", {"payload": payload})
         pkt.send_pkt(self.tester, tx_port=self.tx_interface, count=PACKET_COUNT)
-
         pkt_rec = self.tester.load_tcpdump_sniff_packets(inst)
+
         self.logger.info("dump: {} packets".format(len(pkt_rec)))
         if len(pkt_rec) != PACKET_COUNT:
             self.logger.info("dump pkg: {}, the num of pkg dumped is incorrtct!".format(len(pkt_rec)))
@@ -273,8 +280,10 @@ class VirtioCryptodevIpsecTest(TestCase):
                 self.logger.info("the ip of pkg dumped is incorrtct!")
                 status = False
 
-            dump_text = binascii.b2a_hex(pkt_rec[i]["Raw"].getfieldval("load"))
+            dump_text = str(binascii.b2a_hex(pkt_rec[i]["Raw"].getfieldval("load")), encoding='utf-8')
             if dump_text != ''.join(payload):
+                self.logger.info(dump_text)
+                self.logger.info(''.join(payload))
                 self.logger.info("the text of pkg dumped is incorrtct!")
                 status = False
 
@@ -349,11 +358,16 @@ class VirtioCryptodevIpsecTest(TestCase):
         self.vm1_dut.send_expect("^C", "# ")
 
     def tear_down_all(self):
-        if self.vm0:
+        if getattr(self, 'vm0', None):
+            self.vm0_dut.kill_all()
             self.vm0.stop()
-            self.dut.virt_exit()
             self.vm0 = None
 
+        if getattr(self, 'vm1', None):
+            self.vm1_dut.kill_all()
+            self.vm1.stop()
+            self.vm1 = None
+
         if self.vm1:
             self.vm1.stop()
             self.dut.virt_exit()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites
  2020-03-02 22:58 [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 2/4] tests: modify the suite of cryptodev virtio perf test xinfengx
  2020-03-02 22:58 ` [dts] [PATCH 3/4] tests: modify the suite of cryptodev virtio ipsec test xinfengx
@ 2020-03-02 22:58 ` xinfengx
  2020-03-03  8:33   ` Zhao, XinfengX
  2020-03-11  4:31 ` [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test Tu, Lijuan
  3 siblings, 1 reply; 6+ messages in thread
From: xinfengx @ 2020-03-02 22:58 UTC (permalink / raw)
  To: dts; +Cc: xinfengx

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 conf/virtio_ipsec_cryptodev_func.cfg | 27 +++++++++++----------------
 conf/virtio_perf_cryptodev_func.cfg  | 17 +++++------------
 conf/virtio_unit_cryptodev_func.cfg  | 16 +++++-----------
 3 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/conf/virtio_ipsec_cryptodev_func.cfg b/conf/virtio_ipsec_cryptodev_func.cfg
index 0b51b7d..de6724d 100644
--- a/conf/virtio_ipsec_cryptodev_func.cfg
+++ b/conf/virtio_ipsec_cryptodev_func.cfg
@@ -2,20 +2,17 @@
 # Cryptodev common options qat device id
 crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1 0000:3b:00.0 0000:3b:00.1"
-
 # default crypto device and sw device config
-w="0000:1a:01.0"
 vdev="crypto_aesni_mb_pmd_1 --vdev crypto_aesni_mb_pmd_2"
+w="0000:00:00.0"
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;
 mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -23,20 +20,19 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:3b:00.0;
-    driver=vfio-pci,opt_host=0000:3b:00.1;
+start =
+    wait_seconds=200;
 
 [vm1]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=15 16 17 18;
 mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -44,9 +40,8 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_2.img;
+    file=/home/image/ubuntu16-1.img;
 vnc =
     displayNum=2;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
+start =
+    wait_seconds=200;
diff --git a/conf/virtio_perf_cryptodev_func.cfg b/conf/virtio_perf_cryptodev_func.cfg
index cdadf31..0cd766b 100644
--- a/conf/virtio_perf_cryptodev_func.cfg
+++ b/conf/virtio_perf_cryptodev_func.cfg
@@ -2,12 +2,9 @@
 # Cryptodev common options qat device id
 crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1"
-
-# Vhost-crypto option config
-w="0000:1a:01.0"
+# default crypto device and sw device config
 vdev="crypto_aesni_mb_pmd_1"
+w="0000:00:00.0"
 
 [test_aesni_mb_aes_cbc_sha1_hmac]
 buffer-sz="64,128,256,512,1024,2048"
@@ -30,7 +27,6 @@ total-ops=100000
 buffer-sz="64,128,256,512,1024,2048"
 l="0,1"
 socket-mem="512,0"
-w="00:05.0"
 optype="cipher-then-auth"
 devtype="crypto_virtio"
 cipher-algo="aes-cbc"
@@ -45,11 +41,11 @@ total-ops=100000
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;
 mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -57,9 +53,6 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
diff --git a/conf/virtio_unit_cryptodev_func.cfg b/conf/virtio_unit_cryptodev_func.cfg
index f8165bd..53611e3 100644
--- a/conf/virtio_unit_cryptodev_func.cfg
+++ b/conf/virtio_unit_cryptodev_func.cfg
@@ -2,20 +2,17 @@
 # Cryptodev common options qat device id
 crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1"
-
-# Vhost-crypto option config
-w="0000:1a:01.0"
+# default crypto device and sw device config
 vdev="crypto_aesni_mb_pmd_1"
+w="0000:00:00.0"
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;
 mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -23,9 +20,6 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites
  2020-03-02 22:58 ` [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites xinfengx
@ 2020-03-03  8:33   ` Zhao, XinfengX
  0 siblings, 0 replies; 6+ messages in thread
From: Zhao, XinfengX @ 2020-03-03  8:33 UTC (permalink / raw)
  To: dts

Tested-by:  Zhao, Xinfeng<xinfengx.zhao@intel.com>

-----Original Message-----
From: Zhao, XinfengX 
Sent: Tuesday, March 3, 2020 6:59 AM
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts][PATCH 4/4] conf: modify the config files for cryptodev virtio test suites

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 conf/virtio_ipsec_cryptodev_func.cfg | 27 +++++++++++----------------  conf/virtio_perf_cryptodev_func.cfg  | 17 +++++------------  conf/virtio_unit_cryptodev_func.cfg  | 16 +++++-----------
 3 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/conf/virtio_ipsec_cryptodev_func.cfg b/conf/virtio_ipsec_cryptodev_func.cfg
index 0b51b7d..de6724d 100644
--- a/conf/virtio_ipsec_cryptodev_func.cfg
+++ b/conf/virtio_ipsec_cryptodev_func.cfg
@@ -2,20 +2,17 @@
 # Cryptodev common options qat device id  crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1 0000:3b:00.0 0000:3b:00.1"
-
 # default crypto device and sw device config -w="0000:1a:01.0"
 vdev="crypto_aesni_mb_pmd_1 --vdev crypto_aesni_mb_pmd_2"
+w="0000:00:00.0"
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;  mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -23,20 +20,19 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:3b:00.0;
-    driver=vfio-pci,opt_host=0000:3b:00.1;
+start =
+    wait_seconds=200;
 
 [vm1]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=15 16 17 18;  mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -44,9 +40,8 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_2.img;
+    file=/home/image/ubuntu16-1.img;
 vnc =
     displayNum=2;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
+start =
+    wait_seconds=200;
diff --git a/conf/virtio_perf_cryptodev_func.cfg b/conf/virtio_perf_cryptodev_func.cfg
index cdadf31..0cd766b 100644
--- a/conf/virtio_perf_cryptodev_func.cfg
+++ b/conf/virtio_perf_cryptodev_func.cfg
@@ -2,12 +2,9 @@
 # Cryptodev common options qat device id  crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1"
-
-# Vhost-crypto option config
-w="0000:1a:01.0"
+# default crypto device and sw device config
 vdev="crypto_aesni_mb_pmd_1"
+w="0000:00:00.0"
 
 [test_aesni_mb_aes_cbc_sha1_hmac]
 buffer-sz="64,128,256,512,1024,2048"
@@ -30,7 +27,6 @@ total-ops=100000
 buffer-sz="64,128,256,512,1024,2048"
 l="0,1"
 socket-mem="512,0"
-w="00:05.0"
 optype="cipher-then-auth"
 devtype="crypto_virtio"
 cipher-algo="aes-cbc"
@@ -45,11 +41,11 @@ total-ops=100000
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;  mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -57,9 +53,6 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
diff --git a/conf/virtio_unit_cryptodev_func.cfg b/conf/virtio_unit_cryptodev_func.cfg
index f8165bd..53611e3 100644
--- a/conf/virtio_unit_cryptodev_func.cfg
+++ b/conf/virtio_unit_cryptodev_func.cfg
@@ -2,20 +2,17 @@
 # Cryptodev common options qat device id  crypto_dev_id="37c9"
 
-# PCI Pass-through
-vfio_pci="0000:60:00.0 0000:60:00.1"
-
-# Vhost-crypto option config
-w="0000:1a:01.0"
+# default crypto device and sw device config
 vdev="crypto_aesni_mb_pmd_1"
+w="0000:00:00.0"
 
 [vm0]
 qemu =
-    path=/root/qemu-2/bin/qemu-system-x86_64;
+    path=/opt/qemu-2.12.0/bin/qemu-system-x86_64;
 cpu =
     model=host,number=4,cpupin=11 12 13 14;  mem =
-    size=5120,hugepage=yes;
+    size=4096,hugepage=yes;
 crypto =
     enable=yes,opt_num=2;
 daemon =
@@ -23,9 +20,6 @@ daemon =
 login =
     user=root,password=tester;
 disk =
-    file=/root/VMs/virtio_crypto_test_710_1.img;
+    file=/home/image/ubuntu16-0.img;
 vnc =
     displayNum=1;
-device =
-    driver=vfio-pci,opt_host=0000:60:00.0;
-    driver=vfio-pci,opt_host=0000:60:00.1;
--
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test
  2020-03-02 22:58 [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test xinfengx
                   ` (2 preceding siblings ...)
  2020-03-02 22:58 ` [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites xinfengx
@ 2020-03-11  4:31 ` Tu, Lijuan
  3 siblings, 0 replies; 6+ messages in thread
From: Tu, Lijuan @ 2020-03-11  4:31 UTC (permalink / raw)
  To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX

Applied the series, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xinfengx
> Sent: Tuesday, March 3, 2020 6:59 AM
> To: dts@dpdk.org
> Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
> Subject: [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test
> 
> Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
> ---
>  tests/TestSuite_virtio_unit_cryptodev_func.py | 85 +++++++++++--------
>  1 file changed, 49 insertions(+), 36 deletions(-)
> 
> diff --git a/tests/TestSuite_virtio_unit_cryptodev_func.py
> b/tests/TestSuite_virtio_unit_cryptodev_func.py
> index a9d1ee1..b828d6f 100644
> --- a/tests/TestSuite_virtio_unit_cryptodev_func.py
> +++ b/tests/TestSuite_virtio_unit_cryptodev_func.py
> @@ -53,24 +53,31 @@ class VirtioCryptodevUnitTest(TestCase):
>          self.verify(len(self.dut_ports) >= 1, 'Insufficient ports for test')
>          self.cores = self.dut.get_core_list("1S/3C/1T")
>          self.mem_channel = self.dut.get_memory_channels()
> -        self.bind_script_path = self.dut.get_dpdk_bind_script()
> -
> -        self.vfio_pci = self.get_suite_cfg()["vfio_pci"]
> -        for each in self.vfio_pci.split():
> -            cmd = "echo {} > /sys/bus/pci/devices/{}/driver/unbind".format(each,
> each.replace(":", "\:"))
> -            self.dut_execut_cmd(cmd)
> 
>          if not cc.is_build_skip(self):
> -            self.tar_dpdk()
>              self.dut.skip_setup = False
>              cc.build_dpdk_with_cryptodev(self)
> -            self.build_vhost_app()
> -
>          cc.bind_qat_device(self)
> +        self.build_vhost_app()
> 
> -        self.launch_vhost_switch()
> -        self.bind_vfio_pci()
> +        self.vf_assign_method = "vfio-pci"
> +        self.dut.setup_modules(None, self.vf_assign_method, None)
> +
> +        self.dut.restore_interfaces()
> +        self.used_dut_port = self.dut_ports[0]
> +        self.dut.generate_sriov_vfs_by_port(
> +            self.used_dut_port, 1, driver='default')
> +        self.sriov_vfs_port = self.dut.ports_info[
> +            self.used_dut_port]['vfs_port']
> +        for port in self.sriov_vfs_port:
> +            port.bind_driver(self.vf_assign_method)
> 
> +        intf = self.dut.ports_info[self.used_dut_port]['intf']
> +        vf_mac = "52:00:00:00:00:01"
> +        self.dut.send_expect("ip link set %s vf 0 mac %s" %
> +                (intf, vf_mac), "# ")
> +
> +        self.launch_vhost_switch()
>          self.vm0, self.vm0_dut = self.launch_virtio_dut("vm0")
> 
>      def set_up(self):
> @@ -79,27 +86,20 @@ class VirtioCryptodevUnitTest(TestCase):
>      def dut_execut_cmd(self, cmdline, ex='#', timout=30):
>          return self.dut.send_expect(cmdline, ex, timout)
> 
> -    def tar_dpdk(self):
> -        self.dut_execut_cmd("rm -rf %s" % self.target, '#', 100)
> -        self.dut_execut_cmd("tar -czf %s/dep/dpdk.tar.gz ../dpdk" %
> os.getcwd(), '#', 100)
> -
>      def build_user_dpdk(self, user_dut):
>          user_dut.send_expect(
>              "sed -i
> 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AES
> NI_MB=y/' config/common_base", '#', 30)
> -        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 600)
> -        assert ("Error" not in out), "Compilation error..."
> +        user_dut.send_expect(
> +            "sed -i
> 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g'
> config/common_base", '#', 30)
> +        out = user_dut.send_expect("make install T=%s" % self.target, "# ", 900)
> +        self.verify("Error" not in out, "compilation error 1")
> +        self.verify("No such file" not in out, "compilation error 2")
> 
>      def build_vhost_app(self):
> -        self.dut_execut_cmd("export RTE_SDK=`pwd`")
> -        self.dut_execut_cmd("export RTE_TARGET=%s" % self.target)
>          out = self.dut_execut_cmd("make -C ./examples/vhost_crypto")
> -        self.verify("Error" not in out, "compilation error")
> 
> -    def build_user_app(self, user_dut):
> -        user_dut.send_expect("export RTE_SDK=`pwd`", '#', 30)
> -        user_dut.send_expect("export RTE_TARGET=%s" % self.target, '#', 30)
> -        out = user_dut.send_expect("make -C ./%s test-build" % self.target, '#',
> 600)
> -        self.verify("Error" not in out, "compilation error")
> +        self.verify("Error" not in out, "compilation error 1")
> +        self.verify("No such file" not in out, "compilation error 2")
> 
>      def get_vhost_eal(self):
>          default_eal_opts = {
> @@ -129,16 +129,14 @@ class VirtioCryptodevUnitTest(TestCase):
> 
>      def launch_vhost_switch(self):
>          eal_opt_str = self.get_vhost_eal()
> +
>          config = '"(%s,0,0),(%s,0,0)"' % tuple(self.cores[-2:])
>          socket_file = "%s,/tmp/vm0_crypto0.sock --socket-
> file=%s,/tmp/vm0_crypto1.sock" % tuple(self.cores[-2:])
>          self.vhost_switch_cmd = cc.get_dpdk_app_cmd_str(self.sample_app,
> eal_opt_str,
>                                      '--config %s --socket-file %s' % (config, socket_file))
> 
> -        self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
> -
> -    def bind_vfio_pci(self):
> -        subprocess.getoutput("modprobe vfio-pci")
> -        subprocess.getoutput('%s -b vfio-pci %s' %
> (os.path.join(self.dut.base_dir, self.bind_script_path), self.vfio_pci))
> +        out = self.dut_execut_cmd(self.vhost_switch_cmd, "socket created", 30)
> +        self.logger.info(out)
> 
>      def set_virtio_pci(self, dut):
>          out = dut.send_expect("lspci -d:1054|awk '{{print $1}}'", "# ", 10) @@ -
> 150,26 +148,37 @@ class VirtioCryptodevUnitTest(TestCase):
>              dut.send_expect(cmd, "# ", 10)
>          dut.send_expect('echo "1af4 1054" >
> /sys/bus/pci/drivers/uio_pci_generic/new_id', "# ", 10)
> 
> +        return virtio_list
> +
>      def launch_virtio_dut(self, vm_name):
>          # start vm
>          vm = QEMUKvm(self.dut, vm_name, 'virtio_unit_cryptodev_func')
> +        vf0 = {'opt_host': self.sriov_vfs_port[0].pci}
> +        vm.set_vm_device(driver=self.vf_assign_method, **vf0)
> +        skip_setup = self.dut.skip_setup
> 
>          try:
> -            vm_dut = vm.start(set_target=False)
> +            self.dut.skip_setup = True
> +            vm_dut = vm.start()
>              if vm_dut is None:
>                  print(('{} start failed'.format(vm_name)))
>          except Exception as err:
>              raise err
> 
> +        self.dut.skip_setup = skip_setup
>          vm_dut.restore_interfaces()
> 
>          if not self.dut.skip_setup:
>              self.build_user_dpdk(vm_dut)
> -            self.build_user_app(vm_dut)
> 
>          vm_dut.setup_modules(self.target, "igb_uio", None)
>          vm_dut.bind_interfaces_linux('igb_uio')
> -        self.set_virtio_pci(vm_dut)
> +        vm.virtio_list = self.set_virtio_pci(vm_dut)
> +        self.logger.info("{} virtio list: {}".format(vm_name, vm.virtio_list))
> +        vm.cores = vm_dut.get_core_list("all")
> +        self.logger.info("{} core list: {}".format(vm_name, vm.cores))
> +        vm.ports = [port["pci"] for port in vm_dut.ports_info]
> +        self.logger.info("{} port list: {}".format(vm_name, vm.ports))
> 
>          return vm, vm_dut
> 
> @@ -180,7 +189,7 @@ class VirtioCryptodevUnitTest(TestCase):
>      def __run_unit_test(self, testsuite, eal_opt_str='', timeout=600):
>          self.logger.info("STEP_TEST: " + testsuite)
>          self.vm0_dut.send_expect("dmesg -C", "# ", 30)
> -        cmd_str = cc.get_dpdk_app_cmd_str(self.user_app, "--log-level 8",
> eal_opt_str)
> +        cmd_str = cc.get_dpdk_app_cmd_str(self.user_app, "--log-level
> + 6", eal_opt_str)
>          info = self.vm0_dut.send_expect(cmd_str, "RTE>>", 30)
>          self.logger.info(info)
> 
> @@ -202,11 +211,15 @@ class VirtioCryptodevUnitTest(TestCase):
>          pass
> 
>      def tear_down_all(self):
> -        if self.vm0:
> +        if getattr(self, 'vm0', None):
> +            self.vm0_dut.kill_all()
>              self.vm0.stop()
> -            self.dut.virt_exit()
>              self.vm0 = None
> 
> +        if getattr(self, 'used_dut_port', None) != None:
> +            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> +            self.used_dut_port = None
> +
>          self.dut_execut_cmd("^C", "# ")
>          self.dut_execut_cmd("killall -s INT vhost-crypto")
>          self.dut_execut_cmd("killall -s INT qemu-system-x86_64")
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-11  4:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 22:58 [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test xinfengx
2020-03-02 22:58 ` [dts] [PATCH 2/4] tests: modify the suite of cryptodev virtio perf test xinfengx
2020-03-02 22:58 ` [dts] [PATCH 3/4] tests: modify the suite of cryptodev virtio ipsec test xinfengx
2020-03-02 22:58 ` [dts] [PATCH 4/4] conf: modify the config files for cryptodev virtio test suites xinfengx
2020-03-03  8:33   ` Zhao, XinfengX
2020-03-11  4:31 ` [dts] [PATCH 1/4] tests: modify the suite of cryptodev virtio unit-test Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).