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 9BC19A0521; Tue, 3 Nov 2020 08:29:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 79F78BE7D; Tue, 3 Nov 2020 08:29:05 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CCC01BE7B for ; Tue, 3 Nov 2020 08:29:03 +0100 (CET) IronPort-SDR: FSdZN0aQlCrSlhhSc5zfOsgYLuA5/qZbtaL4/YGXTQ/n7PPl8O7/suS7NfBJwbs3AO70QZFsEt MMjeUnI7jSZA== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="186855034" X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="186855034" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 23:29:01 -0800 IronPort-SDR: z62QY6eqhKVrYpxBfhinzfTHUT6SiXJTUTmoiSj0VMItF9qgwL04pTwlW/QInGFFcRXsKpG6UI /gei1DeyYGsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="320333252" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga003.jf.intel.com with ESMTP; 02 Nov 2020 23:29:00 -0800 From: LihongX Ma To: dts@dpdk.org Cc: LihongX Ma Date: Tue, 3 Nov 2020 07:54:18 +0800 Message-Id: <1604361258-24750-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] framework: modify the method of set options of dpdk 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" - As now many options can not been setted by meson build parameter, so modify the config file directly to change it - add api to modify the config file of makefile Signed-off-by: LihongX Ma --- framework/project_dpdk.py | 89 ++++++++++++++++++++++------------------------- framework/virt_dut.py | 1 - 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index d45ce47..6e17d59 100644 --- a/framework/project_dpdk.py +++ b/framework/project_dpdk.py @@ -65,7 +65,6 @@ class DPDKdut(Dut): self.build_type = load_global_setting(HOST_BUILD_TYPE_SETTING) if self.build_type not in self.apps_name_conf: raise Exception('please config the apps name in app_name.cfg of build type:%s' % self.build_type) - self.config_build_options = {} self.target = target self.set_toolchain(target) @@ -194,26 +193,12 @@ class DPDKdut(Dut): mode = load_global_setting(DPDK_RXMODE_SETTING) if mode == 'scalar': - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/" - + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30) - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=.*$/" - + "CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y/' config/common_base", "# ", 30) self.set_build_options({'RTE_LIBRTE_I40E_INC_VECTOR': 'n', 'RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC': 'y'}) if mode == 'full': - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/" - + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30) - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=.*$/" - + "CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=n/' config/common_base", "# ", 30) self.set_build_options({'RTE_LIBRTE_I40E_INC_VECTOR': 'n', 'RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC': 'n'}) if mode == 'novector': - self.send_expect("sed -i -e 's/CONFIG_RTE_IXGBE_INC_VECTOR=.*$/" - + "CONFIG_RTE_IXGBE_INC_VECTOR=n/' config/common_base", "# ", 30) - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/" - + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30) - self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=.*$/" - + "CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=n/' config/common_base", "# ", 30) self.set_build_options({'RTE_IXGBE_INC_VECTOR': 'n', 'RTE_LIBRTE_I40E_INC_VECTOR': 'n', 'RTE_LIBRTE_FM10K_INC_VECTOR': 'n'}) @@ -223,43 +208,55 @@ class DPDKdut(Dut): self.patches = patch_list def set_build_options(self, config_parms, config_file=''): + build_type = load_global_setting(HOST_BUILD_TYPE_SETTING) + set_build_options = getattr(self, 'set_build_options_%s' % (build_type)) + set_build_options(config_parms, config_file) + + def set_build_options_makefile(self, config_parms, config_file=''): """ - Set dpdk build options of meson + Set dpdk build options of makefile """ if len(config_parms) == 0: - return options + return; + if config_file == '': + config_file = 'config/common_base' + for key in config_parms.keys(): value = config_parms[key] - if value == '' or value == 'y': - value = 1 + if isinstance(value, int): + self.send_expect("sed -i -e 's/CONFIG_%s=.*$/CONFIG_%s=%d/' %s" % (key, key, value, config_file), "# ") else: - # does not need to set the configuration if the value is, mean do not define it - if type(value) == str and value != 'n': - value = '\\"%s\\"' % config_parms[key] + if value == '': + value = 'y' + elif len(value) > 1: + value = '\\"%s\\"' % value + self.send_expect("sed -i -e 's/CONFIG_%s=.*$/CONFIG_%s=%s/' %s" % (key, key, value, config_file), "# ") - self.config_build_options[key] = value - - def generator_build_option_string(self): + def set_build_options_meson(self, config_parms, config_file=''): """ - Generator the build option string according to self.config_build_options dictionary + Set dpdk build options of meson """ - params = [] - for key in self.config_build_options.keys(): - value = self.config_build_options[key] + if len(config_parms) == 0: + return + if config_file == '': + config_file = 'config/rte_config.h' + + for key in config_parms.keys(): + value = config_parms[key] if value == 'n': - continue + def_str = '#undef' + ' ' + key else: - params.append('-D%s=%s' % (key, value)) + if isinstance(value, int): + def_str = '#define %s %d' % (key, value) + elif value == '' or value == 'y': + def_str = '#define %s %d' % (key, 1) + else: + value = '\\"%s\\"' % value + def_str = '#define %s %s' % (key, value) - if len(params) == 0: - return '' - else: - # if will compile 32bit app, should add the parameter of -m32 - if 'i686' in self.target: - args = '-Dc_args=' + '\'-m32 %s\'' % ' '.join(params) - else: - args = '-Dc_args=' + '\'%s\'' % ' '.join(params) - return args + # delete the marco define in the config file + self.send_expect("sed -i '/%s/d' %s" % (key, config_file), "# ") + self.send_expect("sed -i '$a\%s' %s" % (def_str, config_file), "# ") def build_install_dpdk(self, target, extra_options=''): """ @@ -268,11 +265,7 @@ class DPDKdut(Dut): use_shared_lib = load_global_setting(HOST_SHARED_LIB_SETTING) shared_lib_path = load_global_setting(HOST_SHARED_LIB_PATH) if use_shared_lib == 'true' and 'Virt' not in str(self): - self.send_expect("sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' " - "config/common_base", '#') self.set_build_options({'RTE_BUILD_SHARED_LIB': 'y'}) - self.send_expect("sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' " - "config/common_base", '#') 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) @@ -308,11 +301,9 @@ class DPDKdut(Dut): self.send_expect("export CFLAGS=-m32", "# ") self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ") - options_config = self.generator_build_option_string() - self.send_expect("rm -rf " + target, "#") - out = self.send_expect("CC=%s meson --werror -Denable_kmods=True %s -Dlibdir=lib %s --default-library=%s %s" % ( - toolchain, extra_options, options_config, default_library, target), "# ", build_time) + out = self.send_expect("CC=%s meson --werror -Denable_kmods=True -Dlibdir=lib %s --default-library=%s %s" % ( + toolchain, extra_options, default_library, target), "# ", build_time) assert ("FAILED" not in out), "meson setup failed ..." out = self.send_expect("ninja -C %s -j %d" % (target, self.number_of_cores), "# ", build_time) @@ -339,6 +330,8 @@ class DPDKdut(Dut): self.send_expect("rm -rf %s" % r'./app/test/test_resource_tar.res.o' , "#") self.send_expect("rm -rf %s" % r'./app/test/test_pci_sysfs.res.o' , "#") + self.set_build_options({'RTE_EAL_IGB_UIO': 'y'}) + # compile out = self.send_expect("make -j %d install T=%s %s MAKE_PAUSE=n" % (self.number_of_cores, target, extra_options), "# ", build_time) diff --git a/framework/virt_dut.py b/framework/virt_dut.py index b6078e1..03569ba 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -231,7 +231,6 @@ class VirtDut(DPDKdut): for app in self.apps_name: cur_app_path = self.apps_name[app].replace('target', self.target) self.apps_name[app] = cur_app_path + ' ' - self.config_build_options = {} def init_core_list(self): self.cores = [] -- 2.7.4