Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 35f6abd

Browse files
committedDec 3, 2024··
Test SUSE KMP building with the kernel-module devel
1 parent 7fae3a3 commit 35f6abd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎tests/test_kernel_module.py

+28
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ def create_kernel_test(containerfile: str) -> ParameterSet:
4848
)
4949

5050

51+
# the commit hash and the download link for the sources need to be updated together
52+
# there is no significance to the chosen hash, it is simple the tip of tree with the
53+
# corresponding sources to fetch.
54+
KMP_CONTAINER = create_kernel_test(
55+
r"""WORKDIR /src
56+
RUN set -euxo pipefail; \
57+
curl -sf https://src.opensuse.org/pool/vhba-kmp/archive/f7b947967abfd854991eed3a50a333f2efa4c47932e3d7d2fc1d07c6afdb79bd.tar.gz | tar -xzf - ; \
58+
cp -a vhba-kmp/* /usr/src/packages/SOURCES; cd /usr/src/packages/SOURCES ; \
59+
curl -LO https://downloads.sf.net/cdemu/vhba-module-20240202.tar.xz ; \
60+
rpmbuild -bb vhba-kmp.spec ; \
61+
openssl req -new -x509 -newkey rsa:2048 -sha256 -keyout key.asc -out cert.der \
62+
-outform der -nodes -days 4745 -addext "extendedKeyUsage=codeSigning" \
63+
-subj "/CN=Donut Eat/" ; \
64+
modsign-repackage -c ./cert.der -k ./key.asc /usr/src/packages/RPMS/$(uname -m)/vhba-kmp-default-*.rpm ; \
65+
rpm -i --nodeps RPMS/$(uname -m)/vhba-kmp-default-*.rpm
66+
""",
67+
)
68+
69+
70+
@pytest.mark.parametrize("container", [KMP_CONTAINER], indirect=True)
71+
def test_kmp_builds(container: ContainerData) -> None:
72+
"""Test that we can build a SUSE Kernel Module Package with signed modules."""
73+
74+
assert "Donut Eat" in container.connection.check_output(
75+
"modinfo /lib/modules/*-default/updates/vhba.ko"
76+
)
77+
78+
5179
@pytest.mark.skipif(
5280
OS_VERSION in ("16.0",),
5381
reason="can't install additional packages yet on 16",

0 commit comments

Comments
 (0)
Please sign in to comment.