mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
The SampleGoogleTestGenerateException GoogleTest sample previously generated a CPU exception by performing an integer divide by zero. That mechanism is X86-specific: the AArch64 architecture defines SDIV/UDIV by zero to return zero rather than raising a synchronous abort, so the sample produced no exception when built and run on AArch64 hosts and the test failed due to the test assert instead of triggering an exception through the framework. This change replaces the divide-by-zero with a NULL pointer write performed through a small volatile helper, which is expected to work on all host systems. The MSVC '/wd4723' build option is no longer needed because it was added to silence the divide-by-zero compile-time warning. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
39 lines
1.1 KiB
INI
39 lines
1.1 KiB
INI
## @file
|
|
# This is a sample to demonstrates the use of GoogleTest that supports host
|
|
# execution environments for test case that generates an exception. For some
|
|
# host-based environments, this is a fatal condition that terminates the unit
|
|
# tests and no additional test cases are executed. On other environments, this
|
|
# condition may be report a unit test failure and continue with additional unit
|
|
# tests.
|
|
#
|
|
# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = SampleGoogleTestHostGenerateException
|
|
FILE_GUID = 037A3C56-44C5-4899-AC4D-911943E6FBA1
|
|
MODULE_TYPE = HOST_APPLICATION
|
|
VERSION_STRING = 1.0
|
|
|
|
#
|
|
# The following information is for reference only and not required by the build tools.
|
|
#
|
|
# VALID_ARCHITECTURES = IA32 X64 AARCH64
|
|
#
|
|
|
|
[Sources]
|
|
SampleGoogleTestGenerateException.cpp
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
|
|
|
|
[LibraryClasses]
|
|
GoogleTestLib
|
|
BaseLib
|
|
DebugLib
|
|
|
|
[Pcd]
|
|
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask
|