[compiler-rt] r207707 - Allow any test to be executed via a %run command.

Kostya Serebryany kcc at google.com
Wed May 7 08:16:09 PDT 2014


Yuri says this is causing other related problems:
https://code.google.com/p/address-sanitizer/issues/detail?id=308


On Thu, May 1, 2014 at 8:45 PM, Greg Fitzgerald <garious at gmail.com> wrote:

> Will fix.
>
> -Greg
>
> On Thu, May 1, 2014 at 8:23 AM, Kostya Serebryany <kcc at google.com> wrote:
> > This change breaks asan testing on x86_64 linux.
> > The newly failing test is
> > projects/compiler-rt/test/asan/TestCases/Linux/kernel-area.cc
> > It has this line:
> > // REQUIRES: asan-32-bits
> > Apparently after this change this line is not honored any more and the
> test
> > runs in 64-bit, where it is not supposed to be run.
> >
> > Please fix.
> >
> > --kcc
> >
> >
> > On Thu, May 1, 2014 at 1:32 AM, Greg Fitzgerald <gregf at codeaurora.org>
> > wrote:
> >>
> >> Author: garious
> >> Date: Wed Apr 30 16:32:30 2014
> >> New Revision: 207707
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=207707&view=rev
> >> Log:
> >> Allow any test to be executed via a %run command.
> >>
> >> Configure %run with COMPILER_RT_EMULATOR:
> >>
> >>   $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT"
> >>
> >> Modified:
> >>     compiler-rt/trunk/test/asan/CMakeLists.txt
> >>     compiler-rt/trunk/test/asan/lit.cfg
> >>     compiler-rt/trunk/test/asan/lit.site.cfg.in
> >>     compiler-rt/trunk/test/lit.common.cfg
> >>     compiler-rt/trunk/test/lit.common.configured.in
> >>     compiler-rt/trunk/test/lsan/lit.common.cfg
> >>     compiler-rt/trunk/test/profile/instrprof-basic.c
> >>     compiler-rt/trunk/test/profile/lit.cfg
> >>     compiler-rt/trunk/test/ubsan/lit.common.cfg
> >>
> >> Modified: compiler-rt/trunk/test/asan/CMakeLists.txt
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/CMakeLists.txt?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/asan/CMakeLists.txt (original)
> >> +++ compiler-rt/trunk/test/asan/CMakeLists.txt Wed Apr 30 16:32:30 2014
> >> @@ -9,7 +9,7 @@ if(CAN_TARGET_arm_android)
> >>    get_filename_component(ASAN_TEST_LLVM_TOOLS_DIR ${CMAKE_C_COMPILER}
> >> PATH)
> >>    set(ASAN_TEST_CONFIG_SUFFIX "-arm-android")
> >>    set(ASAN_TEST_BITS "32")
> >> -  get_target_flags_for_arch(arm_android ASAN_TEST_TARGET_CFLAGS)
> >> +  get_target_flags_for_arch(arm_android
> COMPILER_RT_TEST_COMPILER_CFLAGS)
> >>    configure_lit_site_cfg(
> >>      ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
> >>      ${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig/lit.site.cfg
> >> @@ -17,10 +17,24 @@ if(CAN_TARGET_arm_android)
> >>    list(APPEND ASAN_TESTSUITES
> >> ${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig)
> >>  endif()
> >>
> >> +if(CAN_TARGET_arm)
> >> +  # This is only true if we are cross-compiling.
> >> +  # Build all tests with host compiler and use host tools.
> >> +  set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
> >> +  set(ASAN_TEST_CONFIG_SUFFIX "-arm-linux")
> >> +  set(ASAN_TEST_BITS "32")
> >> +  set(ASAN_TEST_DYNAMIC False)
> >> +  configure_lit_site_cfg(
> >> +    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
> >> +    ${CMAKE_CURRENT_BINARY_DIR}/ARMLinuxConfig/lit.site.cfg
> >> +    )
> >> +  list(APPEND ASAN_TESTSUITES
> ${CMAKE_CURRENT_BINARY_DIR}/ARMLinuxConfig)
> >> +endif()
> >> +
> >>  if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64)
> >>    set(ASAN_TEST_CONFIG_SUFFIX "64")
> >>    set(ASAN_TEST_BITS "64")
> >> -  set(ASAN_TEST_TARGET_CFLAGS ${TARGET_64_BIT_CFLAGS})
> >> +  set(COMPILER_RT_TEST_COMPILER_CFLAGS ${TARGET_64_BIT_CFLAGS})
> >>    set(ASAN_TEST_DYNAMIC False)
> >>    configure_lit_site_cfg(
> >>      ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
> >> @@ -40,7 +54,7 @@ endif()
> >>  if(CAN_TARGET_i386)
> >>    set(ASAN_TEST_CONFIG_SUFFIX "32")
> >>    set(ASAN_TEST_BITS "32")
> >> -  set(ASAN_TEST_TARGET_CFLAGS ${TARGET_32_BIT_CFLAGS})
> >> +  set(COMPILER_RT_TEST_COMPILER_CFLAGS ${TARGET_32_BIT_CFLAGS})
> >>    set(ASAN_TEST_DYNAMIC False)
> >>    set(ASAN_TEST_TARGET_ARCH "i386")
> >>    configure_lit_site_cfg(
> >>
> >> Modified: compiler-rt/trunk/test/asan/lit.cfg
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/asan/lit.cfg (original)
> >> +++ compiler-rt/trunk/test/asan/lit.cfg Wed Apr 30 16:32:30 2014
> >> @@ -4,7 +4,7 @@ import os
> >>
> >>  def get_required_attr(config, attr_name):
> >>    attr_value = getattr(config, attr_name, None)
> >> -  if not attr_value:
> >> +  if attr_value == None:
> >>      lit_config.fatal(
> >>        "No attribute %r in test configuration! You may need to run "
> >>        "tests from your build directory or add this attribute "
> >>
> >> Modified: compiler-rt/trunk/test/asan/lit.site.cfg.in
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.site.cfg.in?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/asan/lit.site.cfg.in (original)
> >> +++ compiler-rt/trunk/test/asan/lit.site.cfg.in Wed Apr 30 16:32:30
> 2014
> >> @@ -4,7 +4,6 @@
> >>  # Tool-specific config options.
> >>  config.name_suffix = "@ASAN_TEST_CONFIG_SUFFIX@"
> >>  config.asan_lit_source_dir = "@ASAN_LIT_SOURCE_DIR@"
> >> -config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@"
> >>  config.clang = "@ASAN_TEST_TARGET_CC@"
> >>  config.llvm_tools_dir = "@ASAN_TEST_LLVM_TOOLS_DIR@"
> >>  config.bits = "@ASAN_TEST_BITS@"
> >>
> >> Modified: compiler-rt/trunk/test/lit.common.cfg
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/lit.common.cfg (original)
> >> +++ compiler-rt/trunk/test/lit.common.cfg Wed Apr 30 16:32:30 2014
> >> @@ -56,6 +56,9 @@ config.substitutions.append(
> >>      (' clang', """\n\n*** Do not use 'clangXXX' in tests,
> >>       instead define '%clangXXX' substitution in lit config.
> ***\n\n""") )
> >>
> >> +# Allow tests to be executed on a simulator or remotely.
> >> +config.substitutions.append( ('%run', config.emulator) )
> >> +
> >>  # Add supported compiler_rt architectures to a list of available
> >> features.
> >>  compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
> >>  if compiler_rt_arch:
> >>
> >> Modified: compiler-rt/trunk/test/lit.common.configured.in
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/lit.common.configured.in (original)
> >> +++ compiler-rt/trunk/test/lit.common.configured.in Wed Apr 30 16:32:30
> >> 2014
> >> @@ -8,6 +8,7 @@ def set_default(attr, value):
> >>
> >>  # Generic config options for all compiler-rt lit tests.
> >>  set_default("target_triple", "@TARGET_TRIPLE@")
> >> +set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_FLAGS@")
> >>  set_default("host_arch", "@HOST_ARCH@")
> >>  set_default("target_arch", "@HOST_ARCH@")
> >>  set_default("host_os", "@HOST_OS@")
> >> @@ -22,6 +23,7 @@ set_default("compiler_rt_arch", "@COMPIL
> >>  set_default("python_executable", "@PYTHON_EXECUTABLE@")
> >>  set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
> >>  set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
> >> +set_default("emulator", "@COMPILER_RT_EMULATOR@")
> >>
> >>  # LLVM tools dir can be passed in lit parameters, so try to
> >>  # apply substitution.
> >>
> >> Modified: compiler-rt/trunk/test/lsan/lit.common.cfg
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/lit.common.cfg?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/lsan/lit.common.cfg (original)
> >> +++ compiler-rt/trunk/test/lsan/lit.common.cfg Wed Apr 30 16:32:30 2014
> >> @@ -6,7 +6,7 @@ import os
> >>
> >>  def get_required_attr(config, attr_name):
> >>    attr_value = getattr(config, attr_name, None)
> >> -  if not attr_value:
> >> +  if attr_value == None:
> >>      lit_config.fatal(
> >>        "No attribute %r in test configuration! You may need to run "
> >>        "tests from your build directory or add this attribute "
> >>
> >> Modified: compiler-rt/trunk/test/profile/instrprof-basic.c
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-basic.c?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/profile/instrprof-basic.c (original)
> >> +++ compiler-rt/trunk/test/profile/instrprof-basic.c Wed Apr 30 16:32:30
> >> 2014
> >> @@ -1,5 +1,5 @@
> >>  // RUN: %clang_profgen -o %t -O3 %s
> >> -// RUN: env LLVM_PROFILE_FILE=%t.profraw %t
> >> +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
> >>  // RUN: llvm-profdata merge -o %t.profdata %t.profraw
> >>  // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
> >>
> >>
> >> Modified: compiler-rt/trunk/test/profile/lit.cfg
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/lit.cfg?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/profile/lit.cfg (original)
> >> +++ compiler-rt/trunk/test/profile/lit.cfg Wed Apr 30 16:32:30 2014
> >> @@ -27,10 +27,16 @@ if config.test_exec_root is None:
> >>  # Test suffixes.
> >>  config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
> >>
> >> +# Clang flags.
> >> +clang_cflags = [config.target_cflags]
> >> +
> >> +def build_invocation(compile_flags):
> >> +  return " " + " ".join([config.clang] + compile_flags) + " "
> >> +
> >>  # Add clang substitutions.
> >> -config.substitutions.append( ("%clang ", config.clang + " ") )
> >> -config.substitutions.append( ("%clang_profgen ", config.clang + "
> >> -fprofile-instr-generate ") )
> >> -config.substitutions.append( ("%clang_profuse=", config.clang + "
> >> -fprofile-instr-use=") )
> >> +config.substitutions.append( ("%clang ", build_invocation([])) )
> >> +config.substitutions.append( ("%clang_profgen ",
> >> build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
> >> +config.substitutions.append( ("%clang_profuse=",
> >> build_invocation(clang_cflags) + " -fprofile-instr-use=") )
> >>
> >>  # Profile tests are currently supported on Linux and Darwin only.
> >>  if config.host_os not in ['Linux', 'Darwin']:
> >>
> >> Modified: compiler-rt/trunk/test/ubsan/lit.common.cfg
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/lit.common.cfg?rev=207707&r1=207706&r2=207707&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/test/ubsan/lit.common.cfg (original)
> >> +++ compiler-rt/trunk/test/ubsan/lit.common.cfg Wed Apr 30 16:32:30 2014
> >> @@ -4,7 +4,7 @@ import os
> >>
> >>  def get_required_attr(config, attr_name):
> >>    attr_value = getattr(config, attr_name, None)
> >> -  if not attr_value:
> >> +  if attr_value == None:
> >>      lit_config.fatal(
> >>        "No attribute %r in test configuration! You may need to run "
> >>        "tests from your build directory or add this attribute "
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140507/ce3fe25f/attachment.html>


More information about the llvm-commits mailing list