<div dir="ltr">Thanks for a quick fix!<br></div><br><div class="gmail_quote">On Tue Feb 03 2015 at 9:42:43 PM Alexey Samsonov <<a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 3, 2015 at 2:50 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">See comments inline.<br><br><div class="gmail_quote"><span>On Thu Dec 18 2014 at 9:20:34 PM Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: samsonov<br>
Date: Wed Dec 17 17:14:01 2014<br>
New Revision: 224470<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224470&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=224470&view=rev</a><br>
Log:<br>
[ASan] Always build shared ASan runtime on Linux.<br>
<br>
This commit changes the strategy for building shared ASan runtime<br>
and the way we test it:<br>
  - COMPILER_RT_BUILD_SHARED_ASAN CMake option is removed. We now<br>
    always build shared ASan runtime (it is the default on Android,<br>
    Windows and Mac, and not the default on Linux and FreeBSD).<br>
  - Platforms, which use static runtime by default now have<br>
    "check-asan-dynamic" testsuite. This testsuite contains instrumented<br>
    unit tests, and ASan lit tests, and runs them with shared ASan<br>
    runtime. This testsuite is *not* a part of "check-asan" and<br>
    *not* a part of "check-all", as adding 1000 more test cases, which<br>
    duplicate existing ones is costly. However, you're welcome to<br>
    add this command to your buildbot.<br></blockquote><div><br></div></span><div>Why was it done this way?</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Because building/running ASan test-suite takes a long time (more than all the rest LLVM/Clang testsuites combined, especially in the debug build),</div><div>and I thought it makes sense to only test this configuration on the buildbot.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>This change has silently disabled testing of half of the tests on Windows and I only found out about this now, by pure coincidence.</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Sorry, apparently I didn't realize that you actively use both runtimes on Windows :/</div><div>r228001 should help - now "check-all" command should run ASan tests with both static and dynamic runtime.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>[see below]</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified:<br>
    compiler-rt/trunk/CMakeLists.<u></u>txt<br>
    compiler-rt/trunk/cmake/<u></u>Modules/AddCompilerRT.cmake<br>
    compiler-rt/trunk/cmake/<u></u>config-ix.cmake<br>
    compiler-rt/trunk/lib/asan/<u></u>CMakeLists.txt<br>
    compiler-rt/trunk/lib/asan/<u></u>tests/CMakeLists.txt<br>
    compiler-rt/trunk/test/asan/<u></u>CMakeLists.txt<br>
    compiler-rt/trunk/test/asan/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
<br>
Modified: compiler-rt/trunk/CMakeLists.<u></u>txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/<u></u>CMakeLists.txt?rev=224470&r1=<u></u>224469&r2=224470&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/CMakeLists.<u></u>txt (original)<br>
+++ compiler-rt/trunk/CMakeLists.<u></u>txt Wed Dec 17 17:14:01 2014<br>
@@ -199,14 +199,6 @@ option(COMPILER_RT_DEBUG "Build runtimes<br>
 # COMPILER_RT_DEBUG_PYBOOL is used by <a href="http://lit.common.configured.in" target="_blank">lit.common.configured.in</a>.<br>
 pythonize_bool(COMPILER_RT_<u></u>DEBUG)<br>
<br>
-# We have to support both static and dynamic/shared runtime on Windows.<br></blockquote><div><br></div></span><div><span style="font-size:13.1999998092651px">As it was explained in this comment, on Windows we *have* to support both static and dynamic runtimes.  W</span><span style="font-size:13.1999998092651px">e want to *always* test both static and dynamic runtimes</span><span style="font-size:13.1999998092651px">.  Please reconsider how the static/dynamic cmake logic works to account for that.</span></div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-# Android only works with dynamic runtime.<br>
-if(WIN32 OR ANDROID)<br>
-option(COMPILER_RT_BUILD_<u></u>SHARED_ASAN "Build shared version of AddressSanitizer runtime" ON)<br>
-else()<br>
-option(COMPILER_RT_BUILD_<u></u>SHARED_ASAN "Build shared version of AddressSanitizer runtime" OFF)<br>
-endif()<br>
-<br>
 #=============================<u></u>===<br>
 # Setup Compiler Flags<br>
 #=============================<u></u>===<br>
<br>
Modified: compiler-rt/trunk/cmake/<u></u>Modules/AddCompilerRT.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/<u></u>cmake/Modules/AddCompilerRT.<u></u>cmake?rev=224470&r1=224469&r2=<u></u>224470&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/cmake/<u></u>Modules/AddCompilerRT.cmake (original)<br>
+++ compiler-rt/trunk/cmake/<u></u>Modules/AddCompilerRT.cmake Wed Dec 17 17:14:01 2014<br>
@@ -156,12 +156,17 @@ endif()<br>
 # using specified link flags. Make executable a part of provided<br>
 # test_suite.<br>
 # add_compiler_rt_test(<test_<u></u>suite> <test_name><br>
+#                      SUBDIR <subdirectory for binary><br>
 #                      OBJECTS <object files><br>
 #                      DEPS <deps (e.g. runtime libs)><br>
 #                      LINK_FLAGS <link flags>)<br>
 macro(add_compiler_rt_test test_suite test_name)<br>
-  parse_arguments(TEST "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})<br>
-  set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/$<u></u>{test_name}")<br>
+  parse_arguments(TEST "SUBDIR;OBJECTS;DEPS;LINK_<u></u>FLAGS" "" ${ARGN})<br>
+  if(TEST_SUBDIR)<br>
+    set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/$<u></u>{TEST_SUBDIR}/${test_name}")<br>
+  else()<br>
+    set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/$<u></u>{test_name}")<br>
+  endif()<br>
   # Use host compiler in a standalone build, and just-built Clang otherwise.<br>
   if(NOT COMPILER_RT_STANDALONE_BUILD)<br>
     list(APPEND TEST_DEPS clang)<br>
<br>
Modified: compiler-rt/trunk/cmake/<u></u>config-ix.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/<u></u>cmake/config-ix.cmake?rev=<u></u>224470&r1=224469&r2=224470&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/cmake/<u></u>config-ix.cmake (original)<br>
+++ compiler-rt/trunk/cmake/<u></u>config-ix.cmake Wed Dec 17 17:14:01 2014<br>
@@ -205,6 +205,12 @@ else()<br>
   set(COMPILER_RT_HAS_ASAN FALSE)<br>
 endif()<br>
<br>
+if (OS_NAME MATCHES "Linux|FreeBSD")<br>
+  set(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME TRUE)<br>
+else()<br>
+  set(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME FALSE)<br>
+endif()<br>
+<br>
 # TODO: Add builtins support.<br>
<br>
 if (COMPILER_RT_HAS_SANITIZER_<u></u>COMMON AND DFSAN_SUPPORTED_ARCH AND<br>
<br>
Modified: compiler-rt/trunk/lib/asan/<u></u>CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/lib/<u></u>asan/CMakeLists.txt?rev=<u></u>224470&r1=224469&r2=224470&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/lib/asan/<u></u>CMakeLists.txt (original)<br>
+++ compiler-rt/trunk/lib/asan/<u></u>CMakeLists.txt Wed Dec 17 17:14:01 2014<br>
@@ -79,12 +79,10 @@ else()<br>
     add_compiler_rt_object_<u></u>library(RTAsan_preinit ${arch}<br>
       SOURCES ${ASAN_PREINIT_SOURCES} CFLAGS ${ASAN_CFLAGS}<br>
       DEFS ${ASAN_COMMON_DEFINITIONS})<br>
-    if (COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
-      add_compiler_rt_object_<u></u>library(RTAsan_dynamic ${arch}<br>
-        SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}<br>
-        CFLAGS ${ASAN_DYNAMIC_CFLAGS}<br>
-        DEFS ${ASAN_DYNAMIC_DEFINITIONS})<br>
-    endif()<br>
+    add_compiler_rt_object_<u></u>library(RTAsan_dynamic ${arch}<br>
+      SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}<br>
+      CFLAGS ${ASAN_DYNAMIC_CFLAGS}<br>
+      DEFS ${ASAN_DYNAMIC_DEFINITIONS})<br>
   endforeach()<br>
 endif()<br>
<br>
@@ -129,28 +127,25 @@ else()<br>
       DEFS ${ASAN_COMMON_DEFINITIONS})<br>
     add_dependencies(asan clang_rt.asan_cxx-${arch})<br>
<br>
-    if (COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
-      add_compiler_rt_runtime(clang_<u></u>rt.asan-preinit-${arch} ${arch} STATIC<br>
-        SOURCES $<TARGET_OBJECTS:RTAsan_<u></u>preinit.${arch}><br>
-        CFLAGS ${ASAN_CFLAGS}<br>
-        DEFS ${ASAN_COMMON_DEFINITIONS})<br>
-      add_dependencies(asan clang_rt.asan-preinit-${arch})<br>
-<br>
-      if (WIN32)<br>
-        set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}$<u></u>{COMPILER_RT_OS_SUFFIX})<br>
-      else()<br>
-        set(SHARED_ASAN_NAME clang_rt.asan-${arch}${<u></u>COMPILER_RT_OS_SUFFIX})<br>
-      endif()<br>
-<br>
-      add_compiler_rt_runtime(clang_<u></u>rt.asan-dynamic-${arch} ${arch} SHARED<br>
-        OUTPUT_NAME ${SHARED_ASAN_NAME}<br>
-        SOURCES $<TARGET_OBJECTS:RTAsan_<u></u>dynamic.${arch}><br>
-                ${ASAN_COMMON_RUNTIME_OBJECTS}<br>
-        CFLAGS ${ASAN_DYNAMIC_CFLAGS}<br>
-        DEFS ${ASAN_DYNAMIC_DEFINITIONS})<br>
-      target_link_libraries(clang_<u></u>rt.asan-dynamic-${arch} ${ASAN_DYNAMIC_LIBS})<br>
-      add_dependencies(asan clang_rt.asan-dynamic-${arch})<br>
+    add_compiler_rt_runtime(clang_<u></u>rt.asan-preinit-${arch} ${arch} STATIC<br>
+      SOURCES $<TARGET_OBJECTS:RTAsan_<u></u>preinit.${arch}><br>
+      CFLAGS ${ASAN_CFLAGS}<br>
+      DEFS ${ASAN_COMMON_DEFINITIONS})<br>
+    add_dependencies(asan clang_rt.asan-preinit-${arch})<br>
+<br>
+    if (WIN32)<br>
+      set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}$<u></u>{COMPILER_RT_OS_SUFFIX})<br>
+    else()<br>
+      set(SHARED_ASAN_NAME clang_rt.asan-${arch}${<u></u>COMPILER_RT_OS_SUFFIX})<br>
     endif()<br>
+    add_compiler_rt_runtime(clang_<u></u>rt.asan-dynamic-${arch} ${arch} SHARED<br>
+      OUTPUT_NAME ${SHARED_ASAN_NAME}<br>
+      SOURCES $<TARGET_OBJECTS:RTAsan_<u></u>dynamic.${arch}><br>
+              ${ASAN_COMMON_RUNTIME_OBJECTS}<br>
+      CFLAGS ${ASAN_DYNAMIC_CFLAGS}<br>
+      DEFS ${ASAN_DYNAMIC_DEFINITIONS})<br>
+    target_link_libraries(clang_<u></u>rt.asan-dynamic-${arch} ${ASAN_DYNAMIC_LIBS})<br>
+    add_dependencies(asan clang_rt.asan-dynamic-${arch})<br>
<br>
     if (UNIX AND NOT ${arch} STREQUAL "i386" AND NOT ${arch} STREQUAL "i686")<br>
       add_sanitizer_rt_symbols(<u></u>clang_rt.asan_cxx-${arch})<br>
<br>
Modified: compiler-rt/trunk/lib/asan/<u></u>tests/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/lib/<u></u>asan/tests/CMakeLists.txt?rev=<u></u>224470&r1=224469&r2=224470&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/lib/asan/<u></u>tests/CMakeLists.txt (original)<br>
+++ compiler-rt/trunk/lib/asan/<u></u>tests/CMakeLists.txt Wed Dec 17 17:14:01 2014<br>
@@ -117,7 +117,7 @@ endmacro()<br>
 # Link ASan unit test for a given architecture from a set<br>
 # of objects in with given linker flags.<br>
 macro(add_asan_test test_suite test_name arch kind)<br>
-  parse_arguments(TEST "OBJECTS;LINKFLAGS" "WITH_TEST_RUNTIME" ${ARGN})<br>
+  parse_arguments(TEST "OBJECTS;LINKFLAGS;SUBDIR" "WITH_TEST_RUNTIME" ${ARGN})<br>
   get_target_flags_for_arch(${<u></u>arch} TARGET_LINK_FLAGS)<br>
   set(TEST_DEPS ${TEST_OBJECTS})<br>
   if(NOT COMPILER_RT_STANDALONE_BUILD)<br>
@@ -132,6 +132,7 @@ macro(add_asan_test test_suite test_name<br>
     endif()<br>
   endif()<br>
   add_compiler_rt_test(${test_<u></u>suite} ${test_name}<br>
+                       SUBDIR ${TEST_SUBDIR}<br>
                        OBJECTS ${TEST_OBJECTS}<br>
                        DEPS ${TEST_DEPS}<br>
                        LINK_FLAGS ${TEST_LINKFLAGS}<br>
@@ -141,6 +142,11 @@ endmacro()<br>
 # Main AddressSanitizer unit tests.<br>
 add_custom_target(<u></u>AsanUnitTests)<br>
 set_target_properties(<u></u>AsanUnitTests PROPERTIES FOLDER "ASan unit tests")<br>
+# AddressSanitizer unit tests with dynamic runtime (on platforms where it's<br>
+# not the default).<br>
+add_custom_target(<u></u>AsanDynamicUnitTests)<br>
+set_target_properties(<u></u>AsanDynamicUnitTests<br>
+  PROPERTIES FOLDER "ASan unit tests with dynamic runtime")<br>
 # ASan benchmarks (not actively used now).<br>
 add_custom_target(<u></u>AsanBenchmarks)<br>
 set_target_properties(<u></u>AsanBenchmarks PROPERTIES FOLDER "Asan benchmarks")<br>
@@ -182,11 +188,15 @@ macro(add_asan_tests_for_arch_<u></u>and_kind a<br>
     asan_compile(ASAN_INST_TEST_<u></u>OBJECTS <a href="http://asan_mac_test_helpers.mm" target="_blank">asan_mac_test_helpers.mm</a> ${arch} ${kind}<br>
                  ${ASAN_UNITTEST_INSTRUMENTED_<u></u>CFLAGS} -ObjC ${ARGN})<br>
   endif()<br>
-  add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test" ${arch} ${kind}<br>
+  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/<u></u>default")<br>
+  add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test"<br>
+                ${arch} ${kind} SUBDIR "default"<br>
                 OBJECTS ${ASAN_INST_TEST_OBJECTS}<br>
                 LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_<u></u>LINKFLAGS})<br>
-  if(COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
-    add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Dynamic-<u></u>Test" ${arch} ${kind}<br>
+  if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
+    file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/<u></u>dynamic")<br>
+    add_asan_test(<u></u>AsanDynamicUnitTests "Asan-${arch}${kind}-Dynamic-<u></u>Test"<br>
+                  ${arch} ${kind} SUBDIR "dynamic"<br>
                   OBJECTS ${ASAN_INST_TEST_OBJECTS}<br>
                   LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_<u></u>INSTRUMENTED_LINKFLAGS})<br>
   endif()<br>
@@ -220,7 +230,8 @@ macro(add_asan_tests_for_arch_<u></u>and_kind a<br>
     asan_compile(ASAN_NOINST_TEST_<u></u>OBJECTS ${src} ${arch} ${kind}<br>
                  ${ASAN_UNITTEST_COMMON_CFLAGS} ${ARGN})<br>
   endforeach()<br>
-  add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Noinst-<u></u>Test" ${arch} ${kind}<br>
+  add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Noinst-<u></u>Test"<br>
+                ${arch} ${kind} SUBDIR "default"<br>
                 OBJECTS ${ASAN_NOINST_TEST_OBJECTS}<br>
                 LINKFLAGS ${ASAN_UNITTEST_NOINST_<u></u>LINKFLAGS}<br>
                 WITH_TEST_RUNTIME)<br>
@@ -231,14 +242,10 @@ macro(add_asan_tests_for_arch_<u></u>and_kind a<br>
     asan_compile(ASAN_BENCHMARKS_<u></u>OBJECTS ${src} ${arch} ${kind}<br>
                  ${ASAN_UNITTEST_INSTRUMENTED_<u></u>CFLAGS} ${ARGN})<br>
   endforeach()<br>
-  add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-<u></u>Benchmark" ${arch} ${kind}<br>
+  add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-<u></u>Benchmark"<br>
+                ${arch} ${kind} SUBDIR "default"<br>
                 OBJECTS ${ASAN_BENCHMARKS_OBJECTS}<br>
                 LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_<u></u>LINKFLAGS})<br>
-  if(COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
-    add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Dynamic-<u></u>Benchmark" ${arch} ${kind}<br>
-                  OBJECTS ${ASAN_BENCHMARKS_OBJECTS}<br>
-                  LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_<u></u>INSTRUMENTED_LINKFLAGS})<br>
-  endif()<br>
 endmacro()<br>
<br>
 if(COMPILER_RT_CAN_EXECUTE_<u></u>TESTS AND NOT ANDROID)<br>
<br>
Modified: compiler-rt/trunk/test/asan/<u></u>CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/<u></u>test/asan/CMakeLists.txt?rev=<u></u>224470&r1=224469&r2=224470&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/test/asan/<u></u>CMakeLists.txt (original)<br>
+++ compiler-rt/trunk/test/asan/<u></u>CMakeLists.txt Wed Dec 17 17:14:01 2014<br>
@@ -1,6 +1,7 @@<br>
 set(ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})<br>
<br>
 set(ASAN_TESTSUITES)<br>
+set(ASAN_DYNAMIC_TESTSUITES)<br>
<br>
 macro(get_bits_for_arch arch bits)<br>
   if (${arch} STREQUAL "arm" OR<br>
@@ -78,13 +79,14 @@ else()  # Not Android<br>
       ${CMAKE_CURRENT_BINARY_DIR}/<u></u>64bitConfig/lit.site.cfg<br>
       )<br>
     list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>64bitConfig)<br>
-    if(COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
+    if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
       set(ASAN_TEST_CONFIG_SUFFIX "64-Dynamic")<br>
       set(ASAN_TEST_DYNAMIC True)<br>
       configure_lit_site_cfg(<br>
         ${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://lit.site.cfg.in" target="_blank">li<u></u>t.site.cfg.in</a><br>
         ${CMAKE_CURRENT_BINARY_DIR}/<u></u>64bitConfig-dynamic/lit.site.<u></u>cfg)<br>
-      list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>64bitConfig-dynamic)<br>
+      list(APPEND ASAN_DYNAMIC_TESTSUITES<br>
+           ${CMAKE_CURRENT_BINARY_DIR}/<u></u>64bitConfig-dynamic)<br>
     endif()<br>
   endif()<br>
<br>
@@ -99,13 +101,14 @@ else()  # Not Android<br>
       ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig/lit.site.cfg<br>
       )<br>
     list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig)<br>
-    if(COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
+    if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
       set(ASAN_TEST_CONFIG_SUFFIX "32-Dynamic")<br>
       set(ASAN_TEST_DYNAMIC True)<br>
       configure_lit_site_cfg(<br>
         ${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://lit.site.cfg.in" target="_blank">li<u></u>t.site.cfg.in</a><br>
         ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic/lit.site.<u></u>cfg)<br>
-      list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic)<br>
+      list(APPEND ASAN_DYNAMIC_TESTSUITES<br>
+           ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic)<br>
     endif()<br>
   endif()<br>
<br>
@@ -119,23 +122,18 @@ else()  # Not Android<br>
       ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig/lit.site.cfg<br>
       )<br>
     list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig)<br>
-    if(COMPILER_RT_BUILD_SHARED_<u></u>ASAN)<br>
+    if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
       set(ASAN_TEST_CONFIG_SUFFIX "32-Dynamic")<br>
       set(ASAN_TEST_DYNAMIC True)<br>
       configure_lit_site_cfg(<br>
         ${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://lit.site.cfg.in" target="_blank">li<u></u>t.site.cfg.in</a><br>
         ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic/lit.site.<u></u>cfg)<br>
-      list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic)<br>
+      list(APPEND ASAN_DYNAMIC_TESTSUITES<br>
+           ${CMAKE_CURRENT_BINARY_DIR}/<u></u>32bitConfig-dynamic)<br>
     endif()<br>
   endif()<br>
 endif()  # Not Android<br>
<br>
-if(COMPILER_RT_INCLUDE_TESTS)<br>
-  configure_lit_site_cfg(<br>
-    ${CMAKE_CURRENT_SOURCE_DIR}/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
-    ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit/lit.site.cfg)<br>
-endif()<br>
-<br>
 set(ASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_<u></u>DEPS})<br>
 if(COMPILER_RT_STANDALONE_<u></u>BUILD)<br>
   add_executable(FileCheck IMPORTED GLOBAL)<br>
@@ -144,13 +142,44 @@ if(COMPILER_RT_STANDALONE_<u></u>BUILD)<br>
 else()<br>
   list(APPEND ASAN_TEST_DEPS asan)<br>
 endif()<br>
+set(ASAN_DYNAMIC_TEST_DEPS ${ASAN_TEST_DEPS})<br>
<br>
-# FIXME: support unit test in the android test runner<br>
-if(COMPILER_RT_INCLUDE_TESTS AND NOT ANDROID)<br>
-  list(APPEND ASAN_TEST_DEPS AsanUnitTests)<br>
-  list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit)<br>
+# Add unit tests.<br>
+if(COMPILER_RT_INCLUDE_TESTS)<br>
+  set(ASAN_TEST_DYNAMIC False)<br>
+  configure_lit_site_cfg(<br>
+    ${CMAKE_CURRENT_SOURCE_DIR}/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
+    ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit/lit.site.cfg)<br>
+  if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
+    set(ASAN_TEST_DYNAMIC True)<br>
+    configure_lit_site_cfg(<br>
+      ${CMAKE_CURRENT_SOURCE_DIR}/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
+      ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit/dynamic/lit.site.cfg)<br>
+  endif()<br>
+  # FIXME: support unit test in the android test runner<br>
+  if (NOT ANDROID)<br>
+    list(APPEND ASAN_TEST_DEPS AsanUnitTests)<br>
+    list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit)<br>
+    if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
+      list(APPEND ASAN_DYNAMIC_TEST_DEPS AsanDynamicUnitTests)<br>
+      list(APPEND ASAN_DYNAMIC_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/<u></u>Unit/dynamic)<br>
+    endif()<br>
+  endif()<br>
 endif()<br>
+<br>
 add_lit_testsuite(check-asan "Running the AddressSanitizer tests"<br>
   ${ASAN_TESTSUITES}<br>
   DEPENDS ${ASAN_TEST_DEPS})<br>
 set_target_properties(check-<u></u>asan PROPERTIES FOLDER "ASan tests")<br>
+<br>
+if(COMPILER_RT_ASAN_HAS_<u></u>STATIC_RUNTIME)<br>
+  # Add check-dynamic-asan target (not included in check-all)<br>
+  set(EXCLUDE_FROM_ALL TRUE)<br>
+  add_lit_testsuite(check-asan-<u></u>dynamic<br>
+                    "Running the AddressSanitizer tests with dynamic runtime"<br>
+                    ${ASAN_DYNAMIC_TESTSUITES}<br>
+                    DEPENDS ${ASAN_DYNAMIC_TEST_DEPS})<br>
+  set_target_properties(check-<u></u>asan-dynamic<br>
+                        PROPERTIES FOLDER "ASan dynamic tests")<br>
+  set(EXCLUDE_FROM_ALL FALSE)<br>
+endif()<br>
<br>
Modified: compiler-rt/trunk/test/asan/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in?rev=224470&r1=224469&r2=224470&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/compiler-rt/trunk/<u></u>test/asan/Unit/lit.site.cfg.<u></u>in?rev=224470&r1=224469&r2=<u></u>224470&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- compiler-rt/trunk/test/asan/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
+++ compiler-rt/trunk/test/asan/<u></u>Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Wed Dec 17 17:14:01 2014<br>
@@ -17,7 +17,13 @@ <a href="http://config.name" target="_blank">config.name</a> = 'AddressSanitizer-Unit'<br>
 # Setup test source and exec root. For unit tests, we define<br>
 # it as build directory with ASan unit tests.<br>
 # FIXME: De-hardcode this path.<br>
-config.test_exec_root = "@COMPILER_RT_BINARY_DIR@/lib/<u></u>asan/tests"<br>
+if @ASAN_TEST_DYNAMIC@:<br>
+  test_dir = "dynamic"<br>
+else:<br>
+  test_dir = "default"<br>
+config.test_exec_root = os.path.join("@COMPILER_RT_<u></u>BINARY_DIR@",<br>
+                                     "lib", "asan", "tests", test_dir)<br>
+<br>
 config.test_source_root = config.test_exec_root<br>
<br>
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div></div>
</blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div></blockquote></div>