osmith has submitted this change. ( 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(-)
Approvals: fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py index fc28d84..e517a02 100644 --- a/_testenv/testenv/testenv_cfg.py +++ b/_testenv/testenv/testenv_cfg.py @@ -139,6 +139,10 @@ "packages": "package", "programs": "program", } + keys_lists = [ + "copy", + "package", + ]
if "testsuite" not in cfg: logging.error(f"{path}: missing [testsuite] section") @@ -179,6 +183,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)