[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH test-API] Add default uri in env.cfg for testcases



    *env.cfg define default uri
    *generator.py add it into params dict
---
 env.cfg      |    4 ++++
 generator.py |    8 ++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/env.cfg b/env.cfg
index 968e512..2cccbc7 100644
--- a/env.cfg
+++ b/env.cfg
@@ -107,6 +107,10 @@ wget_url = http://
 # considered as not defined.
 #
 [variables]
+
+# default hypervisor uri address
+defaulturi = qemu:///system
+
 ################################################################
 #
 # domain
diff --git a/generator.py b/generator.py
index 4f4478b..700afc5 100644
--- a/generator.py
+++ b/generator.py
@@ -25,6 +25,7 @@ import traceback
 import mapper
 from utils.Python import log
 from utils.Python import format
+from utils.Python import env_parser
 
 # Import of distribution-specific code.  If this is needed somewhere
 # else in the future, please don't copy-paste this, but create some
@@ -57,6 +58,8 @@ class FuncGen(object):
         # Save case information to a file in a format
         self.__case_info_save(activity, testrunid)
 
+        self.env = env_parser.Envparser("env.cfg")
+
         mapper_obj = mapper.Mapper(activity)
         pkg_casename_func = mapper_obj.package_casename_func_map()
 
@@ -154,6 +157,11 @@ class FuncGen(object):
             clean_ret = -1
             try:
                 try:
+                    # Get default uri from env.cfg, if the uri is defined in
+                    # case config file, the value will be overrode.
+                    if 'uri' not in case_params:
+                        case_params['uri'] = self.env.get_value("variables", "defaulturi")
+
                     if case_ref_name != 'sleep':
                         case_params['logger'] = case_logger
 
-- 
1.7.7.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]