osmith has uploaded this change for review.
testenv: move podman_extra to testsrcdir.cfg
Move podman_extra to testsrcdir.cfg, as it also needs to be set for the
whole source directory at once.
We actually didn't have a function that ensures it is the same in all
testenv.cfg files, which could lead to subtle bugs such as setting it in
only one of two testenv_*.cfg files in a source directory and then
having testenv pick the file where it is not set and therefore not using
the option when starting the podman container that is used for all
testsuites. This problem is resolved with this patch.
Change-Id: I12e187726673e1ca1b1ecfff6b34b1803127be86
---
M _testenv/README.md
M _testenv/testenv/podman.py
M _testenv/testenv/testenv_cfg.py
M _testenv/testenv/testsrcdir_cfg.py
4 files changed, 8 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/16/42816/1
diff --git a/_testenv/README.md b/_testenv/README.md
index 710c021..09acb05 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -84,11 +84,6 @@
depending on when the script runs. The script will not run on crash if podman
is used, as the container gets shutdown beforehand.
-* `podman_extra=`: optional value that can be set to add extra parameters to
- podman. For example, it can be used to mount an additional volume to pass-
- through USB devices. Use spaces to separate parameters, use quotes to include
- spaces into parameters.
-
#### Component section
* `program=`: executable for starting a test component, may contain arguments.
@@ -187,6 +182,11 @@
running any of the testsuites in this directory. See the eclipse-titan
versions section below for details.
+* `podman_extra=`: optional value that can be set to add extra parameters to
+ podman. For example, it can be used to mount an additional volume to pass-
+ through USB devices. Use spaces to separate parameters, use quotes to include
+ spaces into parameters.
+
## Environment variables
### Environment variables read by testenv
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 072b20e..fdba2b3 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -267,7 +267,7 @@
dest = os.readlink(testenv.custom_kernel_path)
cmd += ["--volume", f"{dest}:{dest}:ro"]
- podman_extra = testenv.testenv_cfg.get_podman_extra_first_cfg()
+ podman_extra = testenv.testsrcdir_cfg.cfg["podman_extra"]
if podman_extra:
cmd += shlex.split(podman_extra)
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 3146ae1..e64a7c9 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -74,11 +74,6 @@
return host, port
-def get_podman_extra_first_cfg():
- _, cfg = next(iter(cfgs.items()))
- return cfg["testsuite"].get("podman_extra", None)
-
-
def verify_qemu_cfgs():
"""Check if passed -C or -K args make sense with the testenv configs."""
testsuite = testenv.args.testsuite
@@ -125,7 +120,6 @@
"copy",
"prepare",
"program",
- "podman_extra",
]
keys_valid_component = [
"clean",
@@ -150,6 +144,7 @@
]
keys_moved_to_testsrcdir_cfg = [
"max_jobs_per_gb_ram",
+ "podman_extra",
"titan_min",
]
diff --git a/_testenv/testenv/testsrcdir_cfg.py b/_testenv/testenv/testsrcdir_cfg.py
index d72317f..2b344fe 100644
--- a/_testenv/testenv/testsrcdir_cfg.py
+++ b/_testenv/testenv/testsrcdir_cfg.py
@@ -11,6 +11,7 @@
cfg = {
"max_jobs_per_gb_ram": None,
+ "podman_extra": None,
"titan_min": "11.1.0",
}
To view, visit change 42816. To unsubscribe, or for help writing mail filters, visit settings.