jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42666?usp=email )


Change subject: testenv: Allow adding extra parameters to podman
......................................................................

testenv: Allow adding extra parameters to podman

Allows to add additional command line parameters to podman, if defined
int the testsuite section of testenv.cfg:

[testsuite]
...
podman_extra=--volume /dev/bus/usb:/dev/bus/usb

Change-Id: I6a2be0d60efcd70ea2081e0314927885085bb5e0
---
M _testenv/README.md
M _testenv/testenv/podman.py
M _testenv/testenv/testenv_cfg.py
3 files changed, 15 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/66/42666/1

diff --git a/_testenv/README.md b/_testenv/README.md
index a973b25..f57ee0e 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -94,6 +94,11 @@
   testsuite to avoid consuming the whole RAM and freezing (or possibly getting
   killed from an out-of-memory daemon).

+* `podman_extra=`: optional value that can be set to add extra parameters to
+  podman. For example, it can be used to mount additional volume to pass-
+  through usb devices. Use spaces to seperate parameters, use quotes to include
+  spaces into patameters.
+
 #### Component section

 * `program=`: executable for starting a test component, may contain arguments.
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 79fc5b9..92dfeb4 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -266,6 +266,10 @@
             dest = os.readlink(testenv.custom_kernel_path)
             cmd += ["--volume", f"{dest}:{dest}:ro"]

+    podman_extra = testenv.testenv_cfg.get_podman_extra_first_cfg()
+    if podman_extra:
+        cmd += shlex.split(podman_extra)
+
     cmd += [
         "--volume",
         f"{testdir_topdir}:{testdir_topdir}",
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 9edc102..eb9e030 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -207,6 +207,11 @@
     return testenv.args.jobs


+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
@@ -255,6 +260,7 @@
         "program",
         "titan_min",
         "max_jobs_per_gb_ram",
+        "podman_extra",
     ]
     keys_valid_component = [
         "clean",

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42666?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I6a2be0d60efcd70ea2081e0314927885085bb5e0
Gerrit-Change-Number: 42666
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to