[PATCH] D148319: [compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 03:29:20 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: vitalybuka, alvinhochun.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

Mingw only provides a dynamically linked CRT (contrary to
MSVC/clang-cl), so it is expected that the static asan test
configuration doesn't work.

Skip adding these test suites in mingw configurations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148319

Files:
  compiler-rt/test/asan/CMakeLists.txt


Index: compiler-rt/test/asan/CMakeLists.txt
===================================================================
--- compiler-rt/test/asan/CMakeLists.txt
+++ compiler-rt/test/asan/CMakeLists.txt
@@ -55,11 +55,15 @@
   endif()
   string(TOUPPER ${arch} ARCH_UPPER_CASE)
   set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
-  configure_lit_site_cfg(
-    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
-    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
-    )
-  list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+  if(NOT MINGW)
+    # MinGW environments don't provide a statically linked CRT, so only the
+    # dynamic asan test configuration can be expected to work.
+    configure_lit_site_cfg(
+      ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+      ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
+      )
+    list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+  endif()
 
   if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
     string(TOLOWER "-${arch}-${OS_NAME}-dynamic" ASAN_TEST_CONFIG_SUFFIX)
@@ -132,10 +136,14 @@
     set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
     set(CONFIG_NAME_DYNAMIC ${ARCH_UPPER_CASE}${OS_NAME}DynamicConfig)
 
-    set(ASAN_TEST_DYNAMIC False)
-    configure_lit_site_cfg(
-      ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
-      ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME}/lit.site.cfg.py)
+    if(NOT MINGW)
+      # MinGW environments don't provide a statically linked CRT, so only the
+      # dynamic asan test configuration can be expected to work.
+      set(ASAN_TEST_DYNAMIC False)
+      configure_lit_site_cfg(
+        ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
+        ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME}/lit.site.cfg.py)
+    endif()
     if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
       set(ASAN_TEST_DYNAMIC True)
       configure_lit_site_cfg(
@@ -144,8 +152,10 @@
     endif()
     # FIXME: support unit test in the android test runner
     if (NOT ANDROID)
-      list(APPEND ASAN_TEST_DEPS AsanUnitTests)
-      list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME})
+      if (NOT MINGW)
+        list(APPEND ASAN_TEST_DEPS AsanUnitTests)
+        list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME})
+      endif()
       if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
         list(APPEND ASAN_DYNAMIC_TEST_DEPS AsanDynamicUnitTests)
         list(APPEND ASAN_DYNAMIC_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME_DYNAMIC})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148319.513517.patch
Type: text/x-patch
Size: 2546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/7d5bf956/attachment.bin>


More information about the llvm-commits mailing list