osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40317?usp=email )
Change subject: testenv: support qemu=required in testenv.cfg
......................................................................
testenv: support qemu=required in testenv.cfg
Make it possible to set qemu=required in addition to the existing
possibility of qemu=optional in the testenv configs and verify that
either the debian kernel (from the podman container) or a custom kernel
gets used for such configs.
This is in preparation for adding a testenv config for osmo-epdg, which
uses kernel-gtp and unlike osmo-ggsn doesn't have userspace fallback
code. With testenv using the hosts gtp kernel device for this is not
supported (it would have several downsides anyway, such as not being in
control what exact kernel version is used leading to different test
outcomes for different users, not being easily able to compare different
kernel versions, having a harder time getting debug logs from the module
etc.).
Change-Id: If4abdf1f9248fee0915603a9b3c6e3e5e5083057
---
M _testenv/README.md
M _testenv/testenv/testenv_cfg.py
2 files changed, 21 insertions(+), 14 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
osmith: Looks good to me, approved
diff --git a/_testenv/README.md b/_testenv/README.md
index 66158c4..1b62d65 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -122,10 +122,11 @@
* `vty_host=`: optionally set the VTY host for the SUT component to be used
when obtaining a talloc report. If this is not set, `127.0.0.1` is used.
-* `qemu=`: set to `optional` to allow running this test component in QEMU.
- Additional logic must be added to build an initrd with the test component and
- actually run it in QEMU, this is done by sourcing `qemu_functions.sh` and
- using functions from there. See the `ggsn` testsuite for reference.
+* `qemu=`: set to `optional`/`required` to allow/require running this test
+ component in QEMU. Additional logic must be added to build an initrd with the
+ test component and actually run it in QEMU, this is done by sourcing
+ `qemu_functions.sh` and using functions from there. See the `ggsn` testsuite
+ for reference.
### Executables
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 70d64c8..fc28d84 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -76,31 +76,37 @@
def verify_qemu_cfgs():
- """Check if -C or -K is set, but any of the selected configs can't
run with
- QEMU."""
- if not testenv.args.kernel:
- return
+ """Check if passed -C or -K args make sense with the testenv
configs."""
+ testsuite = testenv.args.testsuite
+ qemu_supported = False
+ qemu_required = False
for basename, cfg in cfgs.items():
- missing = True
-
for section in cfg.keys():
if "qemu" in cfg[section]:
- missing = False
+ qemu_supported = True
+ if cfg[section]["qemu"] == "required":
+ qemu_required = True
break
- if missing:
- testsuite = testenv.args.testsuite
+ if testenv.args.kernel and not qemu_supported:
logging.critical(f"{testsuite}/{basename}: doesn't support running
in QEMU")
exit_error_readme()
+ if not testenv.args.kernel and qemu_required:
+ logging.error(f"{testsuite}/{basename}: {section} must run in
QEMU")
+ logging.error("Use one of:")
+ logging.error(" -D, --debian-kernel")
+ logging.error(" -C, --custom-kernel")
+ exit_error_readme()
+
def verify_qemu_section(path, cfg, section):
"""Verify that qemu= has proper values."""
if "qemu" not in cfg[section]:
return
- valid = ["optional"]
+ valid = ["optional", "required"]
value = cfg[section]["qemu"]
if value not in valid:
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40317?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If4abdf1f9248fee0915603a9b3c6e3e5e5083057
Gerrit-Change-Number: 40317
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>