[libcxx-commits] [PATCH] D88899: [libcxx][executors] Add a --wrapper-command flag to prepend a command
Alexander Richardson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 6 06:46:08 PDT 2020
arichardson created this revision.
arichardson added reviewers: libc++, ldionne.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
arichardson requested review of this revision.
This can be used to run tests under GDB/LLDB/Valgrind/qemu-user etc.
A follow-up change will use this flag to enable running all tests under
GDB (printing a backtrace on crashes).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88899
Files:
libcxx/utils/run.py
libcxx/utils/ssh.py
Index: libcxx/utils/ssh.py
===================================================================
--- libcxx/utils/ssh.py
+++ libcxx/utils/ssh.py
@@ -45,6 +45,7 @@
parser.add_argument('--extra-scp-args', type=str, required=False)
parser.add_argument('--codesign_identity', type=str, required=False, default=None)
parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
+ parser.add_argument('--wrapper-command', type=str, required=False, default=None)
parser.add_argument("command", nargs=argparse.ONE_OR_MORE)
args = parser.parse_args()
commandLine = args.command
@@ -104,6 +105,9 @@
# host by transforming the path of test-executables to their path in the
# temporary directory on the remote host.
commandLine = (pathOnRemote(x) if isTestExe(x) else x for x in commandLine)
+ # Prepend the wrapper command to allow running under GDB/LLDB/valgrind/qemu-user/etc.
+ if args.wrapper_command:
+ commandLine = shlex.split(args.wrapper_command) + list(commandLine)
remoteCommands.append('cd {}'.format(tmp))
if args.env:
remoteCommands.append('export {}'.format(' '.join(args.env)))
Index: libcxx/utils/run.py
===================================================================
--- libcxx/utils/run.py
+++ libcxx/utils/run.py
@@ -14,6 +14,7 @@
"""
import argparse
+import shlex
import subprocess
import sys
@@ -23,6 +24,7 @@
parser.add_argument('--execdir', type=str, required=True)
parser.add_argument('--codesign_identity', type=str, required=False, default=None)
parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
+ parser.add_argument('--wrapper-command', type=str, required=False, default=None)
parser.add_argument("command", nargs=argparse.ONE_OR_MORE)
args = parser.parse_args()
commandLine = args.command
@@ -38,6 +40,9 @@
# Extract environment variables into a dictionary
env = {k : v for (k, v) in map(lambda s: s.split('=', 1), args.env)}
+ # Prepend the wrapper command to allow running under GDB/LLDB/valgrind/qemu-user/etc.
+ if args.wrapper_command:
+ commandLine = shlex.split(args.wrapper_command) + commandLine
# Run the command line with the given environment in the execution directory.
return subprocess.call(subprocess.list2cmdline(commandLine), cwd=args.execdir, env=env, shell=True)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88899.296445.patch
Type: text/x-patch
Size: 2452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201006/6f09ed15/attachment-0001.bin>
More information about the libcxx-commits
mailing list