[compiler-rt] 6510163 - [compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 12:54:12 PDT 2023


Author: Martin Storsjö
Date: 2023-04-22T22:53:45+03:00
New Revision: 6510163242b66b4e8652c1976957bfec99361949

URL: https://github.com/llvm/llvm-project/commit/6510163242b66b4e8652c1976957bfec99361949
DIFF: https://github.com/llvm/llvm-project/commit/6510163242b66b4e8652c1976957bfec99361949.diff

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

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.

Differential Revision: https://reviews.llvm.org/D148319

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt
index 3c4d2cf45a39..70c282a621c3 100644
--- a/compiler-rt/test/asan/CMakeLists.txt
+++ b/compiler-rt/test/asan/CMakeLists.txt
@@ -55,11 +55,15 @@ foreach(arch ${ASAN_TEST_ARCH})
   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 @@ if(COMPILER_RT_INCLUDE_TESTS)
     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 @@ if(COMPILER_RT_INCLUDE_TESTS)
     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})


        


More information about the llvm-commits mailing list