[dts] [PATCH v3 1/4] framework setting: support change configuration file folder

Marvin Liu yong.liu at intel.com
Thu Jul 27 03:07:50 CEST 2017


By default, configuration files will be loaded from default folder.
It will be inconvenience for backup local configuration files.

In this patch, add one new environment variable "DTS_CFG_FOLDER" which
can change the default folder of configuration files. Execution
configuration file will also be loaded from this folder.

Signed-off-by: Marvin Liu <yong.liu at intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index 7835574..26042cf 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -474,6 +474,10 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     requested_tests = test_cases
 
     # Read config file
+    dts_cfg_folder = settings.load_global_setting(settings.DTS_CFG_FOLDER)
+    if dts_cfg_folder != '':
+        config_file = dts_cfg_folder + os.sep +  config_file
+
     config = ConfigParser.SafeConfigParser()
     load_cfg = config.read(config_file)
     if len(load_cfg) == 0:
diff --git a/framework/settings.py b/framework/settings.py
index f0f3c8f..d306de2 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -188,14 +188,14 @@ Global macro for dts.
 IXIA = "ixia"
 
 """
-The root path of framework configs.
+The log name seperater.
 """
-CONFIG_ROOT_PATH = "./conf/"
+LOG_NAME_SEP = '.'
 
 """
-The log name seperater.
+Section name for suite level configuration
 """
-LOG_NAME_SEP = '.'
+SUITE_SECTION_NAME = "suite"
 
 """
 DTS global environment variable
@@ -209,6 +209,8 @@ DEBUG_SETTING = "DTS_DEBUG_ENABLE"
 DEBUG_CASE_SETTING = "DTS_DEBUGCASE_ENABLE"
 DPDK_RXMODE_SETTING = "DTS_DPDK_RXMODE"
 DTS_ERROR_ENV = "DTS_RUNNING_ERROR"
+DTS_CFG_FOLDER = "DTS_CFG_FOLDER"
+
 
 """
 DTS global error table
@@ -335,3 +337,12 @@ def accepted_nic(pci_id):
             return True
 
     return False
+
+"""
+The root path of framework configs.
+"""
+dts_cfg_folder = load_global_setting(DTS_CFG_FOLDER)
+if dts_cfg_folder != '':
+    CONFIG_ROOT_PATH = dts_cfg_folder
+else:
+    CONFIG_ROOT_PATH = "./conf"
-- 
1.9.3



More information about the dts mailing list