@@ -85,6 +85,7 @@ type testRunChecksContextRunParams struct {
8585 expectedPcrAlg tpm2.HashAlgorithmId
8686 expectedUsedSecureBootCAs []* X509CertificateID
8787 expectedFlags CheckResultFlags
88+ expectedAcceptedErrors map [ErrorKind ]json.RawMessage
8889 expectedWarningsMatch string
8990}
9091
@@ -202,6 +203,11 @@ func (s *runChecksContextSuite) testRun(c *C, params *testRunChecksContextRunPar
202203 c .Check (ca , DeepEquals , params .expectedUsedSecureBootCAs [i ])
203204 }
204205 c .Check (result .Flags , Equals , params .expectedFlags )
206+ expectedAcceptedErrors := params .expectedAcceptedErrors
207+ if expectedAcceptedErrors == nil {
208+ expectedAcceptedErrors = make (map [ErrorKind ]json.RawMessage )
209+ }
210+ c .Check (result .AcceptedErrors , DeepEquals , expectedAcceptedErrors )
205211 c .Check (result .Warnings , ErrorMatches , params .expectedWarningsMatch )
206212
207213 c .Check (ctx .Result (), DeepEquals , result )
@@ -579,6 +585,9 @@ C7E003CB
579585 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
580586 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
581587 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
588+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
589+ ErrorKindEmptyPCRBanks : nil ,
590+ },
582591 expectedWarningsMatch : `3 errors detected:
583592- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
584593- error with drivers and apps config \(PCR3\) measurements: generating profiles for PCR 3 is not supported yet
@@ -743,6 +752,10 @@ C7E003CB
743752 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
744753 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
745754 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport | InsufficientDMAProtectionDetected ,
755+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
756+ ErrorKindInsufficientDMAProtection : nil ,
757+ ErrorKindNoKernelIOMMU : nil ,
758+ },
746759 expectedWarningsMatch : `3 errors detected:
747760- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
748761- error with drivers and apps config \(PCR3\) measurements: generating profiles for PCR 3 is not supported yet
@@ -1097,6 +1110,9 @@ C7E003CB
10971110 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
10981111 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
10991112 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
1113+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
1114+ ErrorKindRunningInVM : nil ,
1115+ },
11001116 expectedWarningsMatch : `4 errors detected:
11011117- virtual machine environment detected
11021118- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
@@ -1686,6 +1702,9 @@ C7E003CB
16861702 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
16871703 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
16881704 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
1705+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
1706+ ErrorKindAddonDriversPresent : nil ,
1707+ },
16891708 expectedWarningsMatch : `4 errors detected:
16901709- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
16911710- addon drivers were detected:
@@ -1920,6 +1939,9 @@ C7E003CB
19201939 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
19211940 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
19221941 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
1942+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
1943+ ErrorKindSysPrepApplicationsPresent : nil ,
1944+ },
19231945 expectedWarningsMatch : `4 errors detected:
19241946- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
19251947- error with drivers and apps config \(PCR3\) measurements: generating profiles for PCR 3 is not supported yet
@@ -2087,6 +2109,9 @@ C7E003CB
20872109 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
20882110 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
20892111 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
2112+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
2113+ ErrorKindAbsolutePresent : nil ,
2114+ },
20902115 expectedWarningsMatch : `4 errors detected:
20912116- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
20922117- error with drivers and apps config \(PCR3\) measurements: generating profiles for PCR 3 is not supported yet
@@ -2378,6 +2403,10 @@ C7E003CB
23782403 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
23792404 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
23802405 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
2406+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
2407+ ErrorKindAddonDriversPresent : nil ,
2408+ ErrorKindPreOSDigestVerificationDetected : nil ,
2409+ },
23812410 expectedWarningsMatch : `5 errors detected:
23822411- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
23832412- addon drivers were detected:
@@ -2600,6 +2629,11 @@ C7E003CB
26002629 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
26012630 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
26022631 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
2632+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
2633+ ErrorKindAddonDriversPresent : nil ,
2634+ ErrorKindWeakSecureBootAlgorithmsDetected : nil ,
2635+ ErrorKindPreOSDigestVerificationDetected : nil ,
2636+ },
26032637 expectedWarningsMatch : `6 errors detected:
26042638- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
26052639- addon drivers were detected:
@@ -2768,6 +2802,11 @@ C7E003CB
27682802 expectedPcrAlg : tpm2 .HashAlgorithmSHA256 ,
27692803 expectedUsedSecureBootCAs : []* X509CertificateID {NewX509CertificateID (testutil .ParseCertificate (c , msUefiCACert ))},
27702804 expectedFlags : NoPlatformConfigProfileSupport | NoDriversAndAppsConfigProfileSupport | NoBootManagerConfigProfileSupport ,
2805+ expectedAcceptedErrors : map [ErrorKind ]json.RawMessage {
2806+ ErrorKindAddonDriversPresent : nil ,
2807+ ErrorKindWeakSecureBootAlgorithmsDetected : nil ,
2808+ ErrorKindPreOSDigestVerificationDetected : nil ,
2809+ },
27712810 expectedWarningsMatch : `6 errors detected:
27722811- error with platform config \(PCR1\) measurements: generating profiles for PCR 1 is not supported yet
27732812- addon drivers were detected:
0 commit comments