From a4eabe9fce0517aa8d77a5ab3456d6a0fea83ba4 Mon Sep 17 00:00:00 2001 From: Narasimhan V <16101053+narasimhan-v@users.noreply.github.com[D> Date: Mon, 28 Jul 2025 13:56:43 +0530 Subject: [PATCH] Move paths to env.conf to make it configurable Move paths like test config path, results path, and more to env.conf. This makes it configurable via env.conf rather than changing the script. Signed-off-by: Narasimhan V <16101053+narasimhan-v@users.noreply.github.com> --- avocado-setup.py | 14 +++++++------- config/wrapper/env.conf | 8 ++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/avocado-setup.py b/avocado-setup.py index e1b50e27..89b9bbb6 100644 --- a/avocado-setup.py +++ b/avocado-setup.py @@ -31,17 +31,11 @@ AVOCADO_CONFIG_DIR = "%s/.config/avocado" % os.environ['HOME'] BASE_PATH = os.path.dirname(os.path.abspath(__file__)) CONFIG_PATH = "%s/config/wrapper/env.conf" % BASE_PATH -prescript = "%s/config/prescript" % BASE_PATH -postscript = "%s/config/postscript" % BASE_PATH -NORUNTEST_PATH = "%s/config/wrapper/no_run_tests.conf" % BASE_PATH -TEST_CONF_PATH = "%s/config/tests/" % BASE_PATH CONFIGFILE = configparser.ConfigParser() +NORUNTEST_PATH = "%s/config/wrapper/no_run_tests.conf" % BASE_PATH NORUNTESTFILE = configparser.ConfigParser() INPUTFILE = configparser.ConfigParser() INPUTFILE.optionxform = str -TEST_DIR = "%s/tests" % BASE_PATH -DATA_DIR = "%s/data" % BASE_PATH -LOG_DIR = "%s/results" % BASE_PATH logger = logger_init(filepath=BASE_PATH).getlogger() args = None outputdir = '' @@ -699,6 +693,12 @@ def parse_test_config(test_config_file, avocado_bin, enable_kvm): logger.error(f"No Run Config Path: {args.NORUNTEST_PATH} not defined") sys.exit(1) + globals() ['TEST_CONF_PATH'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'test_cfg_dir'))) + globals() ['LOG_DIR'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'results_dir'))) + globals() ['TEST_DIR'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'test_dir'))) + globals() ['DATA_DIR'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'data_dir'))) + globals() ['prescript'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'pre_script_dir'))) + globals() ['postscript'] = os.path.join(BASE_PATH, eval(CONFIGFILE.get('paths', 'post_script_dir'))) globals() ['BASE_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'base')) globals() ['KVM_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'kvm')) globals() ['OPTIONAL_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'optional')) diff --git a/config/wrapper/env.conf b/config/wrapper/env.conf index 2d3067fc..12e10d55 100644 --- a/config/wrapper/env.conf +++ b/config/wrapper/env.conf @@ -1,3 +1,11 @@ +[paths] +test_cfg_dir = 'config/tests/' +test_dir = 'tests' +data_dir = 'data' +results_dir = 'results' +pre_script_dir = 'config/prescript' +post_script_dir = 'config/postscript' + [framework] # Usage examples: # (avocado-framework, '') -- Installs latest released version