path: root/src/osmo_gsm_tester/
diff options
authorNeels Hofmeyr <>2017-05-04 16:39:29 +0200
committerNeels Hofmeyr <>2017-05-04 20:56:48 +0000
commitef9ed2d3eb1544bd5e6270e0fbf67814d268c468 (patch)
treee2bfa4342faf8b128db3c300143221e578a05319 /src/osmo_gsm_tester/
parent107f2751a702e322cfe08429b6e7f3465791cdbe (diff)
config: resolve real paths from symlinks, add paths debug logging
Tweak test expectations to include the new debug logging. Go through the paths in alphabetical order to get deterministic logging output, so the test expectations always match. Change-Id: I11a905b2467cda691d9ccea30ae436bac96476c9
Diffstat (limited to 'src/osmo_gsm_tester/')
1 files changed, 13 insertions, 5 deletions
diff --git a/src/osmo_gsm_tester/ b/src/osmo_gsm_tester/
index 4abdebb..4c24501 100644
--- a/src/osmo_gsm_tester/
+++ b/src/osmo_gsm_tester/
@@ -88,9 +88,11 @@ def _get_config_file(basename, fail_if_missing=True):
for l in locations:
- p = os.path.join(l, basename)
+ real_l = os.path.realpath(l)
+ p = os.path.realpath(os.path.join(real_l, basename))
if os.path.isfile(p):
- return (p, l)
+ log.dbg(None, log.C_CNF, 'Found config file', basename, 'as', p, 'in', l, 'which is', real_l)
+ return (p, real_l)
if not fail_if_missing:
return None, None
raise RuntimeError('configuration file not found: %r in %r' % (basename,
@@ -115,20 +117,26 @@ def get_configured_path(label, allow_unset=False):
env_name = ENV_PREFIX + label.upper()
env_path = os.getenv(env_name)
if env_path:
- return env_path
+ real_env_path = os.path.realpath(env_path)
+ log.dbg(None, log.C_CNF, 'Found path', label, 'as', env_path, 'in', '$' + env_name, 'which is', real_env_path)
+ return real_env_path
if PATHS is None:
paths_file, found_in = _get_config_file(PATHS_CONF)
PATHS = read(paths_file, PATHS_SCHEMA)
- for key, path in PATHS.items():
+ # sorted for deterministic regression test results
+ for key, path in sorted(PATHS.items()):
if not path.startswith(os.pathsep):
- PATHS[key] = os.path.join(found_in, path)
+ PATHS[key] = os.path.realpath(os.path.join(found_in, path))
+ log.dbg(None, log.C_CNF, paths_file + ': relative path', path, 'is', PATHS[key])
p = PATHS.get(label)
if p is None and not allow_unset:
raise RuntimeError('missing configuration in %s: %r' % (PATHS_CONF, label))
+ log.dbg(None, log.C_CNF, 'Found path', label, 'as', p)
if p.startswith(PATHS_TEMPDIR_STR):
p = os.path.join(get_tempdir(), p[len(PATHS_TEMPDIR_STR):])
+ log.dbg(None, log.C_CNF, 'Path', label, 'contained', PATHS_TEMPDIR_STR, 'and becomes', p)
return p
def get_state_dir():