pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18219 )
Change subject: config: Allow setting trial directory in main.conf ...................................................................... config: Allow setting trial directory in main.conf Change-Id: Ia4141001d084f690897dbdff5eae6c69ff2e521c --- M doc/manuals/chapters/config.adoc M src/osmo-gsm-tester.py M src/osmo_gsm_tester/core/config.py 3 files changed, 17 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/19/18219/1 diff --git a/doc/manuals/chapters/config.adoc b/doc/manuals/chapters/config.adoc index fec5c87..17cf825 100644 --- a/doc/manuals/chapters/config.adoc +++ b/doc/manuals/chapters/config.adoc @@ -27,6 +27,7 @@ - 'state_dir': Path to <<state_dir,state_dir>> directory - 'suites_dir': Path to <<suites_dir,suites_dir>> directory +- 'trial_dir': Path to <<trials,trial>> directory to test against (overridden by cmdline argument) - 'scenarios_dir': Path to <<scenarios_dir,scenarios_dir>> directory (optional) - 'default_suites_conf_path': Path to <<default_suites_conf,default-suites.conf>> file (optional) - 'defaults_conf_path': Path to <<defaults_conf,defaults.conf>> file (optional) @@ -46,6 +47,7 @@ state_dir: '/var/tmp/osmo-gsm-tester/state' suites_dir: '/usr/local/src/osmo-gsm-tester/suites' scenarios_dir: './scenarios' +trial_dir: './trial' default_suites_conf_path: './default-suites.conf' defaults_conf_path: './defaults.conf' resource_conf_path: './resources.conf' diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py index 204b1c7..cfe55f6 100755 --- a/src/osmo-gsm-tester.py +++ b/src/osmo-gsm-tester.py @@ -24,9 +24,9 @@ Examples: -./osmo-gsm-tester.py -c doc/examples/2g_osmocom/main.conf ~/my_trial_package/ -s osmo_trx -./osmo-gsm-tester.py -c doc/examples/2g_osmocom/main.conf ~/my_trial_package/ -s sms_tests:dyn_ts+eu_band+bts_sysmo -./osmo-gsm-tester.py -c sysmocom/main.conf ~/my_trial_package/ -s sms_tests/mo_mt_sms:bts_trx +./osmo-gsm-tester.py -c doc/examples/2g_osmocom/main.conf ~/my_trial_dir/ -s osmo_trx +./osmo-gsm-tester.py -c doc/examples/2g_osmocom/main.conf ~/my_trial_dir/ -s sms_tests:dyn_ts+eu_band+bts_sysmo +./osmo-gsm-tester.py -c sysmocom/main.conf ~/my_trial_dir/ -s sms_tests/mo_mt_sms:bts_trx (The names for test suites and scenarios used in these examples must be defined by the osmo-gsm-tester configuration.) @@ -104,7 +104,7 @@ help='Show version') parser.add_argument('-c', '--conf-path', dest='conf_path', help='''Specify main configuration file path''') - parser.add_argument('trial_package', + parser.add_argument('trial_dir', nargs='?', default=None, help='Directory containing binaries to test') parser.add_argument('-s', '--suite-scenario', dest='suite_scenario', action='append', help='''A suite-scenarios combination @@ -129,7 +129,7 @@ exit(0) print('combinations:', repr(args.suite_scenario)) - print('trial:', repr(args.trial_package)) + print('trial:', repr(args.trial_dir)) print('tests:', repr(args.test)) # create a default log to stdout @@ -144,6 +144,11 @@ if args.conf_path: config.override_conf = args.conf_path + if args.trial_dir is not None: + trial_dir = args.trial_dir + else: + trial_dir = config.get_main_config_value(config.CFG_TRIAL_DIR) + combination_strs = list(args.suite_scenario or []) if not combination_strs: @@ -187,7 +192,7 @@ test_names = sorted(set(test_names)) print(repr(test_names)) - with trial.Trial(args.trial_package) as current_trial: + with trial.Trial(trial_dir) as current_trial: current_trial.verify() for suite_scenario_str, suite_def, scenarios in suite_scenarios: current_trial.add_suite_run(suite_scenario_str, suite_def, scenarios) diff --git a/src/osmo_gsm_tester/core/config.py b/src/osmo_gsm_tester/core/config.py index ea16e33..9380cca 100644 --- a/src/osmo_gsm_tester/core/config.py +++ b/src/osmo_gsm_tester/core/config.py @@ -65,6 +65,7 @@ CFG_STATE_DIR = 'state_dir' CFG_SUITES_DIR = 'suites_dir' CFG_SCENARIOS_DIR = 'scenarios_dir' +CFG_TRIAL_DIR = 'trial_dir' CFG_DEFAULT_SUITES_CONF = 'default_suites_conf_path' CFG_DEFAULTS_CONF = 'defaults_conf_path' CFG_RESOURCES_CONF = 'resource_conf_path' @@ -72,6 +73,7 @@ CFG_STATE_DIR: schema.STR, CFG_SUITES_DIR: schema.STR, CFG_SCENARIOS_DIR: schema.STR, + CFG_TRIAL_DIR: schema.STR, CFG_DEFAULT_SUITES_CONF: schema.STR, CFG_DEFAULTS_CONF: schema.STR, CFG_RESOURCES_CONF: schema.STR, @@ -80,6 +82,7 @@ DF_CFG_STATE_DIR = '/var/tmp/osmo-gsm-tester/state/' DF_CFG_SUITES_DIR = './suites' DF_CFG_SCENARIOS_DIR = './scenarios' +DF_CFG_TRIAL_DIR = './trial' DF_CFG_DEFAULT_SUITES_CONF = './default-suites.conf' DF_CFG_DEFAULTS_CONF = './defaults.conf' DF_CFG_RESOURCES_CONF = './resources.conf' @@ -133,6 +136,7 @@ CFG_STATE_DIR: DF_CFG_STATE_DIR, CFG_SUITES_DIR: DF_CFG_SUITES_DIR, CFG_SCENARIOS_DIR: DF_CFG_SCENARIOS_DIR, + CFG_TRIAL_DIR: DF_CFG_TRIAL_DIR, CFG_DEFAULT_SUITES_CONF: DF_CFG_DEFAULT_SUITES_CONF, CFG_DEFAULTS_CONF: DF_CFG_DEFAULTS_CONF, CFG_RESOURCES_CONF: DF_CFG_RESOURCES_CONF, -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18219 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: Ia4141001d084f690897dbdff5eae6c69ff2e521c Gerrit-Change-Number: 18219 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-MessageType: newchange