From 94fd251ccc50597087a60203d77ef2fc8b37ad8a Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Wed, 4 Oct 2023 18:03:47 +0200 Subject: [PATCH] scripts/test-kernel-security.py: support zstd compressed modules BugLink: https://bugs.launchpad.net/bugs/2038437 New mantic kernels now have zstd compressed modules, that means modules files are not named *.ko anymore, but *.ko.zst instead. Make sure to support both formats when running the test. Signed-off-by: Andrea Righi --- scripts/test-kernel-security.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/test-kernel-security.py b/scripts/test-kernel-security.py index 1dc16df3..d3e0ccc6 100755 --- a/scripts/test-kernel-security.py +++ b/scripts/test-kernel-security.py @@ -236,7 +236,7 @@ class KernelSecurityBaseTest(testlib.TestlibCase): kernel_modules = [] for root, dirnames, filenames in os.walk(os.path.join('/lib/modules', self.kernel_version, 'kernel')): for filename in filenames: - if filename.endswith(".ko"): + if filename.endswith(".ko") or filename.endswith(".ko.zst"): kernel_modules.append(os.path.join(root, filename)) return kernel_modules @@ -754,6 +754,10 @@ class KernelSecurityTest(KernelSecurityBaseTest): if os.path.exists(m): module = m break + m = os.path.join('/lib/modules/%s/kernel/' % (self.kernel_version), m, '.zst') + if os.path.exists(m): + module = m + break if expected: self.assertTrue(module, 'Could not find a suitable kernel module to test') -- 2.40.1