test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH v1] add a global config file to all test suites
@ 2017-10-06  1:13 Yuwei Zhang
  2017-10-09 11:38 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: Yuwei Zhang @ 2017-10-06  1:13 UTC (permalink / raw)
  To: dts; +Cc: Yuwei Zhang

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH v1] add a global config file to all test suites
  2017-10-06  1:13 [dts] [PATCH v1] add a global config file to all test suites Yuwei Zhang
@ 2017-10-09 11:38 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2017-10-09 11:38 UTC (permalink / raw)
  To: Yuwei Zhang, dts

Thanks, applied.

On 10/06/2017 09:13 AM, Yuwei Zhang wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-09  2:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06  1:13 [dts] [PATCH v1] add a global config file to all test suites Yuwei Zhang
2017-10-09 11:38 ` Liu, Yong

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).