From: Yuwei Zhang <yuwei1.zhang@intel.com>
To: dts@dpdk.org
Cc: Yuwei Zhang <yuwei1.zhang@intel.com>
Subject: [dts] [PATCH v1] add a global config file to all test suites
Date: Fri, 6 Oct 2017 09:13:55 +0800 [thread overview]
Message-ID: <20171006011355.4852-1-yuwei1.zhang@intel.com> (raw)
Signed-off-by: Yuwei Zhang <yuwei1.zhang@intel.com>
---
conf/global_suite.cfg | 2 ++
framework/config.py | 28 +++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 conf/global_suite.cfg
diff --git a/conf/global_suite.cfg b/conf/global_suite.cfg
new file mode 100644
index 0000000..d784fc5
--- /dev/null
+++ b/conf/global_suite.cfg
@@ -0,0 +1,2 @@
+[global]
+vf_driver=pci-stub
\ No newline at end of file
diff --git a/framework/config.py b/framework/config.py
index 9e514a7..80f1dd3 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -45,6 +45,7 @@ CRBCONF = "%s/crbs.cfg" % CONFIG_ROOT_PATH
VIRTCONF = "%s/virt_global.cfg" % CONFIG_ROOT_PATH
IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH
SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH
+GLOBALCONF = "%s/global_suite.cfg" % CONFIG_ROOT_PATH
class UserConf():
@@ -87,11 +88,36 @@ class UserConf():
paramDict[key] = value
return paramDict
+class GlobalConf(UserConf):
+ def __init__(self):
+ self.global_cfg = {}
+ try:
+ self.global_conf = UserConf(GLOBALCONF)
+ except ConfigParseException:
+ self.global_conf = None
+
+ # load global configuration
+ self.global_cfg = self.load_global_config()
+
+ def load_global_config(self, section_name='global'):
+ global_cfg = self.global_cfg.copy()
+ try:
+ section_confs = self.global_conf.load_section(section_name)
+ except:
+ print "FAILED FIND SECTION[%s] CONFIG!!!" % section_name
+ return global_cfg
+
+ if section_confs is None:
+ return global_cfg
+ global_cfg = dict(section_confs)
+
+ return global_cfg
+
class SuiteConf(UserConf):
def __init__(self, suite_name=""):
+ self.suite_cfg = GlobalConf().load_global_config()
self.config_file = CONFIG_ROOT_PATH + os.sep + suite_name + ".cfg"
- self.suite_cfg = {}
try:
self.suite_conf = UserConf(self.config_file)
except ConfigParseException:
--
2.14.1.windows.1
next reply other threads:[~2017-10-06 1:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 1:13 Yuwei Zhang [this message]
2017-10-09 11:38 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171006011355.4852-1-yuwei1.zhang@intel.com \
--to=yuwei1.zhang@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).