If you check the svn-llvm step you'll see this:<br><br>Updating '.':<br>Skipped 'utils/lit/lit/llvm' -- Node remains in conflict<br>Skipped 'utils/lit/lit/llvm' -- Node remains in conflict<br>U    utils/lit/lit/TestRunner.py<br>U    utils/lit/lit/util.py<br>U    test/lit.cfg<br>U    test/<a href="http://lit.site.cfg.in">lit.site.cfg.in</a><br>U    cmake/modules/AddLLVM.cmake<br>Updated to revision 313467.<br>Summary of conflicts:<br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 17, 2017 at 7:15 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, I didn't notice this particular bot but I sent an email to several other bot owners experiencing this.<br><br>SVN seems to be in a tree conflict and there is nothing i can do to fix it (including reverting).  I've uploaded a patch to zorg that would allow me to remotely clobber a source tree, but galina needs to lgtm it and restart the master, so that's at least a few days out.<br><br>In the meantime, I'm not really sure what can be done other than physically logging into the bot and reverting then manually updating svn.<br><br>I'm not sure how a conflict happened to begin with, only thing i can figure is a timing related bug in buildbot that only affected some bots<br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 17, 2017 at 7:05 PM Yung, Douglas <<a href="mailto:douglas.yung@sony.com" target="_blank">douglas.yung@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Zachary,<br>
<br>
Your commit seems to have completely broken the lit test framework on both the linux and windows hosted PS4 bots and as a result no tests are currently being run on new commits. Can you look into this ASAP?<br>
<br>
<a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17437" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17437</a><br>
<br>
llvm-lit: /home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/test/lit.site.cfg', traceback: Traceback (most recent call last):<br>
  File "/home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/utils/lit/lit/TestingConfig.py", line 88, in load_from_path<br>
    exec(compile(data, path, 'exec'), cfg_globals, None)<br>
  File "/home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/test/lit.site.cfg", line 57, in <module><br>
    lit.llvm.initialize(lit_config, config)<br>
  File "/home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/utils/lit/lit/llvm/__init__.py", line 8, in initialize<br>
  File "/home/buildslave/buildslave1a/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/utils/lit/lit/llvm/config.py", line 36, in __init__<br>
AttributeError: 'LLVMConfig' object has no attribute 'litsh'<br>
<br>
<a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/12163" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/12163</a><br>
<br>
llvm-lit.py: C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.src\utils\lit\lit\TestingConfig.py:101: fatal: unable to parse config file 'c:\\ps4-buildslave2\\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\\llvm.obj\\test\\lit.site.cfg', traceback: Traceback (most recent call last):<br>
  File "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.src\utils\lit\lit\TestingConfig.py", line 88, in load_from_path<br>
    exec(compile(data, path, 'exec'), cfg_globals, None)<br>
  File "c:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\test\lit.site.cfg", line 57, in <module><br>
    lit.llvm.initialize(lit_config, config)<br>
  File "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.src\utils\lit\lit\llvm\__init__.py", line 8, in initialize<br>
  File "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.src\utils\lit\lit\llvm\config.py", line 35, in __init__<br>
NameError: global name 'use_lit_shell' is not defined<br>
<br>
Douglas Yung<br>
<br>
> -----Original Message-----<br>
> From: llvm-commits [mailto:<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a>] On Behalf Of<br>
> Zachary Turner via llvm-commits<br>
> Sent: Saturday, September 16, 2017 11:46<br>
> To: <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> Subject: [llvm] r313467 - Resubmit "Add a shared llvm.lit module that all test<br>
> suites can use."<br>
><br>
> Author: zturner<br>
> Date: Sat Sep 16 11:46:21 2017<br>
> New Revision: 313467<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=313467&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=313467&view=rev</a><br>
> Log:<br>
> Resubmit "Add a shared llvm.lit module that all test suites can use."<br>
><br>
> There were some issues surrounding Py2 / Py3 compatibility, but I've now<br>
> tested with both Py2 and Py3 and everything seems to work.<br>
><br>
> Added:<br>
>     llvm/trunk/utils/lit/lit/llvm/<br>
>     llvm/trunk/utils/lit/lit/llvm/__init__.py<br>
>     llvm/trunk/utils/lit/lit/llvm/config.py<br>
> Modified:<br>
>     llvm/trunk/cmake/modules/AddLLVM.cmake<br>
>     llvm/trunk/test/lit.cfg<br>
>     llvm/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg.in</a><br>
>     llvm/trunk/utils/lit/lit/util.py<br>
><br>
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=313467&r1=313466&r2=313467&<br>
> view=diff<br>
> ==============================================================================<br>
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)<br>
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Sat Sep 16 11:46:21 2017<br>
> @@ -1173,6 +1173,10 @@ function(configure_lit_site_cfg input ou<br>
>      set(TARGET_TRIPLE "\"+config.target_triple+\"")<br>
>    endif()<br>
><br>
> +  string(CONCAT LIT_SITE_CFG_IN_FOOTER<br>
> +     "import lit.llvm\n"<br>
> +     "lit.llvm.initialize(lit_config, config)\n")<br>
> +<br>
>    configure_file(${input} ${output} @ONLY)<br>
>    get_filename_component(INPUT_DIR ${input} DIRECTORY)<br>
>    if (EXISTS "${INPUT_DIR}/lit.cfg")<br>
><br>
> Modified: llvm/trunk/test/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/lit.cfg?rev=313467&r1=313466&r2=313467&view=diff<br>
> ==============================================================================<br>
> --- llvm/trunk/test/lit.cfg (original)<br>
> +++ llvm/trunk/test/lit.cfg Sat Sep 16 11:46:21 2017<br>
> @@ -10,35 +10,13 @@ import subprocess<br>
><br>
>  import lit.util<br>
>  import lit.formats<br>
> +from lit.llvm import llvm_config<br>
><br>
>  # name: The name of this test suite.<br>
>  <a href="http://config.name" rel="noreferrer" target="_blank">config.name</a> = 'LLVM'<br>
><br>
> -# Tweak PATH for Win32 to decide to use bash.exe or not.<br>
> -if sys.platform in ['win32']:<br>
> -    # Seek sane tools in directories and set to $PATH.<br>
> -    path = getattr(config, 'lit_tools_dir', None)<br>
> -    path = lit_config.getToolsPath(path,<br>
> -                                   config.environment['PATH'],<br>
> -                                   ['cmp.exe', 'grep.exe', 'sed.exe'])<br>
> -    if path is not None:<br>
> -        path = os.path.pathsep.join((path,<br>
> -                                     config.environment['PATH']))<br>
> -        config.environment['PATH'] = path<br>
> -<br>
> -# Choose between lit's internal shell pipeline runner and a real shell.  If -<br>
> # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.<br>
> -use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")<br>
> -if use_lit_shell:<br>
> -    # 0 is external, "" is default, and everything else is internal.<br>
> -    execute_external = (use_lit_shell == "0")<br>
> -else:<br>
> -    # Otherwise we default to internal on Windows and external elsewhere, as<br>
> -    # bash on Windows is usually very slow.<br>
> -    execute_external = (not sys.platform in ['win32'])<br>
> -<br>
>  # testFormat: The test format to use to interpret tests.<br>
> -config.test_format = lit.formats.ShTest(execute_external)<br>
> +config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)<br>
><br>
>  # suffixes: A list of file extensions to treat as test files. This is<br>
> overriden  # by individual lit.local.cfg files in the test subdirectories.<br>
> @@ -56,57 +34,27 @@ config.test_source_root = os.path.dirnam<br>
> config.test_exec_root = os.path.join(config.llvm_obj_root, 'test')<br>
><br>
>  # Tweak the PATH to include the tools dir.<br>
> -path = os.path.pathsep.join((config.llvm_tools_dir,<br>
> config.environment['PATH'])) -config.environment['PATH'] = path<br>
> +llvm_config.with_environment('PATH', config.llvm_tools_dir,<br>
> +append_path=True)<br>
><br>
> -# Propagate 'HOME' through the environment.<br>
> -if 'HOME' in os.environ:<br>
> -    config.environment['HOME'] = os.environ['HOME']<br>
> -<br>
> -# Propagate 'INCLUDE' through the environment.<br>
> -if 'INCLUDE' in os.environ:<br>
> -    config.environment['INCLUDE'] = os.environ['INCLUDE']<br>
> -<br>
> -# Propagate 'LIB' through the environment.<br>
> -if 'LIB' in os.environ:<br>
> -    config.environment['LIB'] = os.environ['LIB']<br>
> -<br>
> -# Propagate the temp directory. Windows requires this because it uses<br>
> \Windows\ -# if none of these are present.<br>
> -if 'TMP' in os.environ:<br>
> -    config.environment['TMP'] = os.environ['TMP']<br>
> -if 'TEMP' in os.environ:<br>
> -    config.environment['TEMP'] = os.environ['TEMP']<br>
> +# Propagate some variables from the host environment.<br>
> +llvm_config.with_system_environment(['HOME', 'INCLUDE', 'LIB', 'TMP',<br>
> +'TEMP', 'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])<br>
><br>
>  # Propagate LLVM_SRC_ROOT into the environment.<br>
>  config.environment['LLVM_SRC_ROOT'] = config.llvm_src_root<br>
><br>
> -# Propagate PYTHON_EXECUTABLE into the environment -<br>
> config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',<br>
> -                                                  '')<br>
> -<br>
> -# Propagate path to symbolizer for ASan/MSan.<br>
> -for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:<br>
> -    if symbolizer in os.environ:<br>
> -        config.environment[symbolizer] = os.environ[symbolizer]<br>
> -<br>
>  # Set up OCAMLPATH to include newly built OCaml libraries.<br>
>  top_ocaml_lib = os.path.join(config.llvm_lib_dir, 'ocaml')  llvm_ocaml_lib =<br>
> os.path.join(top_ocaml_lib, 'llvm') -ocamlpath =<br>
> os.path.pathsep.join((llvm_ocaml_lib, top_ocaml_lib)) -if 'OCAMLPATH' in<br>
> os.environ:<br>
> -    ocamlpath = os.path.pathsep.join((ocamlpath, os.environ['OCAMLPATH']))<br>
> -config.environment['OCAMLPATH'] = ocamlpath<br>
> -<br>
> -if 'CAML_LD_LIBRARY_PATH' in os.environ:<br>
> -    caml_ld_library_path = os.path.pathsep.join((llvm_ocaml_lib,<br>
> -                                os.environ['CAML_LD_LIBRARY_PATH']))<br>
> -    config.environment['CAML_LD_LIBRARY_PATH'] = caml_ld_library_path<br>
> -else:<br>
> -    config.environment['CAML_LD_LIBRARY_PATH'] = llvm_ocaml_lib<br>
> +<br>
> +llvm_config.with_system_environment('OCAMLPATH')<br>
> +llvm_config.with_environment('OCAMLPATH', top_ocaml_lib,<br>
> +append_path=True) llvm_config.with_environment('OCAMLPATH',<br>
> +llvm_ocaml_lib, append_path=True)<br>
> +<br>
> +llvm_config.with_system_environment('CAML_LD_LIBRARY_PATH')<br>
> +llvm_config.with_environment('CAML_LD_LIBRARY_PATH', llvm_ocaml_lib,<br>
> +append_path=True)<br>
><br>
>  # Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.<br>
> -config.environment['OCAMLRUNPARAM'] = 'b'<br>
> +llvm_config.with_environment('OCAMLRUNPARAM', 'b')<br>
><br>
>  # Provide the path to asan runtime lib 'libclang_rt.asan_osx_dynamic.dylib'<br>
> if  # available. This is darwin specific since it's currently only needed on<br>
> darwin.<br>
> @@ -300,10 +248,6 @@ for arch in config.targets_to_build.spli<br>
><br>
>  ### Features<br>
><br>
> -# Shell execution<br>
> -if execute_external:<br>
> -    config.available_features.add('shell')<br>
> -<br>
>  # Others/can-execute.txt<br>
>  if sys.platform not in ['win32']:<br>
>      config.available_features.add('can-execute')<br>
> @@ -323,45 +267,14 @@ if loadable_module:<br>
>  if not config.build_shared_libs:<br>
>      config.available_features.add("static-libs")<br>
><br>
> -# Sanitizers.<br>
> -if 'Address' in config.llvm_use_sanitizer:<br>
> -    config.available_features.add("asan")<br>
> -else:<br>
> -    config.available_features.add("not_asan")<br>
> -if 'Memory' in config.llvm_use_sanitizer:<br>
> -    config.available_features.add("msan")<br>
> -else:<br>
> -    config.available_features.add("not_msan")<br>
> -if 'Undefined' in config.llvm_use_sanitizer:<br>
> -    config.available_features.add("ubsan")<br>
> -else:<br>
> -    config.available_features.add("not_ubsan")<br>
> -<br>
> -# Check if we should run long running tests.<br>
> -if lit_config.params.get("run_long_tests", None) == "true":<br>
> -    config.available_features.add("long_tests")<br>
> -<br>
>  # Direct object generation<br>
>  if not 'hexagon' in config.target_triple:<br>
>      config.available_features.add("object-emission")<br>
><br>
> -if config.have_zlib:<br>
> -    config.available_features.add("zlib")<br>
> -else:<br>
> -    config.available_features.add("nozlib")<br>
> -<br>
>  # LLVM can be configured with an empty default triple  # Some tests are<br>
> "generic" and require a valid default triple  if config.target_triple:<br>
>      config.available_features.add("default_triple")<br>
> -    if re.match(r'^x86_64.*-linux', config.target_triple):<br>
> -      config.available_features.add("x86_64-linux")<br>
> -<br>
> -# Native compilation: host arch == default triple arch -# FIXME: Consider<br>
> cases that target can be executed -# even if host_triple were different from<br>
> target_triple.<br>
> -if config.host_triple == config.target_triple:<br>
> -    config.available_features.add("native")<br>
><br>
>  import subprocess<br>
><br>
> @@ -416,19 +329,9 @@ def have_ld64_plugin_support():<br>
>  if have_ld64_plugin_support():<br>
>      config.available_features.add('ld64_plugin')<br>
><br>
> -# Ask llvm-config about assertion mode.<br>
> -try:<br>
> -    llvm_config_cmd = subprocess.Popen(<br>
> -        [os.path.join(config.llvm_tools_dir, 'llvm-config'), '--assertion-<br>
> mode'],<br>
> -        stdout = subprocess.PIPE,<br>
> -        env=config.environment)<br>
> -except OSError:<br>
> -    print("Could not find llvm-config in " + config.llvm_tools_dir)<br>
> -    exit(42)<br>
> -<br>
> -if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):<br>
> -    config.available_features.add('asserts')<br>
> -llvm_config_cmd.wait()<br>
> +# Ask llvm-config about asserts and global-isel.<br>
> +llvm_config.feature_config('--assertion-mode', 'asserts')<br>
> +llvm_config.feature_config('--has-global-isel', 'global-isel')<br>
><br>
>  if 'darwin' == sys.platform:<br>
>      try:<br>
> @@ -441,56 +344,12 @@ if 'darwin' == sys.platform:<br>
>          config.available_features.add('fma3')<br>
>      sysctl_cmd.wait()<br>
><br>
> -if platform.system() in ['Windows']:<br>
> -    if re.match(r'.*-win32$', config.target_triple):<br>
> -        config.available_features.add('target-windows')<br>
> -    # For tests that require Windows to run.<br>
> -    config.available_features.add('system-windows')<br>
> -<br>
>  # .debug_frame is not emitted for targeting Windows x64.<br>
>  if not re.match(r'^x86_64.*-(mingw32|windows-gnu|win32)',<br>
> config.target_triple):<br>
>      config.available_features.add('debug_frame')<br>
><br>
> -# Check if we should use gmalloc.<br>
> -use_gmalloc_str = lit_config.params.get('use_gmalloc', None) -if<br>
> use_gmalloc_str is not None:<br>
> -    if use_gmalloc_str.lower() in ('1', 'true'):<br>
> -        use_gmalloc = True<br>
> -    elif use_gmalloc_str.lower() in ('', '0', 'false'):<br>
> -        use_gmalloc = False<br>
> -    else:<br>
> -        lit_config.fatal('user parameter use_gmalloc should be 0 or 1')<br>
> -else:<br>
> -    # Default to not using gmalloc<br>
> -    use_gmalloc = False<br>
> -<br>
> -# Allow use of an explicit path for gmalloc library.<br>
> -# Will default to '/usr/lib/libgmalloc.dylib' if not set.<br>
> -gmalloc_path_str = lit_config.params.get('gmalloc_path',<br>
> -                                         '/usr/lib/libgmalloc.dylib')<br>
> -<br>
> -if use_gmalloc:<br>
> -     config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})<br>
> -<br>
> -# Ask llvm-config about global-isel.<br>
> -try:<br>
> -    llvm_config_cmd = subprocess.Popen(<br>
> -        [os.path.join(config.llvm_tools_dir, 'llvm-config'), '--has-global-<br>
> isel'],<br>
> -        stdout = subprocess.PIPE,<br>
> -        env=config.environment)<br>
> -except OSError:<br>
> -    print("Could not find llvm-config in " + config.llvm_tools_dir)<br>
> -    exit(42)<br>
> -<br>
> -if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):<br>
> -    config.available_features.add('global-isel')<br>
> -llvm_config_cmd.wait()<br>
> -<br>
>  if config.have_libxar:<br>
>      config.available_features.add('xar')<br>
><br>
> -if config.enable_abi_breaking_checks == "1":<br>
> -    config.available_features.add('abi-breaking-checks')<br>
> -<br>
>  if config.llvm_libxml2_enabled == "1":<br>
>      config.available_features.add('libxml2')<br>
><br>
> Modified: llvm/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg.in</a><br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/<a href="http://lit.site.cfg.in?rev=313467&r1=313466&r2=313467&view=di" rel="noreferrer" target="_blank">lit.site.cfg.in?rev=313467&r1=313466&r2=313467&view=di</a><br>
> ff<br>
> ==============================================================================<br>
> --- llvm/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg.in</a> (original)<br>
> +++ llvm/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg.in</a> Sat Sep 16 11:46:21 2017<br>
> @@ -52,5 +52,7 @@ except KeyError:<br>
>      key, = e.args<br>
>      lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" %<br>
> (key,key))<br>
><br>
> +@LIT_SITE_CFG_IN_FOOTER@<br>
> +<br>
>  # Let the main config do the real work.<br>
>  lit_config.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg")<br>
><br>
> Added: llvm/trunk/utils/lit/lit/llvm/__init__.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/utils/lit/lit/llvm/__init__.py?rev=313467&view=auto<br>
> ==============================================================================<br>
> --- llvm/trunk/utils/lit/lit/llvm/__init__.py (added)<br>
> +++ llvm/trunk/utils/lit/lit/llvm/__init__.py Sat Sep 16 11:46:21 2017<br>
> @@ -0,0 +1,9 @@<br>
> +<br>
> +from lit.llvm import config<br>
> +<br>
> +llvm_config = None<br>
> +<br>
> +def initialize(lit_config, test_config):<br>
> +    global llvm_config<br>
> +    llvm_config = config.LLVMConfig(lit_config, test_config)<br>
> +<br>
><br>
> Added: llvm/trunk/utils/lit/lit/llvm/config.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/utils/lit/lit/llvm/config.py?rev=313467&view=auto<br>
> ==============================================================================<br>
> --- llvm/trunk/utils/lit/lit/llvm/config.py (added)<br>
> +++ llvm/trunk/utils/lit/lit/llvm/config.py Sat Sep 16 11:46:21 2017<br>
> @@ -0,0 +1,117 @@<br>
> +import os<br>
> +import re<br>
> +import subprocess<br>
> +import sys<br>
> +<br>
> +import lit.util<br>
> +<br>
> +# Choose between lit's internal shell pipeline runner and a real shell.<br>
> +If # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an<br>
> override.<br>
> +litshenv = os.environ.get("LIT_USE_INTERNAL_SHELL")<br>
> +litsh = lit.util.pythonize_bool(litshenv) if litshenv else<br>
> +(sys.platform == 'win32')<br>
> +<br>
> +def binary_feature(on, feature, off_prefix):<br>
> +    return feature if on else off_prefix + feature<br>
> +<br>
> +class LLVMConfig(object):<br>
> +<br>
> +    def __init__(self, lit_config, config):<br>
> +        self.lit_config = lit_config<br>
> +        self.config = config<br>
> +<br>
> +        features = config.available_features<br>
> +<br>
> +        # Tweak PATH for Win32 to decide to use bash.exe or not.<br>
> +        if sys.platform == 'win32':<br>
> +            # For tests that require Windows to run.<br>
> +            features.add('system-windows')<br>
> +<br>
> +            # Seek sane tools in directories and set to $PATH.<br>
> +            path = self.lit_config.getToolsPath(config.lit_tools_dir,<br>
> +                                           config.environment['PATH'],<br>
> +                                           ['cmp.exe', 'grep.exe',<br>
> 'sed.exe'])<br>
> +            self.with_environment('PATH', path, append_path=True)<br>
> +<br>
> +        self.use_lit_shell = litsh<br>
> +        if not self.use_lit_shell:<br>
> +            features.add('shell')<br>
> +<br>
> +        # Native compilation: host arch == default triple arch<br>
> +        # FIXME: Consider cases that target can be executed<br>
> +        # even if host_triple were different from target_triple.<br>
> +        if config.host_triple == config.target_triple:<br>
> +            features.add("native")<br>
> +<br>
> +        # Sanitizers.<br>
> +        sanitizers = frozenset(x.lower() for x in getattr(config,<br>
> 'llvm_use_sanitizer', []).split(';'))<br>
> +        features.add(binary_feature('address' in sanitizers, 'asan', 'not_'))<br>
> +        features.add(binary_feature('memory' in sanitizers, 'msan', 'not_'))<br>
> +        features.add(binary_feature('undefined' in sanitizers, 'ubsan',<br>
> + 'not_'))<br>
> +<br>
> +        have_zlib = getattr(config, 'have_zlib', None)<br>
> +        features.add(binary_feature(have_zlib, 'zlib', 'no'))<br>
> +<br>
> +        # Check if we should run long running tests.<br>
> +        long_tests = lit_config.params.get("run_long_tests", None)<br>
> +        if lit.util.pythonize_bool(long_tests):<br>
> +            features.add("long_tests")<br>
> +<br>
> +        target_triple = getattr(config, 'target_triple', None)<br>
> +        if target_triple:<br>
> +            if re.match(r'^x86_64.*-linux', target_triple):<br>
> +                features.add("x86_64-linux")<br>
> +            if re.match(r'.*-win32$', target_triple):<br>
> +                features.add('target-windows')<br>
> +<br>
> +        use_gmalloc = lit_config.params.get('use_gmalloc', None)<br>
> +        if lit.util.pythonize_bool(use_gmalloc):<br>
> +            # Allow use of an explicit path for gmalloc library.<br>
> +            # Will default to '/usr/lib/libgmalloc.dylib' if not set.<br>
> +            gmalloc_path_str = lit_config.params.get('gmalloc_path',<br>
> +<br>
> '/usr/lib/libgmalloc.dylib')<br>
> +            if gmalloc_path_str is not None:<br>
> +                self.with_environment('DYLD_INSERT_LIBRARIES',<br>
> + gmalloc_path_str)<br>
> +<br>
> +        breaking_checks = getattr(config, 'enable_abi_breaking_checks', None)<br>
> +        if lit.util.pythonize_bool(breaking_checks):<br>
> +            features.add('abi-breaking-checks')<br>
> +<br>
> +    def with_environment(self, variable, value, append_path = False):<br>
> +        if append_path and variable in self.config.environment:<br>
> +            def norm(x):<br>
> +                return os.path.normcase(os.path.normpath(x))<br>
> +<br>
> +            # Move it to the front if it already exists, otherwise insert it<br>
> at the<br>
> +            # beginning.<br>
> +            value = norm(value)<br>
> +            current_value = self.config.environment[variable]<br>
> +            items = [norm(x) for x in current_value.split(os.path.pathsep)]<br>
> +            try:<br>
> +                items.remove(value)<br>
> +            except ValueError:<br>
> +                pass<br>
> +            value = os.path.pathsep.join([value] + items)<br>
> +        self.config.environment[variable] = value<br>
> +<br>
> +<br>
> +    def with_system_environment(self, variables, append_path = False):<br>
> +        if lit.util.is_string(variables):<br>
> +            variables = [variables]<br>
> +        for v in variables:<br>
> +            value = os.environ.get(v)<br>
> +            if value:<br>
> +                self.with_environment(v, value, append_path)<br>
> +<br>
> +    def feature_config(self, flag, feature):<br>
> +        # Ask llvm-config about assertion mode.<br>
> +        try:<br>
> +            llvm_config_cmd = subprocess.Popen(<br>
> +                [os.path.join(self.config.llvm_tools_dir, 'llvm-config'),<br>
> flag],<br>
> +                stdout = subprocess.PIPE,<br>
> +                env=self.config.environment)<br>
> +        except OSError:<br>
> +            self.lit_config.fatal("Could not find llvm-config in " +<br>
> + self.config.llvm_tools_dir)<br>
> +<br>
> +        output, _ = llvm_config_cmd.communicate()<br>
> +        if re.search(r'ON', output.decode('ascii')):<br>
> +            self.config.available_features.add(feature)<br>
><br>
> Modified: llvm/trunk/utils/lit/lit/util.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/utils/lit/lit/util.py?rev=313467&r1=313466&r2=313467&view=d<br>
> iff<br>
> ==============================================================================<br>
> --- llvm/trunk/utils/lit/lit/util.py (original)<br>
> +++ llvm/trunk/utils/lit/lit/util.py Sat Sep 16 11:46:21 2017<br>
> @@ -1,6 +1,7 @@<br>
>  import errno<br>
>  import itertools<br>
>  import math<br>
> +import numbers<br>
>  import os<br>
>  import platform<br>
>  import signal<br>
> @@ -8,6 +9,28 @@ import subprocess<br>
>  import sys<br>
>  import threading<br>
><br>
> +def is_string(value):<br>
> +    try:<br>
> +        # Python 2 and Python 3 are different here.<br>
> +        return isinstance(value, basestring)<br>
> +    except NameError:<br>
> +        return isinstance(value, str)<br>
> +<br>
> +def pythonize_bool(value):<br>
> +    if value is None:<br>
> +        return False<br>
> +    if type(value) is bool:<br>
> +        return value<br>
> +    if isinstance(value, numbers.Number):<br>
> +        return value != 0<br>
> +    if is_string(value):<br>
> +        if value.lower() in ('1', 'true', 'on', 'yes'):<br>
> +            return True<br>
> +        if value.lower() in ('', '0', 'false', 'off', 'no'):<br>
> +            return False<br>
> +    raise ValueError('"{}" is not a valid boolean'.format(value))<br>
> +<br>
> +<br>
>  def to_bytes(s):<br>
>      """Return the parameter as type 'bytes', possibly encoding it.<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></blockquote></div>