Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

 

 

- Bret

 


From: Michael D Kinney <michael.d.kinney@intel.com>
Sent: Friday, July 10, 2020 7:08:55 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Sean Brogan <sean.brogan@microsoft.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: [EXTERNAL] [Patch v3 07/16] UnitTestFrameworkPkg: Enable source level debug for host tests
 
REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2804&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cd31f0dcf6e6d4f80bd3008d8253f689e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637300301550028840&amp;sdata=oNgc2S2JjPYyf0Hh%2FjS7EqunqyH4%2BB7nfWWZBDDGWIE%3D&amp;reserved=0

Optionally enable a feature to support source level debug of a
host based unit test.  By default, this feature is disabled.
Exceptions are caught by the unit test framework and are
interpreted as a test failure.

When a unit test is under development, bugs may generate
exceptions or a unit test developer may want to trace the
execution of unit tests to debug some unexpected behavior.
Defining UNIT_TESTING_DEBUG in the DSC file or from the build
command line allows exceptions to be caught by the host OS
and allows the developer to debug their unit test under
development or debug the Unit Test Framework itself.

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>
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
index c22085fae1..c4e6e0e0a6 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
@@ -20,6 +20,11 @@ [LibraryClasses.common.HOST_APPLICATION]
 
 [BuildOptions]
   GCC:*_*_*_CC_FLAGS = -fno-pie
+!ifdef $(UNIT_TESTING_DEBUG)
+  MSFT:*_*_*_CC_FLAGS  = -D UNIT_TESTING_DEBUG=1
+  GCC:*_*_*_CC_FLAGS   = -D UNIT_TESTING_DEBUG=1
+  XCODE:*_*_*_CC_FLAGS = -D UNIT_TESTING_DEBUG=1
+!endif
 
 [BuildOptions.common.EDKII.HOST_APPLICATION]
   #
--
2.21.0.windows.1