[PATCH] D40768: [msan] LIT: Add lld testing config

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 2 06:17:20 PST 2017


lebedev.ri created this revision.
lebedev.ri added projects: Sanitizers, lld.
Herald added subscribers: mehdi_amini, mgorny.

A follow-up for https://reviews.llvm.org/D39508, with memory sanitizer changes.

For me, dtls_test.c fails even without LLD, but with LLD the failure is different,
so i figured i should mark it as `XFAIL`.

Question: the msan Unit tests, do they also need these LLD (lto in the future) flavors?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D40768

Files:
  test/msan/CMakeLists.txt
  test/msan/dtls_test.c
  test/msan/lit.site.cfg.in


Index: test/msan/lit.site.cfg.in
===================================================================
--- test/msan/lit.site.cfg.in
+++ test/msan/lit.site.cfg.in
@@ -1,9 +1,11 @@
 @LIT_SITE_CFG_IN_HEADER@
 
 # Tool-specific config options.
-config.name_suffix = "@MSAN_TEST_CONFIG_SUFFIX@"
+config.name_suffix = "- at CONFIG_NAME@"
 config.target_cflags = "@MSAN_TEST_TARGET_CFLAGS@"
 config.target_arch = "@MSAN_TEST_TARGET_ARCH@"
+config.use_lld = @MSAN_TEST_USE_LLD@
+config.use_thinlto = @MSAN_TEST_USE_THINLTO@
 
 # Load common config for all compiler-rt lit tests.
 lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
Index: test/msan/dtls_test.c
===================================================================
--- test/msan/dtls_test.c
+++ test/msan/dtls_test.c
@@ -7,6 +7,9 @@
    and https://github.com/google/sanitizers/issues/547
 */
 
+// Fails with assert(handle != 0); with LLD.
+// XFAIL: lld
+
 #ifndef BUILD_SO
 #include <assert.h>
 #include <dlfcn.h>
Index: test/msan/CMakeLists.txt
===================================================================
--- test/msan/CMakeLists.txt
+++ test/msan/CMakeLists.txt
@@ -1,26 +1,43 @@
 set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
 set(MSAN_TESTSUITES)
+set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
 
 set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH})
 if(APPLE)
   darwin_filter_host_archs(MSAN_SUPPORTED_ARCH MSAN_TEST_ARCH)
 endif()
 
-foreach(arch ${MSAN_TEST_ARCH})
+macro(add_msan_testsuite arch lld thinlto)
   set(MSAN_TEST_TARGET_ARCH ${arch})
-  string(TOLOWER "-${arch}" MSAN_TEST_CONFIG_SUFFIX)
-  get_test_cc_for_arch(${arch} MSAN_TEST_TARGET_CC MSAN_TEST_TARGET_CFLAGS)
-  string(TOUPPER ${arch} ARCH_UPPER_CASE)
-  set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
+
+  string(TOUPPER ${arch} CONFIG_NAME)
+
+  if (${thinlto})
+    set(CONFIG_NAME "thinlto-${CONFIG_NAME}")
+    list(APPEND MSAN_TEST_DEPS LTO)
+  endif()
+  if (${lld})
+    set(CONFIG_NAME "lld-${CONFIG_NAME}")
+    list(APPEND MSAN_TEST_DEPS lld)
+  endif()
+  set(MSAN_TEST_USE_THINLTO ${thinlto})
+  set(MSAN_TEST_USE_LLD ${lld})
 
   configure_lit_site_cfg(
     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
   list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+endmacro()
+
+foreach(arch ${MSAN_TEST_ARCH})
+  add_msan_testsuite(${arch} False False)
+
+  if(COMPILER_RT_HAS_LLD AND arch STREQUAL "x86_64" AND NOT (APPLE OR WIN32))
+    add_msan_testsuite(${arch} True False)
+  endif()
 endforeach()
 
-set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
 if(NOT COMPILER_RT_STANDALONE_BUILD)
   list(APPEND MSAN_TEST_DEPS msan)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40768.125266.patch
Type: text/x-patch
Size: 2710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171202/85c2d7be/attachment.bin>


More information about the llvm-commits mailing list