audk/MdePkg/Include/Library
Michael D Kinney 133891b712 MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2801

Add the UT_EXPECT_ASSERT_FAILURE(FunctionCall, Status) macro
to the UnitTestLib that can be used to check if a function
under test triggers an ASSERT() condition.  If an ASSERT()
condition is triggered, then the macro returns.  If the
ASSERT() condition is not triggered, then the current unit
test fails with a status of UNIT_TEST_ERROR_TEST_FAILED.

If ASSERT()s are disabled, then this check for ASSERT()
behavior is not possible, and the check is skipped.

The global variable gUnitTestExpectAssertFailureJumpBuffer
is added to the UnitTestLib to save/restore context when
the UT_EXPECT_ASSERT_FAILURE(FunctionCall, Status) macro
is used.  The UT_EXPECT_ASSERT_FAILURE() macro uses the
SetJump() service with this global variable.  The UnitTestLib
service UnitTestDebugAssert() uses the LongJump() service
with this global to restore context if an ASSERT() is
triggered by the code under test.

Add UnitTestExpectAssertFailure() to the UnitTestLib class.
The UnitTestExpectAssertFailure() is called from the new
UT_EXPECT_ASSERT_FAILURE() macro after the status of this
macro check is known.

Add UnitTestDebugAssert() to the UnitTestLib class.  The
UnitTestDebugAssert() service is the same as the DebugLib
DebugAssert() service and is invoked from the DebugLib
_ASSERT() macro if unit testing is enabled.  This allows the
Unit Test Framework to know when code under test triggers an
ASSERT() condition.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2020-07-15 05:25:21 +00:00
..
BaseLib.h MdePkg: Fix SafeString performing assertions on runtime checks 2020-05-22 00:03:14 +00:00
BaseMemoryLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
CacheMaintenanceLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
CpuLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
DebugLib.h MdePkg/Include: Hook DebugLib _ASSERT() for unit tests 2020-07-15 05:25:21 +00:00
DebugPrintErrorLevelLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
DevicePathLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
DxeCoreEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
DxeServicesLib.h MdePkg/Library/Dxe: Fix various typos 2020-02-10 22:30:07 +00:00
DxeServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
ExtractGuidedSectionLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
FileHandleLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
HobLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
HstiLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
IoLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
MemoryAllocationLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
MmServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
OrderedCollectionLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PcdLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PciCf8Lib.h MdePkg/Library/Pci: Fix various typos 2020-02-10 22:30:07 +00:00
PciExpressLib.h MdePkg/Library/Pci: Fix various typos 2020-02-10 22:30:07 +00:00
PciLib.h MdePkg/Library/Pci: Fix various typos 2020-02-10 22:30:07 +00:00
PciSegmentInfoLib.h MdePkg/PciSegmentInfoLib: Add missing EFIAPI to GetPciSegmentInfo() 2020-06-24 05:46:27 +00:00
PciSegmentLib.h MdePkg/Library/Pci: Fix various typos 2020-02-10 22:30:07 +00:00
PeCoffExtraActionLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeCoffGetEntryPointLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeCoffLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeiCoreEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeiServicesLib.h MdePkg/PeiServicesLib.h: Change comments of PeiServicesResetSystem2 2019-04-28 09:40:12 +08:00
PeiServicesTablePointerLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeimEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PerformanceLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PostCodeLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PrintLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
ReportStatusCodeLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
ResourcePublicationLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
RngLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3BootScriptLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3IoLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3PciLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3PciSegmentLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3SmbusLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3StallLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SafeIntLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SerialPortLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SmbusLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SmiHandlerProfileLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SmmIoLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SmmLib.h MdePkg/Library/Smm: Fix various typos 2020-02-10 22:30:07 +00:00
SmmMemLib.h MdePkg/Library/Smm: Fix various typos 2020-02-10 22:30:07 +00:00
SmmPeriodicSmiLib.h MdePkg/Library/Smm: Fix various typos 2020-02-10 22:30:07 +00:00
SmmServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
StandaloneMmDriverEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SynchronizationLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
TimerLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiApplicationEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiBootServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiDecompressLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiDriverEntryPoint.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiLib.h MdePkg: Update the comments of IsLanguageSupported 2019-11-20 15:03:24 +00:00
UefiRuntimeLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiRuntimeServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiScsiLib.h MdePkg: Implement SCSI commands for Security Protocol In/Out 2019-09-29 16:43:45 +08:00
UefiUsbLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UnitTestLib.h MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib 2020-07-15 05:25:21 +00:00