From e2801701c9256d3868df072ddf60d4c82c78dc17 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 30 Sep 2026 08:54:59 +0100 Subject: Check NvPCR services in staged UKIs --- tests/test_nvpcr.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/test_nvpcr.py b/tests/test_nvpcr.py index f5765e4..5f36bb7 100644 --- a/tests/test_nvpcr.py +++ b/tests/test_nvpcr.py @@ -83,6 +83,21 @@ def sections(public_key, *, policies=None, options=None): class NvPCRImageTests(unittest.TestCase): + def test_initrd_has_required_units(self): + listing = "\n".join( + f"usr/lib/systemd/system/{unit}" for unit in tpm_nvpcr.INITRD_UNITS + ) + tpm_nvpcr.check_initrd_listing(listing) + + def test_rejects_missing_initrd_service(self): + listing = "\n".join( + f"usr/lib/systemd/system/{unit}" + for unit in tpm_nvpcr.INITRD_UNITS + if unit != "systemd-pcrnvdone.service" + ) + with self.assertRaisesRegex(ValueError, "systemd-pcrnvdone.service"): + tpm_nvpcr.check_initrd_listing(listing) + def test_valid_initrd_signature_and_root_options(self): tpm_nvpcr.check_sections(sections(b"public key"), b"public key") -- cgit v1.3.1