From 27020f33a1b218facfb2c740ebd37cb90cfad2c7 Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Fri, 26 Dec 2025 11:34:44 -0800 Subject: [PATCH] UnitTestFrameworkPkg: Add Windows host-based unit test define There are cases where DSC files must have logic to detect if host-based unit tests are being built in a Windows environment. Add HOST_BASED_UNIT_TESTING_ENABLED define set to TRUE if that condition is detected. One example is the optimized assembly files from Openssl project that generate NASM source files that assume Windows calling convention. Those NASM files must be used for both firmware builds where the default compiler calling convention is the Windows calling convention and host-based unit tests built using any of the compilers supported in Windows environment. Also update UnitTestFrameworkPkgHost.dsc.inc to set BUILD_TARGETS to NOOPT because host-based unit tests only support NOOPT. If the DSC file that includes UnitTestFrameworkPkgHost.dsc.inc uses a BUILD_TARGETS other than NOOPT, this will override the DSC setting. Signed-off-by: Michael D Kinney --- UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc index 0f931d9733..a56cb21925 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc @@ -9,6 +9,16 @@ !include UnitTestFrameworkPkg/UnitTestFrameworkPkgCommon.dsc.inc [Defines] + HOST_BASED_UNIT_TESTING_ENABLED = TRUE + + # + # Host based unit test builds only support NOOPT build target + # + BUILD_TARGETS = NOOPT + + # + # Always enable code coverage and address sanitizers + # UNIT_TESTING_CODE_COVERAGE_ENABLE = TRUE UNIT_TESTING_ADDRESS_SANITIZER_ENABLE = TRUE