From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E19FA00BE; Tue, 7 Jul 2020 12:16:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 359251DDDA; Tue, 7 Jul 2020 12:16:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 0B6D31DD11 for ; Tue, 7 Jul 2020 12:16:54 +0200 (CEST) IronPort-SDR: s0ZwNoUTc0qFs6hbOXMoIK3uM7y3Zka58XaCMbmoyjvJmjipI6kBb36Ay8N2blQBNfUqeC79nT IH2CwlzOvSuw== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="127160991" X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="127160991" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 03:16:54 -0700 IronPort-SDR: 7VugsCbc0NG6xuQjGX7hk9WdwbECVNRKrYgd/lTb6GvvFkxGVl8a65XVM9263Db4XFy/fIsCpg 8rWamHGoHK5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="457051281" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga005.jf.intel.com with ESMTP; 07 Jul 2020 03:16:52 -0700 From: lihong To: dts@dpdk.org Cc: zhaoyan.chen@intel.com, lihong Date: Tue, 7 Jul 2020 10:45:01 +0800 Message-Id: <1594089903-26285-6-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594089903-26285-1-git-send-email-lihongx.ma@intel.com> References: <1594089903-26285-1-git-send-email-lihongx.ma@intel.com> Subject: [dts] [PATCH V1 5/7] framework: add meson build method and get apps name of current build type X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Signed-off-by: lihong --- framework/dut.py | 8 ++- framework/project_dpdk.py | 128 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 127 insertions(+), 9 deletions(-) diff --git a/framework/dut.py b/framework/dut.py index 2545621..bef0d15 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -33,7 +33,7 @@ import os import re import time import settings -from config import PortConf +from config import PortConf,AppNameConf from settings import NICS, LOG_NAME_SEP from ssh_connection import SSHConnection from crb import Crb @@ -78,6 +78,8 @@ class Dut(Crb): self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime()) self.prefix_list = [] self.hugepage_path = None + self.apps_name_conf = {} + self.apps_name = {} def filter_cores_from_crb_cfg(self): # get core list from crbs.cfg @@ -388,6 +390,10 @@ class Dut(Crb): # initialize virtualization resource pool self.virt_pool = VirtResource(self) + # load app name conf + name_cfg = AppNameConf() + self.apps_name_conf = name_cfg.load_app_name_conf() + def restore_interfaces(self): """ Restore all ports's interfaces. diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index c0dfd59..040d070 100644 --- a/framework/project_dpdk.py +++ b/framework/project_dpdk.py @@ -33,7 +33,7 @@ import os import re from settings import NICS, load_global_setting, accepted_nic -from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING, HOST_DRIVER_MODE_SETTING +from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING, HOST_DRIVER_MODE_SETTING, HOST_BUILD_TYPE_SETTING from settings import HOST_SHARED_LIB_SETTING, HOST_SHARED_LIB_PATH from ssh_connection import SSHConnection from crb import Crb @@ -73,6 +73,16 @@ class DPDKdut(Dut): self.set_driver_specific_configurations(drivername) + # 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 + ' ' + if not self.skip_setup: self.build_install_dpdk(target) @@ -214,10 +224,58 @@ class DPDKdut(Dut): "config/common_base", '#') self.send_expect("sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' " "config/common_base", '#') - build_install_dpdk = getattr(self, 'build_install_dpdk_%s' % self.get_os_type()) + build_type = load_global_setting(HOST_BUILD_TYPE_SETTING) + build_install_dpdk = getattr(self, 'build_install_dpdk_%s_%s' % (self.get_os_type(), build_type)) build_install_dpdk(target, extra_options) - def build_install_dpdk_linux(self, target, extra_options): + def build_install_dpdk_linux_meson(self, target, extra_options): + """ + Build DPDK source code on linux use meson + """ + build_time = 900 + target_info = target.split('-') + arch = target_info[0] + machine = target_info[1] + execenv = target_info[2] + toolchain = target_info[3] + + default_library = 'static' + use_shared_lib = load_global_setting(HOST_SHARED_LIB_SETTING) + if use_shared_lib == 'true' and 'Virt' not in str(self): + default_library = 'shared' + if arch == 'i686': + # find the pkg-config path and set the PKG_CONFIG_LIBDIR environmental variable to point it + out = self.send_expect("find /usr -type d -name pkgconfig", "# ") + pkg_path = '' + default_cflags = self.send_expect("echo $CFLAGS", "# ") + default_pkg_config = self.send_expect("echo $PKG_CONFIG_LIBDIR", "# ") + res_path = out.split('\r\n') + for cur_path in res_path: + if 'i386' in cur_path: + pkg_path = cur_path + break + assert(pkg_path is not ''), "please make sure you env have the i386 pkg-config path" + + self.send_expect("export CFLAGS=-m32", "# ") + self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ") + + self.send_expect("rm -rf " + target, "#") + out = self.send_expect("CC=%s meson --werror -Denable_kmods=True -Dlibdir=lib --default-library=%s %s" % ( + toolchain, default_library, target), "# ", build_time) + assert ("Error" not in out), "meson setup failed ..." + + out = self.send_expect("ninja -C %s -j %d" % (target, self.number_of_cores), "# ", build_time) + assert ("Error" not in out), "ninja complie failed ..." + + # copy kmod file to the folder same as make + out = self.send_expect("find ./%s/kernel/ -name *.ko" % target, "# ", verify=True) + self.send_expect("mkdir -p %s/kmod" % target, "# ") + if not isinstance(out, int) and len(out) > 0: + kmod = out.split('\r\n') + for mod in kmod: + self.send_expect("cp %s %s/kmod/" % (mod, target), "# ") + + def build_install_dpdk_linux_makefile(self, target, extra_options): """ Build DPDK source code on linux with specified target. """ @@ -241,7 +299,11 @@ class DPDKdut(Dut): assert ("Error" not in out), "Compilation error..." assert ("No rule to make" not in out), "No rule to make error..." - def build_install_dpdk_freebsd(self, target, extra_options): + def build_install_dpdk_freebsd_meson(self, target, extra_options): + # meson build same as linux + self.build_install_dpdk_linux_meson(target, extra_options) + + def build_install_dpdk_freebsd_makefile(self, target, extra_options): """ Build DPDK source code on Freebsd with specified target. """ @@ -312,7 +374,6 @@ class DPDKdut(Dut): self.send_expect("mkdir -p ~/QMP", "# ") self.session.copy_file_to('dep/QMP/qemu-ga-client', '~/QMP/') self.session.copy_file_to('dep/QMP/qmp.py', '~/QMP/') - self.kill_all() # enable core dump @@ -395,10 +456,57 @@ class DPDKdut(Dut): """ Build dpdk sample applications. """ - build_dpdk_apps = getattr(self, 'build_dpdk_apps_%s' % self.get_os_type()) + build_type = load_global_setting(HOST_BUILD_TYPE_SETTING) + build_dpdk_apps = getattr(self, 'build_dpdk_apps_%s_%s' % (self.get_os_type(), build_type)) return build_dpdk_apps(folder, extra_options) - def build_dpdk_apps_linux(self, folder, extra_options): + def build_dpdk_apps_linux_meson(self, folder, extra_options): + """ + Build dpdk sample applications on linux use meson + """ + # icc compile need more time + if 'icc' in self.target: + timeout = 300 + else: + timeout = 90 + + target_info = self.target.split('-') + arch = target_info[0] + if arch == 'i686': + # find the pkg-config path and set the PKG_CONFIG_LIBDIR environmental variable to point it + out = self.send_expect("find /usr -type d -name pkgconfig", "# ") + pkg_path = '' + default_cflags = self.send_expect("echo $CFLAGS", "# ") + default_pkg_config = self.send_expect("echo $PKG_CONFIG_LIBDIR", "# ") + res_path = out.split('\r\n') + for cur_path in res_path: + if 'i386' in cur_path: + pkg_path = cur_path + break + assert(pkg_path is not ''), "please make sure you env have the i386 pkg-config path" + + self.send_expect("export CFLAGS=-m32", "# ", alt_session=True) + self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ", alt_session=True) + + folder_info = folder.split('/') + name = folder_info[-1] + if name not in self.apps_name: + raise Exception('Please config %s file path on conf/app_name.cfg' % name) + + example = '/'.join(folder_info[folder_info.index('examples')+1:]) + self.send_expect("cd %s/%s" % (self.base_dir, self.target), "# ", alt_session=True) + out = self.send_expect("meson configure -Dexamples=%s" % example, "# ", alt_session=True) + assert ("Error" not in out), "Compilation error..." + out = self.send_expect("ninja", "# ", timeout, alt_session=True) + assert ("Error" not in out), "Compilation error..." + + # verify the app build in the config path + out = self.send_expect('ls %s' % self.apps_name[name], "# ", verify=True) + assert(isinstance(out, str)), 'please confirm %s app path and name in app_name.cfg' % name + + return out + + def build_dpdk_apps_linux_makefile(self, folder, extra_options): """ Build dpdk sample applications on linux. """ @@ -414,7 +522,11 @@ class DPDKdut(Dut): folder, extra_options), "# ", timeout) - def build_dpdk_apps_freebsd(self, folder, extra_options): + def build_dpdk_apps_freebsd_meson(self, folder, extra_options): + # meson build same as linux + self.build_dpdk_apps_linux_meson(folder, extra_options) + + def build_dpdk_apps_freebsd_makefile(self, folder, extra_options): """ Build dpdk sample applications on Freebsd. """ -- 2.7.4