UnitTestFrameworkPkg: Expand host-based exception handling and gcov

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4683

Update MSFT CC_FLAGS for host-based unit tests to use /EHs
instead of /EHsc to support building C functions with SEH
(Structured Exception Handling) enabled.  This is required to
build UnitTestDebugAssertLibHost.inf.

Update GCC CC_FLAGS for host-based unit tests to use -fexceptions
to support catching exceptions.

Update GoogleTestLib.h to include Throws() APIs that enable
unit tests to use EXPECT_THAT() to check for expected ASSERT()
conditions for a specific ASSERT() expression.

Update GCC CC_FLAGS to add --coverage for host-based builds
for all GCC tool chains.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael D Kinney
2024-02-02 17:28:31 -08:00
committed by mergify[bot]
parent 46c6de57b0
commit 81b69f306f
4 changed files with 29 additions and 6 deletions

View File

@@ -31,13 +31,14 @@
GCC:*_*_*_CC_FLAGS = -D UNIT_TESTING_DEBUG=1
XCODE:*_*_*_CC_FLAGS = -D UNIT_TESTING_DEBUG=1
!endif
GCC:*_GCC5_*_CC_FLAGS = --coverage
GCC:*_GCC5_*_DLINK_FLAGS = --coverage
GCC:*_*_*_CC_FLAGS = -fexceptions
GCC:*_*_*_CC_FLAGS = --coverage
GCC:*_*_*_DLINK_FLAGS = --coverage
[BuildOptions.common.EDKII.HOST_APPLICATION]
#
# MSFT
#
MSFT:*_*_*_CC_FLAGS = /EHsc
MSFT:*_*_*_CC_FLAGS = /EHs
MSFT:*_*_*_DLINK_FLAGS == /out:"$(BIN_DIR)\$(MODULE_NAME_GUID).exe" /pdb:"$(BIN_DIR)\$(MODULE_NAME_GUID).pdb" /IGNORE:4001 /NOLOGO /SUBSYSTEM:CONSOLE /DEBUG /STACK:0x40000,0x40000 /WHOLEARCHIVE
MSFT:*_*_IA32_DLINK_FLAGS = /MACHINE:I386
MSFT:*_*_X64_DLINK_FLAGS = /MACHINE:AMD64