[libcxx-commits] [libcxx] 9223b7f - [libc++] Add a new %exec substitution
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 25 13:27:11 PDT 2020
Author: Louis Dionne
Date: 2020-03-25T16:26:57-04:00
New Revision: 9223b7f927eb95cdf86fb73abd1b0ebf8be3fd52
URL: https://github.com/llvm/llvm-project/commit/9223b7f927eb95cdf86fb73abd1b0ebf8be3fd52
DIFF: https://github.com/llvm/llvm-project/commit/9223b7f927eb95cdf86fb73abd1b0ebf8be3fd52.diff
LOG: [libc++] Add a new %exec substitution
It allows executing arbitrary commands with the same environment as
normal .pass.cpp tests, which is handy.
Added:
libcxx/test/libcxx/selftest/exec.sh.cpp
Modified:
libcxx/utils/libcxx/test/config.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/selftest/exec.sh.cpp b/libcxx/test/libcxx/selftest/exec.sh.cpp
new file mode 100644
index 000000000000..68868136a696
--- /dev/null
+++ b/libcxx/test/libcxx/selftest/exec.sh.cpp
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// RUN: %build
+// RUN: %exec %t.exe "HELLO"
+
+#include <cassert>
+#include <string>
+
+int main(int argc, char** argv) {
+ assert(argc == 2);
+
+ std::string arg = argv[1];
+ assert(arg == "HELLO");
+ return 0;
+}
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index a9a353916a9c..1931986d8ad0 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -1080,10 +1080,12 @@ def configure_substitutions(self):
codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
run_py = os.path.join(self.libcxx_src_root, 'utils', 'run.py')
env_vars = ' '.join('%s=%s' % (k, pipes.quote(v)) for (k, v) in self.exec_env.items())
- run_str = '%s %s --codesign_identity "%s" --working_directory "%%S" ' \
- '--dependencies %%file_dependencies --env %s -- %%t.exe' % \
+ exec_str = '%s %s --codesign_identity "%s" --working_directory "%%S" ' \
+ '--dependencies %%file_dependencies --env %s -- ' % \
(pipes.quote(sys.executable), pipes.quote(run_py),
codesign_ident, env_vars)
+ run_str = exec_str + '%t.exe'
+ sub.append(('%exec', exec_str))
sub.append(('%run', run_str))
# Configure not program substitutions
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not.py')
More information about the libcxx-commits
mailing list