osmith submitted this change.
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(-)
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)
To view, visit change 40309. To unsubscribe, or for help writing mail filters, visit settings.