diff options
| author | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-30 08:54:59 +0100 |
|---|---|---|
| committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-30 08:54:59 +0100 |
| commit | e2801701c9256d3868df072ddf60d4c82c78dc17 (patch) | |
| tree | f9c7c3b41a2d7d5866bd449ae442ca3427b685c5 /tests/test_nvpcr.py | |
| parent | 2772673455da499cb852d9cf921e49621a0ed6a4 (diff) | |
| download | dotfiles-e2801701c9256d3868df072ddf60d4c82c78dc17.tar.gz dotfiles-e2801701c9256d3868df072ddf60d4c82c78dc17.tar.bz2 dotfiles-e2801701c9256d3868df072ddf60d4c82c78dc17.zip | |
Check NvPCR services in staged UKIs
Diffstat (limited to 'tests/test_nvpcr.py')
| -rw-r--r-- | tests/test_nvpcr.py | 15 |
1 files changed, 15 insertions, 0 deletions
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") |
