summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2024-12-03 19:39:56 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-01-21 05:02:38 +0000
commit139cbb266b4847d1b63a20c568a5df9b26f7489b (patch)
tree115466a5e859acf4c61245e24c2c6cc752db3616 /BaseTools
parente78fb8a366fcd39329f86ce5a095d88d9be8dcb6 (diff)
downloadedk2-139cbb266b4847d1b63a20c568a5df9b26f7489b.tar.gz
BaseTools/Plugin/HostBasedUnitTestRunner: Set ASAN env vars
The environment variable `GTEST_CATCH_EXCEPTION` must be set to `0` for so all exceptions are handled by the address sanitizer and not GoogleTest. This allows stack back trace and other details to be logged by the address sanitizer so the source of the issue identified address sanitizer can be determined. The environment variable `ASAN_OPTIONS` must be set to `detect_leaks=0` to disable memory leak detection. The unit test frameworks may have memory leaks and some firmware code under test use cases may perform a memory allocation without a matching memory free as their expected behavior. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index b7ed863203..c39dae236c 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -52,6 +52,12 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
failure_count = 0
+ # Do not catch exceptions in gtest so they are handled by address sanitizer
+ shell_env.set_shell_var('GTEST_CATCH_EXCEPTIONS', '0')
+
+ # Disable address sanitizer memory leak detection
+ shell_env.set_shell_var('ASAN_OPTIONS', 'detect_leaks=0')
+
# Set up the reporting type for Cmocka.
shell_env.set_shell_var('CMOCKA_MESSAGE_OUTPUT', 'xml')