summaryrefslogtreecommitdiff
path: root/SecurityPkg/Library/SecureBootVariableLib/UnitTest
AgeCommit message (Collapse)AuthorFilesLines
2026-01-21SecurityPkg/Library/SecureBootVariableLib/UnitTest: Cmocka use issuesMichael D Kinney1-91/+91
Fix mocked versions of GetVariable() and SetVariable(). * VendorGuid parameter use expect_memory() not expect_value() * MockSetVariable() use check_expected() for Attributes parameter * MockSetVariable() use check_expected_ptr() for Data parameter * Calls to MockGetVariable() use (UINTN) cast for will_return() of pointer to data buffer returned. Issues found with Linux GCC NOOPT IA32 builds of unit tests. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-12-23SecurityPkg/Library/SecureBootVariableLib/UnitTest: Fix CLANGMichael D Kinney1-0/+2
Fix uninitialized variable error in unit tests detected by clang by zeroing local variable structure before use in unit test cases. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-04-17SecurityPkg: Update SecureBootVariableLibUnitTestDoug Flick1-50/+104
Updates SecureBootVariableLibUnitTest to use a valid EFI_SIGNATURE_LIST and EFI_SIGNATURE_DATA Signed-off-by: Doug Flick <dougflick@microsoft.com>
2023-04-10SecurityPkg: Update code to be more C11 compliant by using __func__Rebecca Cran1-2/+2
__FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout SecurityPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2023-04-10SecurityPkg/Library/SecureBootVariableLib: HOST_APPLICATION IA32/X64 onlyMichael D Kinney3-3/+3
Update SecureBootVariableLib host-based unit test INF file to only list VALID_ARCHITECTURES of IA32 and X64 to align with all other host-based unit test INF files. The UnitTestFrameworkPkg only provides build support of host-based unit tests to OS applications for IA32 and X64. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2023-04-10SecurityPkg/Library/SecureBootVariableLib: Fix VS20xx 4122 errorsMichael D Kinney1-87/+83
The unit test code for the SecureBootVariableLib is initializing local variable structures in their declaration from other local variables that are also initialized in their declaration. ANSI C does not allow this and error 4122 is generated on VS20xx compilers. The test cases are updated to initialize the local structure fields in C statements instead of their local variable declaration. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2023-04-10SecurityPkg: Add gmock exampleChris Johnson4-7/+7
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Chris Johnson <chris.n.johnson@intel.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-07-07SecurityPkg: SecureBootVariableLib: Added unit testskuqin8-0/+2426
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3911 This change added unit test and enabled it from pipeline for the updated SecureBootVariableLib. The unit test covers all implemented interfaces and certain corner cases. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Min Xu <min.m.xu@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>