aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-12 15:06:55 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-05-12 16:27:33 +0200
commite972c9c52412d3d436fd963f507ffc144e24ebe2 (patch)
tree9fd9b1dde01d99e851cfe01d68af22da2d2a3b25
parent656952760c1bc022a0caab1fd370740dd952a8d4 (diff)
config: Allow setting trial directory in main.conf
-rw-r--r--doc/manuals/chapters/config.adoc2
-rw-r--r--selftest/resource_test/resource_test.ok3
-rw-r--r--selftest/scenario_test/scenario_test.ok3
-rw-r--r--selftest/suite_test/suite_test.ok3
-rwxr-xr-xsrc/osmo-gsm-tester.py17
-rw-r--r--src/osmo_gsm_tester/core/config.py4
6 files changed, 23 insertions, 9 deletions
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 @@ then overrides the above locations.
- '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 @@ of the {app-name} process parsing it.
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/selftest/resource_test/resource_test.ok b/selftest/resource_test/resource_test.ok
index 8a0b52f..0ad760e 100644
--- a/selftest/resource_test/resource_test.ok
+++ b/selftest/resource_test/resource_test.ok
@@ -16,7 +16,8 @@ cnf -: DBG: MAIN CONFIG:
'resource_conf_path': '[PATH]/selftest/resource_test/conf/resources.conf',
'scenarios_dir': '[PATH]/selftest/resource_test/conf/scenarios',
'state_dir': '[PATH]/selftest/resource_test/conf/test_work/state_dir',
- 'suites_dir': '[PATH]/selftest/resource_test/conf/suite_test'}
+ 'suites_dir': '[PATH]/selftest/resource_test/conf/suite_test',
+ 'trial_dir': '[PATH]/selftest/resource_test/conf/trial'}
*** all resources:
{'arfcn': [{'_hash': 'e620569450f8259b3f0212ec19c285dd07df063c',
'arfcn': '512',
diff --git a/selftest/scenario_test/scenario_test.ok b/selftest/scenario_test/scenario_test.ok
index e37ef57..e845f4c 100644
--- a/selftest/scenario_test/scenario_test.ok
+++ b/selftest/scenario_test/scenario_test.ok
@@ -5,7 +5,8 @@ cnf -: DBG: MAIN CONFIG:
'resource_conf_path': '[PATH]/selftest/scenario_test/resources.conf',
'scenarios_dir': '[PATH]/selftest/scenario_test',
'state_dir': '[PATH]/selftest/scenario_test/test_work/state_dir',
- 'suites_dir': '[PATH]/selftest/scenario_test'}
+ 'suites_dir': '[PATH]/selftest/scenario_test',
+ 'trial_dir': '[PATH]/selftest/scenario_test/trial'}
scenario_case_01.conf
{'anotherlist': ['4', '0'],
'foobar': 'True',
diff --git a/selftest/suite_test/suite_test.ok b/selftest/suite_test/suite_test.ok
index fb26a06..d55317b 100644
--- a/selftest/suite_test/suite_test.ok
+++ b/selftest/suite_test/suite_test.ok
@@ -6,7 +6,8 @@ cnf -: DBG: MAIN CONFIG:
'resource_conf_path': '[PATH]/selftest/suite_test/resources.conf',
'scenarios_dir': '[PATH]/selftest/suite_test/scenarios',
'state_dir': '[PATH]/selftest/suite_test/test_work/state_dir',
- 'suites_dir': '[PATH]/selftest/suite_test'}
+ 'suites_dir': '[PATH]/selftest/suite_test',
+ 'trial_dir': '[PATH]/selftest/suite_test/trial'}
--- -: ERR: RuntimeError: Suite not found: 'does_not_exist' in [PATH]/selftest/suite_test
- no suite.conf
cnf empty_dir: DBG: reading suite.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 @@ def main():
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 @@ optional.''')
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 @@ optional.''')
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 @@ optional.''')
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 @@ override_conf = None
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 @@ MAIN_CONFIG_SCHEMA = {
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 @@ MAIN_CONFIG_SCHEMA = {
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 @@ def _get_main_config():
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,