From 6b73350f2168ce55a874f618c962fddc0dadfe22 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 30 Sep 2026 08:54:59 +0100 Subject: Show NvPCR check command errors --- tests/test_nvpcr.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/test_nvpcr.py') diff --git a/tests/test_nvpcr.py b/tests/test_nvpcr.py index 5f36bb7..02bafb1 100644 --- a/tests/test_nvpcr.py +++ b/tests/test_nvpcr.py @@ -83,6 +83,14 @@ def sections(public_key, *, policies=None, options=None): class NvPCRImageTests(unittest.TestCase): + def test_command_failure_reports_stderr(self): + error = subprocess.CalledProcessError(1, ["ukify"], stderr="file not found") + with ( + mock.patch.object(tpm_nvpcr.subprocess, "run", side_effect=error), + self.assertRaisesRegex(RuntimeError, "ukify exited 1: file not found"), + ): + tpm_nvpcr.run("ukify", "inspect", "missing.efi") + def test_initrd_has_required_units(self): listing = "\n".join( f"usr/lib/systemd/system/{unit}" for unit in tpm_nvpcr.INITRD_UNITS -- cgit v1.3.1