[dts] [PATCH] Enhance set_target function for check whether bind devices

Yong Liu yong.liu at intel.com
Mon Jul 6 08:01:04 CEST 2015


From: Marvin Liu <yong.liu at intel.com>

Most of time, devices need bound to igb_uio for later validation.
But in special case like legacy driver, devices should not bound first.

Signed-off-by: Marvin Liu <yong.liu at intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index b843f22..5312849 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -289,7 +289,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario):
         try:
             if scene:
                 scene.set_target(target)
-                dut.set_target(target, build_only=True)
+                dut.set_target(target, bind_dev=False)
             else:
                 dut.set_target(target)
         except AssertionError as ex:
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index bc1a9bd..7cbff51 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -53,7 +53,7 @@ class DPDKdut(Dut):
         super(DPDKdut, self).__init__(crb, serializer)
         self.testpmd = None
 
-    def set_target(self, target, build_only=False):
+    def set_target(self, target, bind_dev=True):
         """
         Set env variable, these have to be setup all the time. Some tests
         need to compile example apps by themselves and will fail otherwise.
@@ -76,7 +76,7 @@ class DPDKdut(Dut):
         self.setup_memory()
         self.setup_modules(target)
 
-        if build_only is False and self.get_os_type() == 'linux':
+        if bind_dev and self.get_os_type() == 'linux':
             self.bind_interfaces_linux(dts.drivername)
 
     def setup_modules(self, target):
diff --git a/framework/virt_base.py b/framework/virt_base.py
index b9ea56f..9787ed3 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -223,7 +223,7 @@ class VirtBase(object):
         self.load_global_config()
         self.load_local_config(self.suite)
 
-    def start(self, load_config=True, set_target=True, auto_portmap=True):
+    def start(self, load_config=True, set_target=True, auto_portmap=True, bind_dev=True):
         """
         Start VM and instantiate the VM with VirtDut.
         """
@@ -292,7 +292,7 @@ class VirtBase(object):
         """
         NotImplemented
 
-    def instantiate_vm_dut(self, set_target=True, auto_portmap=True):
+    def instantiate_vm_dut(self, set_target=True, auto_portmap=True, bind_dev=True):
         """
         Instantiate the Dut class for VM.
         """
@@ -341,7 +341,7 @@ class VirtBase(object):
             vm_dut.prerequisites(dts.Package, dts.Patches, auto_portmap)
             if set_target:
                 target = self.host_dut.target
-                vm_dut.set_target(target)
+                vm_dut.set_target(target, bind_dev)
         except:
             raise exception.VirtDutInitException(vm_dut)
             return None
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 2edbf6f..05ead10 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -119,7 +119,7 @@ class VirtDut(DPDKdut):
                 pci_idx = self.tester.get_local_index(tester_pci)
                 self.ports_map[index] = pci_idx
 
-    def set_target(self, target):
+    def set_target(self, target, bind_dev=True):
         """
         Set env variable, these have to be setup all the time. Some tests
         need to compile example apps by themselves and will fail otherwise.
@@ -140,7 +140,8 @@ class VirtDut(DPDKdut):
         self.setup_memory(hugepages=512)
         self.setup_modules(target)
 
-        self.bind_interfaces_linux('igb_uio')
+        if bind_dev:
+            self.bind_interfaces_linux('igb_uio')
 
     def prerequisites(self, pkgName, patch, auto_portmap):
         """
-- 
1.9.3



More information about the dts mailing list