[PATCH] D148443: [compiler-rt] [test] [asan] Mark the static tests unsupported on mingw
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 15 15:13:43 PDT 2023
mstorsjo created this revision.
mstorsjo added reviewers: vitalybuka, alvinhochun.
Herald added subscribers: Enna1, delcypher, dberris.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added a subscriber: Sanitizers.
It turns out that googletest unit tests don't react to the
config.unsupported flag so far, so we need to change the framework
for that. (Such a change should be split out to a separate commit,
but I'm including it here for now, for complete overview of this
change.)
The symbol referenced in the non-dynamic case for i386,
`_except_handler4`, isn't available in mingw configurations (where
we only ever link the dynamic CRT); for ASAN_DYNAMIC, the symbol is
redirected to `_except_handler4_common` which does exist.
When the static asan testsuites are marked as unsupported (but
available), building `check-compiler-rt` or `check-asan` ends up
trying to link the unit tests for the static ccase even if they're
not going to be executed; therefore, this practically irrelevant
case still needs to be compileable and linkable.
This is an alternative to D148319 <https://reviews.llvm.org/D148319>, and depends on D148442 <https://reviews.llvm.org/D148442>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148443
Files:
compiler-rt/lib/asan/asan_win.cpp
compiler-rt/test/asan/Unit/lit.site.cfg.py.in
compiler-rt/test/asan/lit.cfg.py
llvm/utils/lit/lit/formats/googletest.py
Index: llvm/utils/lit/lit/formats/googletest.py
===================================================================
--- llvm/utils/lit/lit/formats/googletest.py
+++ llvm/utils/lit/lit/formats/googletest.py
@@ -28,6 +28,9 @@
self.run_under = run_under
def get_num_tests(self, path, litConfig, localConfig):
+ if localConfig.unsupported:
+ return 0
+
list_test_cmd = self.prepareCmd(
[path, '--gtest_list_tests', '--gtest_filter=-*DISABLED_*'])
try:
@@ -132,6 +135,9 @@
if litConfig.noExecute:
return lit.Test.PASS, ''
+ if test.config.unsupported:
+ return lit.Test.UNSUPPORTED, ''
+
def get_shard_header(shard_env):
shard_envs = ' '.join([k + '=' + v for k, v in shard_env.items()])
return f"Script(shard):\n--\n%s %s\n--\n" % (shard_envs, ' '.join(cmd))
Index: compiler-rt/test/asan/lit.cfg.py
===================================================================
--- compiler-rt/test/asan/lit.cfg.py
+++ compiler-rt/test/asan/lit.cfg.py
@@ -244,6 +244,9 @@
if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'SunOS', 'Windows', 'NetBSD']:
config.unsupported = True
+if config.host_os == 'Windows' and not config.asan_dynamic and not target_is_msvc:
+ config.unsupported = True
+
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
Index: compiler-rt/test/asan/Unit/lit.site.cfg.py.in
===================================================================
--- compiler-rt/test/asan/Unit/lit.site.cfg.py.in
+++ compiler-rt/test/asan/Unit/lit.site.cfg.py.in
@@ -48,6 +48,10 @@
config.test_source_root = config.test_exec_root
+target_is_msvc = bool(re.match(r'.*-windows-msvc$', config.target_triple))
+if config.host_os == 'Windows' and not @ASAN_TEST_DYNAMIC@ and not target_is_msvc:
+ config.unsupported = True
+
# When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on, the initial value of
# config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
# host triple as the trailing path component. The value is incorrect for i386
Index: compiler-rt/lib/asan/asan_win.cpp
===================================================================
--- compiler-rt/lib/asan/asan_win.cpp
+++ compiler-rt/lib/asan/asan_win.cpp
@@ -173,7 +173,9 @@
ASAN_INTERCEPT_FUNC(__C_specific_handler);
#else
ASAN_INTERCEPT_FUNC(_except_handler3);
+#if ASAN_DYNAMIC || !defined(__MINGW32__)
ASAN_INTERCEPT_FUNC(_except_handler4);
+#endif
#endif
// Try to intercept kernel32!RaiseException, and if that fails, intercept
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148443.513943.patch
Type: text/x-patch
Size: 2605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230415/2643def9/attachment.bin>
More information about the llvm-commits
mailing list