[libunwind] 96e6cbb - [libc++] Allow specifying arbitrary custom executors with the new format
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 13:24:45 PDT 2020
Author: Louis Dionne
Date: 2020-06-11T16:24:29-04:00
New Revision: 96e6cbbf941d0f937b7e823433d4c222967a1817
URL: https://github.com/llvm/llvm-project/commit/96e6cbbf941d0f937b7e823433d4c222967a1817
DIFF: https://github.com/llvm/llvm-project/commit/96e6cbbf941d0f937b7e823433d4c222967a1817.diff
LOG: [libc++] Allow specifying arbitrary custom executors with the new format
The integration between CMake and executor selection in the new format
wasn't very flexible -- only the default executor and SSH executors were
supported.
This patch makes it possible to specify arbitrary executors with the new
format. With the new testing format, a custom executor is just a script
that gets called with a command-line to execute, and some arguments like
--env, --codesign_identity and --execdir. As such, the default executor
is just run.py.
Remote execution with the SSH executor can be achived by specifying
LIBCXX_EXECUTOR="<path-to-ssh.py> --host <host>". Similarly, arbitrary
scripts can be provided.
Added:
Modified:
libcxx/test/CMakeLists.txt
libcxx/utils/libcxx/test/config.py
libcxxabi/test/CMakeLists.txt
libunwind/test/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 5068cbd1b1b0..b68f59f38e76 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -81,7 +81,7 @@ endif()
set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
-set(LIBCXX_EXECUTOR "None" CACHE STRING
+set(LIBCXX_EXECUTOR "${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/../utils/run.py" CACHE STRING
"Executor to use when running tests.")
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 5eccc2783a74..44cb95943877 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -189,18 +189,22 @@ def get_test_format(self):
exec_env=self.exec_env)
def configure_executor(self):
- exec_str = self.get_lit_conf('executor', "None")
- te = eval(exec_str)
- if te:
- self.lit_config.note("Using executor: %r" % exec_str)
- if self.lit_config.useValgrind:
- self.lit_config.fatal("The libc++ test suite can't run under Valgrind with a custom executor")
- else:
- te = LocalExecutor()
+ if self.get_lit_conf('use_old_format'):
+ exec_str = self.get_lit_conf('executor', "None")
+ te = eval(exec_str)
+ if te:
+ self.lit_config.note("Using executor: %r" % exec_str)
+ if self.lit_config.useValgrind:
+ self.lit_config.fatal("The libc++ test suite can't run under Valgrind with a custom executor")
+ else:
+ te = LocalExecutor()
- te.target_info = self.target_info
- self.target_info.executor = te
- self.executor = te
+ te.target_info = self.target_info
+ self.target_info.executor = te
+ self.executor = te
+ else:
+ self.executor = self.get_lit_conf('executor')
+ self.lit_config.note("Using executor: {}".format(self.executor))
def configure_target_info(self):
self.target_info = make_target_info(self)
@@ -751,14 +755,8 @@ def configure_substitutions(self):
'--codesign_identity "{}"'.format(codesign_ident),
'--env {}'.format(env_vars)
]
- if isinstance(self.executor, SSHExecutor):
- exec_args.append('--host {}'.format(self.executor.user_prefix + self.executor.host))
- executor = os.path.join(self.libcxx_src_root, 'utils', 'ssh.py')
- else:
- executor = os.path.join(self.libcxx_src_root, 'utils', 'run.py')
- sub.append(('%{exec}', '{} {} {} -- '.format(pipes.quote(sys.executable),
- pipes.quote(executor),
- ' '.join(exec_args))))
+ if not self.get_lit_conf('use_old_format'):
+ sub.append(('%{exec}', '{} {} -- '.format(self.executor, ' '.join(exec_args))))
if self.get_lit_conf('libcxx_gdb'):
sub.append(('%{libcxx_gdb}', self.get_lit_conf('libcxx_gdb')))
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index bedfce8bc397..2160f52c3350 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -32,7 +32,7 @@ if(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX AND NOT LIBCXX_ENABLE_SHARED)
endif()
if(DEFINED LIBCXX_ENABLE_STATIC
- AND NOT LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX
+ AND NOT LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX
AND NOT LIBCXX_ENABLE_STATIC)
message(FATAL_ERROR "LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX being OFF requires LIBCXX_ENABLE_STATIC to be ON")
endif()
@@ -50,7 +50,7 @@ pythonize_bool(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX)
pythonize_bool(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI)
set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
-set(LIBCXXABI_EXECUTOR "None" CACHE STRING
+set(LIBCXXABI_EXECUTOR "${Python3_EXECUTABLE} ${LIBCXXABI_LIBCXX_PATH}/utils/run.py" CACHE STRING
"Executor to use when running tests.")
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index e608c1708b8a..26e7842b7a1f 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -20,7 +20,8 @@ pythonize_bool(LIBUNWIND_USE_COMPILER_RT)
pythonize_bool(LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY)
set(LIBUNWIND_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
-set(LIBUNWIND_EXECUTOR "None" CACHE STRING
+set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../../libcxx")
+set(LIBUNWIND_EXECUTOR "${Python3_EXECUTABLE} ${LIBUNWIND_LIBCXX_PATH}/utils/run.py" CACHE STRING
"Executor to use when running tests.")
set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not edit!")
More information about the cfe-commits
mailing list