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 DE9A4A00BE; Tue, 7 Jul 2020 12:16:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D54BD1DDD6; Tue, 7 Jul 2020 12:16:51 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5C9D61DDD6 for ; Tue, 7 Jul 2020 12:16:50 +0200 (CEST) IronPort-SDR: 0kpTqJSbxzxOgdriRBRw1y2Q+2I1hn86xAHxuZLSnDJWiqIjv1qb4zVO/WVVzemnMLdDV+S3E0 /zh6AIJ4knPQ== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="127160978" X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="127160978" 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:50 -0700 IronPort-SDR: kUD2UXWsyNXg/MoBTZ3OIZT6EUCxL5UJnLweG9cLC4N3EPmBMehs1RkpmIBbAJn9GGSz96L923 3BLooNHzDsAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="457051241" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga005.jf.intel.com with ESMTP; 07 Jul 2020 03:16:48 -0700 From: lihong To: dts@dpdk.org Cc: zhaoyan.chen@intel.com, lihong Date: Tue, 7 Jul 2020 10:44:59 +0800 Message-Id: <1594089903-26285-4-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 3/7] framework/config: get configuration information from app_name.cfg 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/config.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/framework/config.py b/framework/config.py index 4dc3f31..dd3bf30 100644 --- a/framework/config.py +++ b/framework/config.py @@ -48,6 +48,7 @@ IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH PKTGENCONF = "%s/pktgen.cfg" % CONFIG_ROOT_PATH SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH GLOBALCONF = "%s/global_suite.cfg" % CONFIG_ROOT_PATH +APPNAMECONF = "%s/app_name.cfg" % CONFIG_ROOT_PATH class UserConf(): @@ -471,6 +472,34 @@ class PktgenConf(UserConf): return self.pktgen_cfg +class AppNameConf(UserConf): + def __init__(self, app_name_conf=APPNAMECONF): + self.config_file = app_name_conf + self.app_name_cfg = {} + try: + self.app_name_conf = UserConf(self.config_file) + except ConfigParseException: + self.app_name_conf = None + raise ConfigParseException + + def load_app_name_conf(self): + sections = self.app_name_conf.get_sections() + if not sections: + return self.app_name_cfg + + for build_type in sections: + cur_name_cfg = self.app_name_conf.load_section(build_type) + if not cur_name_cfg: + continue + + name_cfg = {} + for cfg in cur_name_cfg: + key, value = cfg + name_cfg[key] = value + + self.app_name_cfg[build_type.lower()]=name_cfg + + return self.app_name_cfg if __name__ == '__main__': parser = argparse.ArgumentParser( -- 2.7.4