[llvm] 6863282 - Revert "[sanitizer] Use COMPILER_RT_EMULATOR with gtests"
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 22 11:16:06 PDT 2021
Author: Vitaly Buka
Date: 2021-04-22T11:15:55-07:00
New Revision: 686328263e856deeba2494520836d77fa503817c
URL: https://github.com/llvm/llvm-project/commit/686328263e856deeba2494520836d77fa503817c
DIFF: https://github.com/llvm/llvm-project/commit/686328263e856deeba2494520836d77fa503817c.diff
LOG: Revert "[sanitizer] Use COMPILER_RT_EMULATOR with gtests"
Missed review comments.
This reverts commit e25082961cb5aaafc817cb55593cf0ea8d3c4c22.
Added:
Modified:
compiler-rt/unittests/lit.common.unit.cfg.py
compiler-rt/unittests/lit.common.unit.configured.in
llvm/utils/lit/lit/formats/googletest.py
Removed:
################################################################################
diff --git a/compiler-rt/unittests/lit.common.unit.cfg.py b/compiler-rt/unittests/lit.common.unit.cfg.py
index a0e2ca26ee848..fba034ae4fce2 100644
--- a/compiler-rt/unittests/lit.common.unit.cfg.py
+++ b/compiler-rt/unittests/lit.common.unit.cfg.py
@@ -8,25 +8,9 @@
import lit.formats
-import shlex
-
-# Copied from libcxx's config.py
-def get_lit_conf(name, default=None):
- # Allow overriding on the command line using --param=<name>=<val>
- val = lit_config.params.get(name, None)
- if val is None:
- val = getattr(config, name, None)
- if val is None:
- val = default
- return val
-
-emulator = get_lit_conf('emulator', None)
-if emulator:
- emulator = shlex.split(emulator)
-
# Setup test format
llvm_build_mode = getattr(config, "llvm_build_mode", "Debug")
-config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test", emulator)
+config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test")
# Setup test suffixes.
config.suffixes = []
diff --git a/compiler-rt/unittests/lit.common.unit.configured.in b/compiler-rt/unittests/lit.common.unit.configured.in
index 29e1615ff28d2..d959d43989cad 100644
--- a/compiler-rt/unittests/lit.common.unit.configured.in
+++ b/compiler-rt/unittests/lit.common.unit.configured.in
@@ -12,7 +12,6 @@ config.host_arch = "@HOST_ARCH@"
config.host_os = "@HOST_OS@"
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
config.gwp_asan = @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@
-config.emulator = "@COMPILER_RT_EMULATOR@"
# LLVM tools dir and build mode can be passed in lit parameters,
# so try to apply substitution.
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 04da2e9cef7a0..059eb99762e99 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -11,7 +11,7 @@
kIsWindows = sys.platform in ['win32', 'cygwin']
class GoogleTest(TestFormat):
- def __init__(self, test_sub_dirs, test_suffix, run_under = []):
+ def __init__(self, test_sub_dirs, test_suffix):
self.test_sub_dirs = str(test_sub_dirs).split(';')
# On Windows, assume tests will also end in '.exe'.
@@ -21,7 +21,6 @@ def __init__(self, test_sub_dirs, test_suffix, run_under = []):
# Also check for .py files for testing purposes.
self.test_suffixes = {exe_suffix, test_suffix + '.py'}
- self.run_under = run_under
def getGTestTests(self, path, litConfig, localConfig):
"""getGTestTests(path) - [name]
@@ -33,7 +32,7 @@ def getGTestTests(self, path, litConfig, localConfig):
litConfig: LitConfig instance
localConfig: TestingConfig instance"""
- list_test_cmd = self.prepareCmd([path, '--gtest_list_tests'])
+ list_test_cmd = self.maybeAddPythonToCmd([path, '--gtest_list_tests'])
try:
output = subprocess.check_output(list_test_cmd,
@@ -114,7 +113,7 @@ def execute(self, test, litConfig):
testName = namePrefix + '/' + testName
cmd = [testPath, '--gtest_filter=' + testName]
- cmd = self.prepareCmd(cmd)
+ cmd = self.maybeAddPythonToCmd(cmd)
if litConfig.useValgrind:
cmd = litConfig.valgrindArgs + cmd
@@ -142,17 +141,13 @@ def execute(self, test, litConfig):
return lit.Test.PASS,''
- def prepareCmd(self, cmd):
- """Insert interpreter if needed.
+ def maybeAddPythonToCmd(self, cmd):
+ """Insert the python exe into the command if cmd[0] ends in .py
- It inserts the python exe into the command if cmd[0] ends in .py or caller
- specified run_under.
We cannot rely on the system to interpret shebang lines for us on
Windows, so add the python executable to the command if this is a .py
script.
"""
if cmd[0].endswith('.py'):
- cmd = [sys.executable] + cmd
- if self.run_under:
- cmd = self.run_under + cmd
+ return [sys.executable] + cmd
return cmd
More information about the llvm-commits
mailing list