Change in osmo-gsm-tester[master]: config: Allow setting trial directory in main.conf

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue May 12 14:38:35 UTC 2020


pespin has submitted this change. ( 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 selftest/resource_test/resource_test.ok
M selftest/scenario_test/scenario_test.ok
M selftest/suite_test/suite_test.ok
M src/osmo-gsm-tester.py
M src/osmo_gsm_tester/core/config.py
6 files changed, 23 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



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/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 @@
  '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 @@
  '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 @@
  '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 @@
             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: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200512/734e3012/attachment.htm>


More information about the gerrit-log mailing list