osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40309?usp=email )
Change subject: testenv: cfg: check for multiple spaces in lists ......................................................................
testenv: cfg: check for multiple spaces in lists
Pau ran into an unexpected bug while having entries in copy= separated by multiple spaces ("copy=osmo-stp.cfg osmo-stp-m3ua.confmerge"):
[testenv][m3ua] + ['cp', '-a', 'osmo-stp.cfg', '', 'osmo-stp-m3ua.confmerge', '/tmp/testenv-stp-m3ua-20250516-1349-e4103924-bfvi_syt/stp'] cp: cannot stat '': No such file or directory
Catch this early and print a more useful error:
[testenv] /home/user/code/osmo-dev/src/osmo-ttcn3-hacks/stp/testenv.cfg: copy= in section [stp] has multiple spaces: [testenv] "osmo-stp.cfg osmo-stp-m3ua.confmerge" [testenv] Please separate elements with only one space.
Change-Id: Ie47cf5482ba479457a662759ce87611a7c41e29c --- M _testenv/testenv/testenv_cfg.py 1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/09/40309/1
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py index 70d64c8..1ff662f 100644 --- a/_testenv/testenv/testenv_cfg.py +++ b/_testenv/testenv/testenv_cfg.py @@ -133,6 +133,10 @@ "packages": "package", "programs": "program", } + keys_lists = [ + "copy", + "package", + ]
if "testsuite" not in cfg: logging.error(f"{path}: missing [testsuite] section") @@ -173,6 +177,13 @@ logging.error("If this is on purpose, set make=no.") exit_error_readme()
+ for key in keys_lists: + if key in cfg[section] and " " in cfg[section][key]: + logging.error(f"{path}: {key}= in section [{section}] has multiple spaces:") + logging.error(f' "{cfg[section][key]}"') + logging.error("Please separate elements with only one space.") + sys.exit(1) + get_vty_host_port(cfg, path)