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

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).