Lit: Add IsWindows variable.

This commit is contained in:
Frederich Munch 2017-02-17 21:58:22 -05:00 committed by sftnight
parent 42971e42cd
commit 2a41c186d8

View File

@ -9,6 +9,8 @@ import re
import lit.util
import lit.formats
IsWindows = platform.system() == 'Windows'
# Choose between lit's internal shell pipeline runner and a real shell. If
# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
@ -18,9 +20,9 @@ if use_lit_shell:
else:
# Otherwise we default to internal on Windows and external elsewhere, as
# bash on Windows is usually very slow.
execute_external = (not sys.platform in ['win32'])
execute_external = not IsWindows
if platform.system() == 'Windows' and not execute_external:
if IsWindows and not execute_external:
# Use real Windows path separators so if a test fails, one can copy/paste cmds
def fixupPath(path):
return os.path.normpath(path)
@ -31,7 +33,7 @@ else:
# name: The name of this test suite.
config.name = 'Cling'
# Tweak PATH for Win32
if platform.system() == 'Windows':
if IsWindows:
# Seek sane tools in directories and set to $PATH.
path = getattr(config, 'lit_tools_dir', None)
path = lit_config.getToolsPath(path,
@ -122,7 +124,7 @@ if config.test_exec_root is None:
cling_obj_root = os.path.join(llvm_obj_root, "tools", "cling")
# Windows CMake cling_obj_root can be (is?) <build>/<Config>, we want <build>
if platform.system() == 'Windows' and not os.path.exists(cling_obj_root):
if IsWindows and not os.path.exists(cling_obj_root):
cling_obj_root = os.path.join(os.path.dirname(llvm_obj_root), "tools", "cling")
# Validate that we got a tree which points to here, using the standard
@ -277,7 +279,7 @@ if platform.system() in ['Windows']:
else:
config.substitutions.append(('%dllexport', ''))
if platform.system() == 'Windows' and execute_external:
if IsWindows and execute_external:
config.substitutions.append(('%mkdir', 'mkdir'))
config.substitutions.append(('%rmdir', 'rmdir /s /q'))
config.substitutions.append(('%rm', 'del /s /q'))