summaryrefslogtreecommitdiff
path: root/utils/lit/lit
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-16 00:52:49 +0000
committerZachary Turner <zturner@google.com>2017-09-16 00:52:49 +0000
commit591b934d84e2923399e845fc0491df53bc519efa (patch)
tree82d4c4f798a174e8eb3e10c190d9b1b50b519789 /utils/lit/lit
parent493ab405d6b7f1156c73cc16eb6f6e6544b03d2c (diff)
Revert lit changes related to lit.llvm module.
It looks like this is going to be non-trivial to get working in both Py2 and Py3, so for now I'm reverting until I have time to fully test it under Python 3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit/lit')
-rw-r--r--utils/lit/lit/llvm/__init__.py9
-rw-r--r--utils/lit/lit/llvm/config.py117
-rw-r--r--utils/lit/lit/util.py24
3 files changed, 0 insertions, 150 deletions
diff --git a/utils/lit/lit/llvm/__init__.py b/utils/lit/lit/llvm/__init__.py
deleted file mode 100644
index c4cad04649f..00000000000
--- a/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/utils/lit/lit/llvm/config.py b/utils/lit/lit/llvm/config.py
deleted file mode 100644
index 6692904079f..00000000000
--- a/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.use_lit_shell:
- 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', None)
- if lit.util.pythonize_bool(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', output.decode('ascii')):
- self.config.available_features.add(feature)
diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py
index c36dd589246..1819d4d1c34 100644
--- a/utils/lit/lit/util.py
+++ b/utils/lit/lit/util.py
@@ -1,7 +1,6 @@
import errno
import itertools
import math
-import numbers
import os
import platform
import signal
@@ -9,29 +8,6 @@ import subprocess
import sys
import threading
-
-def pythonize_bool(value):
- def is_string(value):
- try:
- # Python 2 and Python 3 are different here.
- return isinstance(value, basestring)
- except NameError:
- return isinstance(value, str)
-
- if value is None:
- return False
- if type(value) is bool:
- return value
- if isinstance(value, numbers.Number):
- return value != 0
- if is_string(value):
- 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.