<div dir="ltr">Hi Bill!<div><br></div><div style>On Fri, May 31, 2013 at 3:21 AM, Greg Fitzgerald <span dir="ltr"><<a href="mailto:garious@gmail.com" target="_blank">garious@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Can you add this one to the release_33 branch too?<br>
</blockquote><div><br></div><div>Do you mind backporting this for 3.3?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Thanks,<br>
Greg<br>
<div class=""><div class="h5"><br>
On Mon, May 27, 2013 at 2:35 AM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>> wrote:<br>
> Author: samsonov<br>
> Date: Mon May 27 04:35:24 2013<br>
> New Revision: 182726<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=182726&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=182726&view=rev</a><br>
> Log:<br>
> Improve support for compiler-rt tests in CMake build.<br>
><br>
> Now compiler-rt tests run correctly if compiler-rt is checked out into<br>
> arbitrary directory (not necessarily projects/compiler-rt).<br>
> Patch by Greg Fitzgerald!<br>
><br>
> Modified:<br>
>     compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg<br>
>     compiler-rt/trunk/lib/asan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/asan/lit_tests/lit.cfg<br>
>     compiler-rt/trunk/lib/asan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg<br>
>     compiler-rt/trunk/lib/lsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg<br>
>     compiler-rt/trunk/lib/lsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg<br>
>     compiler-rt/trunk/lib/msan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/msan/lit_tests/lit.cfg<br>
>     compiler-rt/trunk/lib/msan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg<br>
>     compiler-rt/trunk/lib/sanitizer_common/tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg<br>
>     compiler-rt/trunk/lib/tsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg<br>
>     compiler-rt/trunk/lib/tsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
>     compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg<br>
>     compiler-rt/trunk/lib/ubsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a><br>
><br>
> Modified: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/asan/lit_tests/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/lib/asan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/asan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -3,6 +3,7 @@<br>
><br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
>  config.asan_binary_dir = "@ASAN_BINARY_DIR@"<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/asan/lit_tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/asan/lit_tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -2,6 +2,14 @@<br>
><br>
>  import os<br>
><br>
> +def get_required_attr(config, attr_name):<br>
> +  attr_value = getattr(config, attr_name, None)<br>
> +  if not attr_value:<br>
> +    lit.fatal("No attribute %r in test configuration! You may need to run "<br>
> +              "tests from your build directory or add this attribute "<br>
> +              "to lit.site.cfg " % attr_name)<br>
> +  return attr_value<br>
> +<br>
>  # Setup config name.<br>
>  <a href="http://config.name" target="_blank">config.name</a> = 'AddressSanitizer'<br>
><br>
> @@ -30,14 +38,6 @@ if llvm_src_root is None:<br>
>    if not llvm_config:<br>
>      DisplayNoConfigMessage()<br>
><br>
> -  # Validate that llvm-config points to the same source tree.<br>
> -  llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()<br>
> -  asan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                    "lib", "asan", "lit_tests")<br>
> -  if (os.path.realpath(asan_test_src_root) !=<br>
> -      os.path.realpath(config.test_source_root)):<br>
> -    DisplayNoConfigMessage()<br>
> -<br>
>    # Find out the presumed location of generated site config.<br>
>    llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()<br>
>    asan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",<br>
> @@ -49,8 +49,9 @@ if llvm_src_root is None:<br>
>    raise SystemExit<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                   "lib", "lit.common.cfg")<br>
> +compiler_rt_src_root = get_required_attr(config, "compiler_rt_src_root")<br>
> +compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
> +                                   "lit.common.cfg")<br>
>  if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):<br>
>    lit.fatal("Can't find common compiler-rt lit config at: %r"<br>
>              % compiler_rt_lit_cfg)<br>
><br>
> Modified: compiler-rt/trunk/lib/asan/lit_tests/<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/lib/asan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/asan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/asan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -5,6 +5,7 @@ config.target_triple = "@TARGET_TRIPLE@"<br>
>  config.host_os = "@HOST_OS@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
>  config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.clang = "@LLVM_BINARY_DIR@/bin/clang"<br>
>  config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"<br>
><br>
> Modified: compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/lsan/lit_tests/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/lib/lsan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/lsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/lsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -3,6 +3,7 @@<br>
><br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
>  config.lsan_binary_dir = "@LSAN_BINARY_DIR@"<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
> @@ -24,8 +23,8 @@ <a href="http://config.name" target="_blank">config.name</a> = 'LeakSanitizer'<br>
>  config.test_source_root = os.path.dirname(__file__)<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                   "lib", "lit.common.cfg")<br>
> +compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
> +                                   "lit.common.cfg")<br>
>  if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):<br>
>    lit.fatal("Can't find common compiler-rt lit config at: %r"<br>
>              % compiler_rt_lit_cfg)<br>
><br>
> Modified: compiler-rt/trunk/lib/lsan/lit_tests/<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/lib/lsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/lsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/lsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -2,6 +2,7 @@ config.host_os = "@HOST_OS@"<br>
>  config.host_arch = "@HOST_ARCH@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.clang = "@LLVM_BINARY_DIR@/bin/clang"<br>
><br>
> Modified: compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/msan/lit_tests/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/lib/msan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/msan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/msan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -3,6 +3,7 @@<br>
><br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
>  config.msan_binary_dir = "@MSAN_BINARY_DIR@"<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/msan/lit_tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/msan/lit_tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/msan/lit_tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -2,6 +2,14 @@<br>
><br>
>  import os<br>
><br>
> +def get_required_attr(config, attr_name):<br>
> +  attr_value = getattr(config, attr_name, None)<br>
> +  if not attr_value:<br>
> +    lit.fatal("No attribute %r in test configuration! You may need to run "<br>
> +              "tests from your build directory or add this attribute "<br>
> +              "to lit.site.cfg " % attr_name)<br>
> +  return attr_value<br>
> +<br>
>  # Setup config name.<br>
>  <a href="http://config.name" target="_blank">config.name</a> = 'MemorySanitizer'<br>
><br>
> @@ -30,14 +38,6 @@ if llvm_src_root is None:<br>
>    if not llvm_config:<br>
>      DisplayNoConfigMessage()<br>
><br>
> -  # Validate that llvm-config points to the same source tree.<br>
> -  llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()<br>
> -  msan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                    "lib", "msan", "lit_tests")<br>
> -  if (os.path.realpath(msan_test_src_root) !=<br>
> -      os.path.realpath(config.test_source_root)):<br>
> -    DisplayNoConfigMessage()<br>
> -<br>
>    # Find out the presumed location of generated site config.<br>
>    llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()<br>
>    msan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",<br>
> @@ -49,8 +49,9 @@ if llvm_src_root is None:<br>
>    raise SystemExit<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                   "lib", "lit.common.cfg")<br>
> +compiler_rt_src_root = get_required_attr(config, "compiler_rt_src_root")<br>
> +compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
> +                                   "lit.common.cfg")<br>
>  if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):<br>
>    lit.fatal("Can't find common compiler-rt lit config at: %r"<br>
>              % compiler_rt_lit_cfg)<br>
><br>
> Modified: compiler-rt/trunk/lib/msan/lit_tests/<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/lib/msan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/msan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/msan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -1,6 +1,7 @@<br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
>  config.host_os = "@HOST_OS@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.clang = "@LLVM_BINARY_DIR@/bin/clang"<br>
><br>
> Modified: compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/sanitizer_common/tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/sanitizer_common/tests/<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/lib/sanitizer_common/tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/sanitizer_common/tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/sanitizer_common/tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -3,6 +3,7 @@<br>
><br>
>  config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
><br>
>  try:<br>
><br>
> Modified: compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -11,9 +11,8 @@ def get_required_attr(config, attr_name)<br>
>    return attr_value<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -llvm_src_root = get_required_attr(config, 'llvm_src_root')<br>
> -compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",<br>
> -                                        "compiler-rt", "lib",<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
>                                          "lit.common.unit.cfg")<br>
>  lit.load_config(config, compiler_rt_lit_unit_cfg)<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/tsan/lit_tests/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/lib/tsan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Unit/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/tsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/tsan/lit_tests/Unit/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -3,6 +3,7 @@<br>
><br>
>  config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.llvm_build_mode = "@LLVM_BUILD_MODE@"<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -2,6 +2,14 @@<br>
><br>
>  import os<br>
><br>
> +def get_required_attr(config, attr_name):<br>
> +  attr_value = getattr(config, attr_name, None)<br>
> +  if not attr_value:<br>
> +    lit.fatal("No attribute %r in test configuration! You may need to run "<br>
> +              "tests from your build directory or add this attribute "<br>
> +              "to lit.site.cfg " % attr_name)<br>
> +  return attr_value<br>
> +<br>
>  # Setup config name.<br>
>  <a href="http://config.name" target="_blank">config.name</a> = 'ThreadSanitizer'<br>
><br>
> @@ -30,14 +38,6 @@ if llvm_src_root is None:<br>
>    if not llvm_config:<br>
>      DisplayNoConfigMessage()<br>
><br>
> -  # Validate that llvm-config points to the same source tree.<br>
> -  llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()<br>
> -  tsan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                    "lib", "tsan", "lit_tests")<br>
> -  if (os.path.realpath(tsan_test_src_root) !=<br>
> -      os.path.realpath(config.test_source_root)):<br>
> -    DisplayNoConfigMessage()<br>
> -<br>
>    # Find out the presumed location of generated site config.<br>
>    llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()<br>
>    tsan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",<br>
> @@ -49,8 +49,9 @@ if llvm_src_root is None:<br>
>    raise SystemExit<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                   "lib", "lit.common.cfg")<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
> +                                   "lit.common.cfg")<br>
>  if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):<br>
>    lit.fatal("Can't find common compiler-rt lit config at: %r"<br>
>              % compiler_rt_lit_cfg)<br>
><br>
> Modified: compiler-rt/trunk/lib/tsan/lit_tests/<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/lib/tsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/tsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/tsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -4,6 +4,7 @@<br>
>  config.clang = "@LLVM_BINARY_DIR@/bin/clang"<br>
>  config.host_os = "@HOST_OS@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
><br>
><br>
> Modified: compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg (original)<br>
> +++ compiler-rt/trunk/lib/ubsan/lit_tests/lit.cfg Mon May 27 04:35:24 2013<br>
> @@ -2,6 +2,14 @@<br>
><br>
>  import os<br>
><br>
> +def get_required_attr(config, attr_name):<br>
> +  attr_value = getattr(config, attr_name, None)<br>
> +  if not attr_value:<br>
> +    lit.fatal("No attribute %r in test configuration! You may need to run "<br>
> +              "tests from your build directory or add this attribute "<br>
> +              "to lit.site.cfg " % attr_name)<br>
> +  return attr_value<br>
> +<br>
>  # Setup config name.<br>
>  <a href="http://config.name" target="_blank">config.name</a> = 'UndefinedBehaviorSanitizer'<br>
><br>
> @@ -30,14 +38,6 @@ if llvm_src_root is None:<br>
>    if not llvm_config:<br>
>      DisplayNoConfigMessage()<br>
><br>
> -  # Validate that llvm-config points to the same source tree.<br>
> -  llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()<br>
> -  ubsan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                     "lib", "ubsan", "lit_tests")<br>
> -  if (os.path.realpath(ubsan_test_src_root) !=<br>
> -      os.path.realpath(config.test_source_root)):<br>
> -    DisplayNoConfigMessage()<br>
> -<br>
>    # Find out the presumed location of generated site config.<br>
>    llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()<br>
>    ubsan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",<br>
> @@ -49,8 +49,9 @@ if llvm_src_root is None:<br>
>    raise SystemExit<br>
><br>
>  # Setup attributes common for all compiler-rt projects.<br>
> -compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",<br>
> -                                   "lib", "lit.common.cfg")<br>
> +compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')<br>
> +compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",<br>
> +                                   "lit.common.cfg")<br>
>  if not compiler_rt_lit_cfg or not os.path.exists(compiler_rt_lit_cfg):<br>
>    lit.fatal("Can't find common compiler-rt lit config at: %r"<br>
>              % compiler_rt_lit_cfg)<br>
><br>
> Modified: compiler-rt/trunk/lib/ubsan/lit_tests/<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/lib/ubsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/lit.site.cfg.in?rev=182726&r1=182725&r2=182726&view=diff</a><br>

> ==============================================================================<br>
> --- compiler-rt/trunk/lib/ubsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ compiler-rt/trunk/lib/ubsan/lit_tests/<a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> Mon May 27 04:35:24 2013<br>
> @@ -4,6 +4,7 @@<br>
>  config.clang = "@LLVM_BINARY_DIR@/bin/clang"<br>
>  config.host_os = "@HOST_OS@"<br>
>  config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>
> +config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"<br>
>  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>
>  config.target_triple = "@TARGET_TRIPLE@"<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">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/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>