various fixes from first test runs

Change-Id: Ifa5a780dc0123aa84273c57c726c8c1bea563495
This commit is contained in:
Your Name 2017-04-08 18:52:39 +02:00 committed by Neels Hofmeyr
parent d46ea13d48
commit 3c6673aa8c
5 changed files with 31 additions and 13 deletions

View File

@ -115,6 +115,9 @@ if __name__ == '__main__':
if combination_strs:
print('Running default suites:\n ' + ('\n '.join(combination_strs)))
else:
print('No default suites configured (%r)' % config.DEFAULT_SUITES_CONF)
if not combination_strs:
raise RuntimeError('Need at least one suite:scenario or series to run')

View File

@ -51,7 +51,10 @@ class OsmoBtsTrx(log.Origin):
self.configure()
self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-bts-trx')))
self.env = { 'LD_LIBRARY_PATH': str(self.inst) }
lib = self.inst.child('lib')
if not os.path.isdir(lib):
raise RuntimeError('No lib/ in %r' % self.inst)
self.env = { 'LD_LIBRARY_PATH': lib }
self.launch_process(OsmoBtsTrx.BIN_TRX)
self.launch_process(OsmoBtsTrx.BIN_BTS_TRX, '-r', '1', '-c', os.path.abspath(self.config_file))

View File

@ -61,9 +61,9 @@ ENV_CONF = os.getenv(ENV_PREFIX + 'CONF')
DEFAULT_CONFIG_LOCATIONS = [
'.',
os.path.join(os.getenv('HOME'), '.config', 'osmo_gsm_tester'),
'/usr/local/etc/osmo_gsm_tester',
'/etc/osmo_gsm_tester'
os.path.join(os.getenv('HOME'), '.config', 'osmo-gsm-tester'),
'/usr/local/etc/osmo-gsm-tester',
'/etc/osmo-gsm-tester'
]
PATHS_CONF = 'paths.conf'
@ -81,7 +81,7 @@ PATHS_TEMPDIR_STR = '$TEMPDIR'
PATHS = None
def get_config_file(basename, fail_if_missing=True):
def _get_config_file(basename, fail_if_missing=True):
if ENV_CONF:
locations = [ ENV_CONF ]
else:
@ -90,17 +90,23 @@ def get_config_file(basename, fail_if_missing=True):
for l in locations:
p = os.path.join(l, basename)
if os.path.isfile(p):
return p
return (p, l)
if not fail_if_missing:
return None
return None, None
raise RuntimeError('configuration file not found: %r in %r' % (basename,
[os.path.abspath(p) for p in locations]))
def get_config_file(basename, fail_if_missing=True):
path, found_in = _get_config_file(basename, fail_if_missing)
return path
def read_config_file(basename, validation_schema=None, if_missing_return=False):
fail_if_missing = True
if if_missing_return is not False:
fail_if_missing = False
path = get_config_file(basename, fail_if_missing=fail_if_missing)
if path is None:
return if_missing_return
return read(path, validation_schema=validation_schema, if_missing_return=if_missing_return)
def get_configured_path(label, allow_unset=False):
@ -112,8 +118,11 @@ def get_configured_path(label, allow_unset=False):
return env_path
if PATHS is None:
paths_file = get_config_file(PATHS_CONF)
paths_file, found_in = _get_config_file(PATHS_CONF)
PATHS = read(paths_file, PATHS_SCHEMA)
for key, path in PATHS.items():
if not path.startswith(os.pathsep):
PATHS[key] = os.path.join(found_in, path)
p = PATHS.get(label)
if p is None and not allow_unset:
raise RuntimeError('missing configuration in %s: %r' % (PATHS_CONF, label))

View File

@ -43,11 +43,14 @@ class OsmoNitb(log.Origin):
self.log('Starting osmo-nitb')
self.run_dir = util.Dir(self.suite_run.trial.get_run_dir().new_dir(self.name()))
self.configure()
inst = util.Dir(self.suite_run.trial.get_inst('openbsc'))
binary = os.path.abspath(inst.child('bin', 'osmo-nitb'))
inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-nitb')))
binary = inst.child('bin', 'osmo-nitb')
if not os.path.isfile(binary):
raise RuntimeError('Binary missing: %r' % binary)
env = { 'LD_LIBRARY_PATH': os.path.abspath(str(inst)) }
lib = inst.child('lib')
if not os.path.isdir(lib):
raise RuntimeError('No lib/ in %r' % inst)
env = { 'LD_LIBRARY_PATH': lib }
self.dbg(run_dir=self.run_dir, binary=binary, env=env)
self.process = process.Process(self.name(), self.run_dir,
(binary, '-c',

View File

@ -50,7 +50,7 @@ class Trial(log.Origin):
def __init__(self, trial_dir):
self.path = trial_dir
self.set_name(self.path)
self.set_name(os.path.basename(self.path))
self.set_log_category(log.C_TST)
self.dir = util.Dir(self.path)
self.inst_dir = util.Dir(self.dir.child('inst'))
@ -133,7 +133,7 @@ class Trial(log.Origin):
def get_inst(self, bin_name):
bin_tar = self.has_bin_tar(bin_name)
if not bin_tar:
return None
raise RuntimeError('No such binary available: %r' % bin_name)
inst_dir = self.inst_dir.child(bin_name)
if os.path.isdir(inst_dir):