diff options
author | Zachary Turner <zturner@google.com> | 2017-09-15 00:56:08 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-09-15 00:56:08 +0000 |
commit | 7f9c0ce1bb5e9e58b9e1bbafe182edd0ee760b39 (patch) | |
tree | 1a0f129eac5e9c838c22c9fe62fdd3233e16c72c /llvm/utils | |
parent | e9632ebab351b55cd0d400752288db7461bb2af4 (diff) | |
download | bcm5719-llvm-7f9c0ce1bb5e9e58b9e1bbafe182edd0ee760b39.tar.gz bcm5719-llvm-7f9c0ce1bb5e9e58b9e1bbafe182edd0ee760b39.zip |
[lit] Revert "Add a lit.llvm module that all llvm projects can use"
This is breaking due to some changes I forgot to merge in, so I'm
temporarily reverting them until I can re-test that this works.
llvm-svn: 313328
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/lit/lit/llvm/__init__.py | 9 | ||||
-rw-r--r-- | llvm/utils/lit/lit/llvm/config.py | 117 | ||||
-rw-r--r-- | llvm/utils/lit/lit/util.py | 16 |
3 files changed, 0 insertions, 142 deletions
diff --git a/llvm/utils/lit/lit/llvm/__init__.py b/llvm/utils/lit/lit/llvm/__init__.py deleted file mode 100644 index c4cad04649f..00000000000 --- a/llvm/utils/lit/lit/llvm/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ - -from lit.llvm import config - -llvm_config = None - -def initialize(lit_config, test_config): - global llvm_config - llvm_config = config.LLVMConfig(lit_config, test_config) - diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py deleted file mode 100644 index 63f85ed28b7..00000000000 --- a/llvm/utils/lit/lit/llvm/config.py +++ /dev/null @@ -1,117 +0,0 @@ -import os -import re -import subprocess -import sys - -import lit.util - -# 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. -litshenv = os.environ.get("LIT_USE_INTERNAL_SHELL") -litsh = lit.util.pythonize_bool(litshenv) if litshenv else (sys.platform == 'win32') - -def binary_feature(on, feature, off_prefix): - return feature if on else off_prefix + feature - -class LLVMConfig(object): - - def __init__(self, lit_config, config): - self.lit_config = lit_config - self.config = config - - features = config.available_features - - # Tweak PATH for Win32 to decide to use bash.exe or not. - if sys.platform == 'win32': - # For tests that require Windows to run. - features.add('system-windows') - - # Seek sane tools in directories and set to $PATH. - path = self.lit_config.getToolsPath(config.lit_tools_dir, - config.environment['PATH'], - ['cmp.exe', 'grep.exe', 'sed.exe']) - self.with_environment('PATH', path, append_path=True) - - self.use_lit_shell = litsh - if not self.litsh: - features.add('shell') - - # Native compilation: host arch == default triple arch - # FIXME: Consider cases that target can be executed - # even if host_triple were different from target_triple. - if config.host_triple == config.target_triple: - features.add("native") - - # Sanitizers. - sanitizers = frozenset(x.lower() for x in getattr(config, 'llvm_use_sanitizer', []).split(';')) - features.add(binary_feature('address' in sanitizers, 'asan', 'not_')) - features.add(binary_feature('memory' in sanitizers, 'msan', 'not_')) - features.add(binary_feature('undefined' in sanitizers, 'ubsan', 'not_')) - - have_zlib = getattr(config, 'have_zlib', None) - features.add(binary_feature(have_zlib, 'zlib', 'no')) - - # Check if we should run long running tests. - long_tests = lit_config.params.get("run_long_tests", None) - if lit.util.pythonize_bool(long_tests): - features.add("long_tests") - - target_triple = getattr(config, 'target_triple', None) - if target_triple: - if re.match(r'^x86_64.*-linux', target_triple): - features.add("x86_64-linux") - if re.match(r'.*-win32$', target_triple): - features.add('target-windows') - - use_gmalloc = lit_config.params.get('use_gmalloc', None) - if lit.util.pythonize_bool(use_gmalloc): - # Allow use of an explicit path for gmalloc library. - # Will default to '/usr/lib/libgmalloc.dylib' if not set. - gmalloc_path_str = lit_config.params.get('gmalloc_path', - '/usr/lib/libgmalloc.dylib') - if gmalloc_path_str is not None: - self.with_environment('DYLD_INSERT_LIBRARIES', gmalloc_path_str) - - breaking_checks = getattr(config, 'enable_abi_breaking_checks') - if lit.util.pythonize_bool(lit_config, breaking_checks): - features.add('abi-breaking-checks') - - def with_environment(self, variable, value, append_path = False): - if append_path and variable in self.config.environment: - def norm(x): - return os.path.normcase(os.path.normpath(x)) - - # Move it to the front if it already exists, otherwise insert it at the - # beginning. - value = norm(value) - current_value = self.config.environment[variable] - items = [norm(x) for x in current_value.split(os.path.pathsep)] - try: - items.remove(value) - except ValueError: - pass - value = os.path.pathsep.join([value] + items) - self.config.environment[variable] = value - - - def with_system_environment(self, variables, append_path = False): - if isinstance(variables, basestring): - variables = [variables] - for v in variables: - value = os.environ.get(v) - if value: - self.with_environment(v, value, append_path) - - def feature_config(self, flag, feature): - # Ask llvm-config about assertion mode. - try: - llvm_config_cmd = subprocess.Popen( - [os.path.join(self.config.llvm_tools_dir, 'llvm-config'), flag], - stdout = subprocess.PIPE, - env=self.config.environment) - except OSError: - self.lit_config.fatal("Could not find llvm-config in " + self.config.llvm_tools_dir) - - output, _ = llvm_config_cmd.communicate() - if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')): - self.config.available_features.add(feature) diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py index b171a0ec36f..1819d4d1c34 100644 --- a/llvm/utils/lit/lit/util.py +++ b/llvm/utils/lit/lit/util.py @@ -8,22 +8,6 @@ import subprocess import sys import threading - -def pythonize_bool(value): - if value is None: - return False - if type(value) is bool: - return value - if isinstance(value, (int, long)): - return value != 0 - if isinstance(value, basestring): - if value.lower() in ('1', 'true', 'on', 'yes'): - return True - if value.lower() in ('0', 'false', 'off', 'no'): - return False - raise ValueError('"{}" is not a valid boolean'.format(value)) - - def to_bytes(s): """Return the parameter as type 'bytes', possibly encoding it. |