[V1] framework: get apps name of current build type in virt_dut

Message ID 1595287665-21936-1-git-send-email-lihongx.ma@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] framework: get apps name of current build type in virt_dut |

Commit Message

Ma, LihongX July 20, 2020, 11:27 p.m. UTC
  fix dts issue of d8f3830696b54d48e78463, in virt_dut also need get apps_name from config file

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 framework/virt_base.py |  1 +
 framework/virt_dut.py  | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
  

Comments

Zhang, XiX July 21, 2020, 7:09 a.m. UTC | #1
Tested-by: Zhang, XiX <xix.zhang@intel.com>

-----Original Message-----
From: Ma, LihongX 
Sent: Tuesday, July 21, 2020 7:28 AM
To: dts@dpdk.org; Zhang, XiX <xix.zhang@intel.com>
Cc: Ma, LihongX <lihongx.ma@intel.com>
Subject: [dts][PATCH V1] framework: get apps name of current build type in virt_dut

fix dts issue of d8f3830696b54d48e78463, in virt_dut also need get apps_name from config file

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 framework/virt_base.py |  1 +
 framework/virt_dut.py  | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/framework/virt_base.py b/framework/virt_base.py index c959ca0..b582f85 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -460,6 +460,7 @@ class VirtBase(object):
 
         try:
             # setting up dpdk in vm, must call at last
+            vm_dut.target = self.host_dut.target
             vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches, autodetect_topo)
             if set_target:
                 target = self.host_dut.target diff --git a/framework/virt_dut.py b/framework/virt_dut.py index adf486b..03569ba 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -34,8 +34,8 @@ import re
 import time
 import settings
 from utils import RED, parallel_lock
-from config import PortConf
-from settings import NICS, LOG_NAME_SEP, get_netdev
+from config import PortConf, AppNameConf from settings import NICS, 
+LOG_NAME_SEP, get_netdev, load_global_setting, HOST_BUILD_TYPE_SETTING
 from project_dpdk import DPDKdut
 from dut import Dut
 from net_device import GetNicObj
@@ -76,6 +76,8 @@ class VirtDut(DPDKdut):
         self.virttype = virttype
         self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime())
         self.prefix_list = []
+        self.apps_name_conf = {}
+        self.apps_name = {}
 
     def init_log(self):
         if hasattr(self.host_dut, "test_classname"):
@@ -216,6 +218,20 @@ class VirtDut(DPDKdut):
         for port_info in self.ports_info:
             self.logger.info(port_info)
 
+        # load app name conf
+        name_cfg = AppNameConf()
+        self.apps_name_conf = name_cfg.load_app_name_conf()
+
+        # get apps name of current build type
+        build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
+        if build_type not in self.apps_name_conf:
+            raise Exception('please config the apps name in app_name.cfg of build type:%s' % build_type)
+        self.apps_name = self.apps_name_conf[build_type]
+        # use the dut target directory instead of 'target' string in app name
+        for app in self.apps_name:
+            cur_app_path = self.apps_name[app].replace('target', self.target)
+            self.apps_name[app] = cur_app_path + ' '
+
     def init_core_list(self):
         self.cores = []
         cpuinfo = self.send_expect("grep --color=never \"processor\""
--
2.7.4
  
Tu, Lijuan July 24, 2020, 2:40 a.m. UTC | #2
Applied, thanks

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of lihong
> Sent: 2020年7月21日 7:28
> To: dts@dpdk.org; Zhang, XiX <xix.zhang@intel.com>
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] framework: get apps name of current build type in
> virt_dut
> 
> fix dts issue of d8f3830696b54d48e78463, in virt_dut also need get apps_name
> from config file
> 
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
>  framework/virt_base.py |  1 +
>  framework/virt_dut.py  | 20 ++++++++++++++++++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/framework/virt_base.py b/framework/virt_base.py index
> c959ca0..b582f85 100644
> --- a/framework/virt_base.py
> +++ b/framework/virt_base.py
> @@ -460,6 +460,7 @@ class VirtBase(object):
> 
>          try:
>              # setting up dpdk in vm, must call at last
> +            vm_dut.target = self.host_dut.target
>              vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches,
> autodetect_topo)
>              if set_target:
>                  target = self.host_dut.target diff --git a/framework/virt_dut.py
> b/framework/virt_dut.py index adf486b..03569ba 100644
> --- a/framework/virt_dut.py
> +++ b/framework/virt_dut.py
> @@ -34,8 +34,8 @@ import re
>  import time
>  import settings
>  from utils import RED, parallel_lock
> -from config import PortConf
> -from settings import NICS, LOG_NAME_SEP, get_netdev
> +from config import PortConf, AppNameConf from settings import NICS,
> +LOG_NAME_SEP, get_netdev, load_global_setting,
> HOST_BUILD_TYPE_SETTING
>  from project_dpdk import DPDKdut
>  from dut import Dut
>  from net_device import GetNicObj
> @@ -76,6 +76,8 @@ class VirtDut(DPDKdut):
>          self.virttype = virttype
>          self.prefix_subfix = str(os.getpid()) + '_' +
> time.strftime("%Y%m%d%H%M%S", time.localtime())
>          self.prefix_list = []
> +        self.apps_name_conf = {}
> +        self.apps_name = {}
> 
>      def init_log(self):
>          if hasattr(self.host_dut, "test_classname"):
> @@ -216,6 +218,20 @@ class VirtDut(DPDKdut):
>          for port_info in self.ports_info:
>              self.logger.info(port_info)
> 
> +        # load app name conf
> +        name_cfg = AppNameConf()
> +        self.apps_name_conf = name_cfg.load_app_name_conf()
> +
> +        # get apps name of current build type
> +        build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
> +        if build_type not in self.apps_name_conf:
> +            raise Exception('please config the apps name in app_name.cfg of build
> type:%s' % build_type)
> +        self.apps_name = self.apps_name_conf[build_type]
> +        # use the dut target directory instead of 'target' string in app name
> +        for app in self.apps_name:
> +            cur_app_path = self.apps_name[app].replace('target', self.target)
> +            self.apps_name[app] = cur_app_path + ' '
> +
>      def init_core_list(self):
>          self.cores = []
>          cpuinfo = self.send_expect("grep --color=never \"processor\""
> --
> 2.7.4
  

Patch

diff --git a/framework/virt_base.py b/framework/virt_base.py
index c959ca0..b582f85 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -460,6 +460,7 @@  class VirtBase(object):
 
         try:
             # setting up dpdk in vm, must call at last
+            vm_dut.target = self.host_dut.target
             vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches, autodetect_topo)
             if set_target:
                 target = self.host_dut.target
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index adf486b..03569ba 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -34,8 +34,8 @@  import re
 import time
 import settings
 from utils import RED, parallel_lock
-from config import PortConf
-from settings import NICS, LOG_NAME_SEP, get_netdev
+from config import PortConf, AppNameConf
+from settings import NICS, LOG_NAME_SEP, get_netdev, load_global_setting, HOST_BUILD_TYPE_SETTING
 from project_dpdk import DPDKdut
 from dut import Dut
 from net_device import GetNicObj
@@ -76,6 +76,8 @@  class VirtDut(DPDKdut):
         self.virttype = virttype
         self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime())
         self.prefix_list = []
+        self.apps_name_conf = {}
+        self.apps_name = {}
 
     def init_log(self):
         if hasattr(self.host_dut, "test_classname"):
@@ -216,6 +218,20 @@  class VirtDut(DPDKdut):
         for port_info in self.ports_info:
             self.logger.info(port_info)
 
+        # load app name conf
+        name_cfg = AppNameConf()
+        self.apps_name_conf = name_cfg.load_app_name_conf()
+
+        # get apps name of current build type
+        build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
+        if build_type not in self.apps_name_conf:
+            raise Exception('please config the apps name in app_name.cfg of build type:%s' % build_type)
+        self.apps_name = self.apps_name_conf[build_type]
+        # use the dut target directory instead of 'target' string in app name
+        for app in self.apps_name:
+            cur_app_path = self.apps_name[app].replace('target', self.target)
+            self.apps_name[app] = cur_app_path + ' '
+
     def init_core_list(self):
         self.cores = []
         cpuinfo = self.send_expect("grep --color=never \"processor\""