A couple Makefile-related tweaks
- Changed --(tool)-tool to --(tool)-path in scripts, this seems to be a more common name for this sort of flag. - Changed BUILDDIR to not have implicit slash, makes Makefile internals a bit more readable. - Fixed some outdated names hidden in less-often used ifdefs.
This commit is contained in:
+20
-18
@@ -30,8 +30,8 @@ import toml
|
||||
RUNNER_PATH = './runners/bench_runner'
|
||||
HEADER_PATH = 'runners/bench_runner.h'
|
||||
|
||||
GDB_TOOL = ['gdb']
|
||||
VALGRIND_TOOL = ['valgrind']
|
||||
GDB_PATH = ['gdb']
|
||||
VALGRIND_PATH = ['valgrind']
|
||||
PERF_SCRIPT = ['./scripts/perf.py']
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ def find_runner(runner, **args):
|
||||
|
||||
# run under valgrind?
|
||||
if args.get('valgrind'):
|
||||
cmd[:0] = args['valgrind_tool'] + [
|
||||
cmd[:0] = args['valgrind_path'] + [
|
||||
'--leak-check=full',
|
||||
'--track-origins=yes',
|
||||
'--error-exitcode=4',
|
||||
@@ -518,8 +518,8 @@ def find_runner(runner, **args):
|
||||
if args.get('perf_period') else None,
|
||||
'--perf-events=%s' % args['perf_events']
|
||||
if args.get('perf_events') else None,
|
||||
'--perf-tool=%s' % args['perf_tool']
|
||||
if args.get('perf_tool') else None,
|
||||
'--perf-path=%s' % args['perf_path']
|
||||
if args.get('perf_path') else None,
|
||||
'-o%s' % args['perf']]))
|
||||
|
||||
# other context
|
||||
@@ -1144,24 +1144,24 @@ def run(runner, bench_ids=[], **args):
|
||||
cmd = runner_ + [failure.id]
|
||||
|
||||
if args.get('gdb_main'):
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'break main',
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
elif args.get('gdb_case'):
|
||||
path, lineno = find_path(runner_, failure.id, **args)
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'break %s:%d' % (path, lineno),
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
elif failure.assert_ is not None:
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'run',
|
||||
'-ex', 'frame function raise',
|
||||
'-ex', 'up 2',
|
||||
'--args']
|
||||
else:
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
|
||||
@@ -1345,10 +1345,11 @@ if __name__ == "__main__":
|
||||
help="Drop into gdb on bench failure but stop at the beginning "
|
||||
"of main.")
|
||||
bench_parser.add_argument(
|
||||
'--gdb-tool',
|
||||
'--gdb-path',
|
||||
type=lambda x: x.split(),
|
||||
default=GDB_TOOL,
|
||||
help="Path to gdb tool to use. Defaults to %r." % GDB_TOOL)
|
||||
default=GDB_PATH,
|
||||
help="Path to the gdb executable, may include flags. "
|
||||
"Defaults to %r." % GDB_PATH)
|
||||
bench_parser.add_argument(
|
||||
'--exec',
|
||||
type=lambda e: e.split(),
|
||||
@@ -1359,10 +1360,11 @@ if __name__ == "__main__":
|
||||
help="Run under Valgrind to find memory errors. Implicitly sets "
|
||||
"--isolate.")
|
||||
bench_parser.add_argument(
|
||||
'--valgrind-tool',
|
||||
'--valgrind-path',
|
||||
type=lambda x: x.split(),
|
||||
default=VALGRIND_TOOL,
|
||||
help="Path to Valgrind tool to use. Defaults to %r." % VALGRIND_TOOL)
|
||||
default=VALGRIND_PATH,
|
||||
help="Path to the Valgrind executable, may include flags. "
|
||||
"Defaults to %r." % VALGRIND_PATH)
|
||||
bench_parser.add_argument(
|
||||
'-p', '--perf',
|
||||
help="Run under Linux's perf to sample performance counters, writing "
|
||||
@@ -1385,10 +1387,10 @@ if __name__ == "__main__":
|
||||
default=PERF_SCRIPT,
|
||||
help="Path to the perf script to use. Defaults to %r." % PERF_SCRIPT)
|
||||
bench_parser.add_argument(
|
||||
'--perf-tool',
|
||||
'--perf-path',
|
||||
type=lambda x: x.split(),
|
||||
help="Path to the perf tool to use. This is passed directly to the "
|
||||
"perf script")
|
||||
help="Path to the perf executable, may include flags. This is passed "
|
||||
"directly to the perf script")
|
||||
|
||||
# compilation flags
|
||||
comp_parser = parser.add_argument_group('compilation options')
|
||||
|
||||
@@ -21,7 +21,7 @@ import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
GIT_TOOL = ['git']
|
||||
GIT_PATH = ['git']
|
||||
|
||||
|
||||
def openio(path, mode='r', buffering=-1):
|
||||
@@ -89,10 +89,10 @@ def main(from_prefix, to_prefix, paths=[], *,
|
||||
no_renames=False,
|
||||
git=False,
|
||||
no_stage=False,
|
||||
git_tool=GIT_TOOL):
|
||||
git_path=GIT_PATH):
|
||||
if not paths:
|
||||
if git:
|
||||
cmd = git_tool + ['ls-tree', '-r', '--name-only', 'HEAD']
|
||||
cmd = git_path + ['ls-tree', '-r', '--name-only', 'HEAD']
|
||||
if verbose:
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
paths = subprocess.check_output(cmd, encoding='utf8').split()
|
||||
@@ -116,11 +116,11 @@ def main(from_prefix, to_prefix, paths=[], *,
|
||||
# stage?
|
||||
if git and not no_stage:
|
||||
if from_path != to_path:
|
||||
cmd = git_tool + ['rm', '-q', from_path]
|
||||
cmd = git_path + ['rm', '-q', from_path]
|
||||
if verbose:
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
subprocess.check_call(cmd)
|
||||
cmd = git_tool + ['add', to_path]
|
||||
cmd = git_path + ['add', to_path]
|
||||
if verbose:
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
subprocess.check_call(cmd)
|
||||
@@ -168,10 +168,11 @@ if __name__ == "__main__":
|
||||
action='store_true',
|
||||
help="Don't stage changes with git.")
|
||||
parser.add_argument(
|
||||
'--git-tool',
|
||||
'--git-path',
|
||||
type=lambda x: x.split(),
|
||||
default=GIT_TOOL,
|
||||
help="Path to git tool to use. Defaults to %r." % GIT_TOOL)
|
||||
default=GIT_PATH,
|
||||
help="Path to git executable, may include flags. "
|
||||
"Defaults to %r." % GIT_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+18
-16
@@ -23,9 +23,9 @@ import shlex
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
NM_TOOL = ['nm']
|
||||
NM_PATH = ['nm']
|
||||
NM_TYPES = 'tTrRdD'
|
||||
OBJDUMP_TOOL = ['objdump']
|
||||
OBJDUMP_PATH = ['objdump']
|
||||
|
||||
|
||||
# integer fields
|
||||
@@ -135,9 +135,9 @@ def openio(path, mode='r', buffering=-1):
|
||||
return open(path, mode, buffering)
|
||||
|
||||
def collect(obj_paths, *,
|
||||
nm_tool=NM_TOOL,
|
||||
nm_path=NM_PATH,
|
||||
nm_types=NM_TYPES,
|
||||
objdump_tool=OBJDUMP_TOOL,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
sources=None,
|
||||
everything=False,
|
||||
**args):
|
||||
@@ -162,8 +162,8 @@ def collect(obj_paths, *,
|
||||
|
||||
# find symbol sizes
|
||||
results_ = []
|
||||
# note nm-tool may contain extra args
|
||||
cmd = nm_tool + ['--size-sort', path]
|
||||
# note nm-path may contain extra args
|
||||
cmd = nm_path + ['--size-sort', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -193,8 +193,8 @@ def collect(obj_paths, *,
|
||||
# try to figure out the source file if we have debug-info
|
||||
dirs = {}
|
||||
files = {}
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=rawline', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=rawline', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -234,8 +234,8 @@ def collect(obj_paths, *,
|
||||
is_func = False
|
||||
f_name = None
|
||||
f_file = None
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=info', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=info', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -675,15 +675,17 @@ if __name__ == "__main__":
|
||||
help="Type of symbols to report, this uses the same single-character "
|
||||
"type-names emitted by nm. Defaults to %r." % NM_TYPES)
|
||||
parser.add_argument(
|
||||
'--nm-tool',
|
||||
'--nm-path',
|
||||
type=lambda x: x.split(),
|
||||
default=NM_TOOL,
|
||||
help="Path to the nm tool to use. Defaults to %r." % NM_TOOL)
|
||||
default=NM_PATH,
|
||||
help="Path to the nm executable, may include flags. "
|
||||
"Defaults to %r." % NM_PATH)
|
||||
parser.add_argument(
|
||||
'--objdump-tool',
|
||||
'--objdump-path',
|
||||
type=lambda x: x.split(),
|
||||
default=OBJDUMP_TOOL,
|
||||
help="Path to the objdump tool to use. Defaults to %r." % OBJDUMP_TOOL)
|
||||
default=OBJDUMP_PATH,
|
||||
help="Path to the objdump executable, may include flags. "
|
||||
"Defaults to %r." % OBJDUMP_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+8
-7
@@ -25,7 +25,7 @@ import subprocess as sp
|
||||
# TODO use explode_asserts to avoid counting assert branches?
|
||||
# TODO use dwarf=info to find functions for inline functions?
|
||||
|
||||
GCOV_TOOL = ['gcov']
|
||||
GCOV_PATH = ['gcov']
|
||||
|
||||
|
||||
# integer fields
|
||||
@@ -210,15 +210,15 @@ def openio(path, mode='r', buffering=-1):
|
||||
return open(path, mode, buffering)
|
||||
|
||||
def collect(gcda_paths, *,
|
||||
gcov_tool=GCOV_TOOL,
|
||||
gcov_path=GCOV_PATH,
|
||||
sources=None,
|
||||
everything=False,
|
||||
**args):
|
||||
results = []
|
||||
for path in gcda_paths:
|
||||
# get coverage info through gcov's json output
|
||||
# note, gcov-tool may contain extra args
|
||||
cmd = GCOV_TOOL + ['-b', '-t', '--json-format', path]
|
||||
# note, gcov-path may contain extra args
|
||||
cmd = GCOV_PATH + ['-b', '-t', '--json-format', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -802,10 +802,11 @@ if __name__ == "__main__":
|
||||
action='store_true',
|
||||
help="Error if any branches are not covered.")
|
||||
parser.add_argument(
|
||||
'--gcov-tool',
|
||||
default=GCOV_TOOL,
|
||||
'--gcov-path',
|
||||
default=GCOV_PATH,
|
||||
type=lambda x: x.split(),
|
||||
help="Path to the gcov tool to use. Defaults to %r." % GCOV_TOOL)
|
||||
help="Path to the gcov executable, may include paths. "
|
||||
"Defaults to %r." % GCOV_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+18
-16
@@ -23,9 +23,9 @@ import shlex
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
NM_TOOL = ['nm']
|
||||
NM_PATH = ['nm']
|
||||
NM_TYPES = 'dDbB'
|
||||
OBJDUMP_TOOL = ['objdump']
|
||||
OBJDUMP_PATH = ['objdump']
|
||||
|
||||
|
||||
# integer fields
|
||||
@@ -135,9 +135,9 @@ def openio(path, mode='r', buffering=-1):
|
||||
return open(path, mode, buffering)
|
||||
|
||||
def collect(obj_paths, *,
|
||||
nm_tool=NM_TOOL,
|
||||
nm_path=NM_PATH,
|
||||
nm_types=NM_TYPES,
|
||||
objdump_tool=OBJDUMP_TOOL,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
sources=None,
|
||||
everything=False,
|
||||
**args):
|
||||
@@ -162,8 +162,8 @@ def collect(obj_paths, *,
|
||||
|
||||
# find symbol sizes
|
||||
results_ = []
|
||||
# note nm-tool may contain extra args
|
||||
cmd = nm_tool + ['--size-sort', path]
|
||||
# note nm-path may contain extra args
|
||||
cmd = nm_path + ['--size-sort', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -193,8 +193,8 @@ def collect(obj_paths, *,
|
||||
# try to figure out the source file if we have debug-info
|
||||
dirs = {}
|
||||
files = {}
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=rawline', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=rawline', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -234,8 +234,8 @@ def collect(obj_paths, *,
|
||||
is_func = False
|
||||
f_name = None
|
||||
f_file = None
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=info', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=info', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -675,15 +675,17 @@ if __name__ == "__main__":
|
||||
help="Type of symbols to report, this uses the same single-character "
|
||||
"type-names emitted by nm. Defaults to %r." % NM_TYPES)
|
||||
parser.add_argument(
|
||||
'--nm-tool',
|
||||
'--nm-path',
|
||||
type=lambda x: x.split(),
|
||||
default=NM_TOOL,
|
||||
help="Path to the nm tool to use. Defaults to %r." % NM_TOOL)
|
||||
default=NM_PATH,
|
||||
help="Path to the nm executable, may include flags. "
|
||||
"Defaults to %r." % NM_PATH)
|
||||
parser.add_argument(
|
||||
'--objdump-tool',
|
||||
'--objdump-path',
|
||||
type=lambda x: x.split(),
|
||||
default=OBJDUMP_TOOL,
|
||||
help="Path to the objdump tool to use. Defaults to %r." % OBJDUMP_TOOL)
|
||||
default=OBJDUMP_PATH,
|
||||
help="Path to the objdump executable, may include flags. "
|
||||
"Defaults to %r." % OBJDUMP_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+20
-17
@@ -30,10 +30,10 @@ import zipfile
|
||||
# TODO support non-zip perf results?
|
||||
|
||||
|
||||
PERF_TOOL = ['perf']
|
||||
PERF_PATH = ['perf']
|
||||
PERF_EVENTS = 'cycles,branch-misses,branches,cache-misses,cache-references'
|
||||
PERF_FREQ = 100
|
||||
OBJDUMP_TOOL = ['objdump']
|
||||
OBJDUMP_PATH = ['objdump']
|
||||
THRESHOLD = (0.5, 0.85)
|
||||
|
||||
|
||||
@@ -161,13 +161,13 @@ def record(command, *,
|
||||
perf_freq=PERF_FREQ,
|
||||
perf_period=None,
|
||||
perf_events=PERF_EVENTS,
|
||||
perf_tool=PERF_TOOL,
|
||||
perf_path=PERF_PATH,
|
||||
**args):
|
||||
# create a temporary file for perf to write to, as far as I can tell
|
||||
# this is strictly needed because perf's pipe-mode only works with stdout
|
||||
with tempfile.NamedTemporaryFile('rb') as f:
|
||||
# figure out our perf invocation
|
||||
perf = perf_tool + list(filter(None, [
|
||||
perf = perf_path + list(filter(None, [
|
||||
'record',
|
||||
'-F%s' % perf_freq
|
||||
if perf_freq is not None
|
||||
@@ -234,7 +234,7 @@ def multiprocessing_cache(f):
|
||||
|
||||
@multiprocessing_cache
|
||||
def collect_syms_and_lines(obj_path, *,
|
||||
objdump_tool=None,
|
||||
objdump_path=None,
|
||||
**args):
|
||||
symbol_pattern = re.compile(
|
||||
'^(?P<addr>[0-9a-fA-F]+)'
|
||||
@@ -263,7 +263,7 @@ def collect_syms_and_lines(obj_path, *,
|
||||
# figure out symbol addresses and file+line ranges
|
||||
syms = {}
|
||||
sym_at = []
|
||||
cmd = objdump_tool + ['-t', obj_path]
|
||||
cmd = objdump_path + ['-t', obj_path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -312,7 +312,7 @@ def collect_syms_and_lines(obj_path, *,
|
||||
op_file = 1
|
||||
op_line = 1
|
||||
op_addr = 0
|
||||
cmd = objdump_tool + ['--dwarf=rawline', obj_path]
|
||||
cmd = objdump_path + ['--dwarf=rawline', obj_path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -384,7 +384,7 @@ def collect_syms_and_lines(obj_path, *,
|
||||
|
||||
|
||||
def collect_decompressed(path, *,
|
||||
perf_tool=PERF_TOOL,
|
||||
perf_path=PERF_PATH,
|
||||
sources=None,
|
||||
everything=False,
|
||||
propagate=0,
|
||||
@@ -407,8 +407,8 @@ def collect_decompressed(path, *,
|
||||
'cache-misses': 'cmisses',
|
||||
'cache-references': 'caches'}
|
||||
|
||||
# note perf_tool may contain extra args
|
||||
cmd = perf_tool + [
|
||||
# note perf_path may contain extra args
|
||||
cmd = perf_path + [
|
||||
'script',
|
||||
'-i%s' % path]
|
||||
if args.get('verbose'):
|
||||
@@ -1259,14 +1259,16 @@ if __name__ == "__main__":
|
||||
const=0,
|
||||
help="Number of processes to use. 0 spawns one process per core.")
|
||||
parser.add_argument(
|
||||
'--perf-tool',
|
||||
'--perf-path',
|
||||
type=lambda x: x.split(),
|
||||
help="Path to the perf tool to use. Defaults to %r." % PERF_TOOL)
|
||||
help="Path to the perf executable, may include flags. "
|
||||
"Defaults to %r." % PERF_PATH)
|
||||
parser.add_argument(
|
||||
'--objdump-tool',
|
||||
'--objdump-path',
|
||||
type=lambda x: x.split(),
|
||||
default=OBJDUMP_TOOL,
|
||||
help="Path to the objdump tool to use. Defaults to %r." % OBJDUMP_TOOL)
|
||||
default=OBJDUMP_PATH,
|
||||
help="Path to the objdump executable, may include flags. "
|
||||
"Defaults to %r." % OBJDUMP_PATH)
|
||||
|
||||
# record flags
|
||||
record_parser = parser.add_argument_group('record options')
|
||||
@@ -1294,9 +1296,10 @@ if __name__ == "__main__":
|
||||
help="perf events to record. This is passed directly to perf. "
|
||||
"Defaults to %r." % PERF_EVENTS)
|
||||
record_parser.add_argument(
|
||||
'--perf-tool',
|
||||
'--perf-path',
|
||||
type=lambda x: x.split(),
|
||||
help="Path to the perf tool to use. Defaults to %r." % PERF_TOOL)
|
||||
help="Path to the perf executable, may include flags. "
|
||||
"Defaults to %r." % PERF_PATH)
|
||||
|
||||
# avoid intermixed/REMAINDER conflict, see above
|
||||
if nargs == argparse.REMAINDER:
|
||||
|
||||
+8
-7
@@ -24,7 +24,7 @@ import shlex
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
OBJDUMP_TOOL = ['objdump']
|
||||
OBJDUMP_PATH = ['objdump']
|
||||
THRESHOLD = (0.5, 0.85)
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ def openio(path, mode='r', buffering=-1):
|
||||
return open(path, mode, buffering)
|
||||
|
||||
def collect_syms_and_lines(obj_path, *,
|
||||
objdump_tool=None,
|
||||
objdump_path=None,
|
||||
**args):
|
||||
symbol_pattern = re.compile(
|
||||
'^(?P<addr>[0-9a-fA-F]+)'
|
||||
@@ -171,7 +171,7 @@ def collect_syms_and_lines(obj_path, *,
|
||||
# figure out symbol addresses
|
||||
syms = {}
|
||||
sym_at = []
|
||||
cmd = objdump_tool + ['-t', obj_path]
|
||||
cmd = objdump_path + ['-t', obj_path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -220,7 +220,7 @@ def collect_syms_and_lines(obj_path, *,
|
||||
op_file = 1
|
||||
op_line = 1
|
||||
op_addr = 0
|
||||
cmd = objdump_tool + ['--dwarf=rawline', obj_path]
|
||||
cmd = objdump_path + ['--dwarf=rawline', obj_path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -1244,10 +1244,11 @@ if __name__ == "__main__":
|
||||
const=0,
|
||||
help="Number of processes to use. 0 spawns one process per core.")
|
||||
parser.add_argument(
|
||||
'--objdump-tool',
|
||||
'--objdump-path',
|
||||
type=lambda x: x.split(),
|
||||
default=OBJDUMP_TOOL,
|
||||
help="Path to the objdump tool to use. Defaults to %r." % OBJDUMP_TOOL)
|
||||
default=OBJDUMP_PATH,
|
||||
help="Path to the objdump executable, may include flags. "
|
||||
"Defaults to %r." % OBJDUMP_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+10
-9
@@ -20,7 +20,7 @@ import shlex
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
OBJDUMP_TOOL = ['objdump']
|
||||
OBJDUMP_PATH = ['objdump']
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ def openio(path, mode='r', buffering=-1):
|
||||
return open(path, mode, buffering)
|
||||
|
||||
def collect(obj_paths, *,
|
||||
objdump_tool=OBJDUMP_TOOL,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
sources=None,
|
||||
everything=False,
|
||||
internal=False,
|
||||
@@ -150,8 +150,8 @@ def collect(obj_paths, *,
|
||||
# find files, we want to filter by structs in .h files
|
||||
dirs = {}
|
||||
files = {}
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=rawline', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=rawline', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -191,8 +191,8 @@ def collect(obj_paths, *,
|
||||
s_name = None
|
||||
s_file = None
|
||||
s_size = None
|
||||
# note objdump-tool may contain extra args
|
||||
cmd = objdump_tool + ['--dwarf=info', path]
|
||||
# note objdump-path may contain extra args
|
||||
cmd = objdump_path + ['--dwarf=info', path]
|
||||
if args.get('verbose'):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
@@ -626,10 +626,11 @@ if __name__ == "__main__":
|
||||
action='store_true',
|
||||
help="Also show structs in .c files.")
|
||||
parser.add_argument(
|
||||
'--objdump-tool',
|
||||
'--objdump-path',
|
||||
type=lambda x: x.split(),
|
||||
default=OBJDUMP_TOOL,
|
||||
help="Path to the objdump tool to use. Defaults to %r." % OBJDUMP_TOOL)
|
||||
default=OBJDUMP_PATH,
|
||||
help="Path to the objdump executable, may include flags. "
|
||||
"Defaults to %r." % OBJDUMP_PATH)
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
+20
-18
@@ -30,8 +30,8 @@ import toml
|
||||
RUNNER_PATH = './runners/test_runner'
|
||||
HEADER_PATH = 'runners/test_runner.h'
|
||||
|
||||
GDB_TOOL = ['gdb']
|
||||
VALGRIND_TOOL = ['valgrind']
|
||||
GDB_PATH = ['gdb']
|
||||
VALGRIND_PATH = ['valgrind']
|
||||
PERF_SCRIPT = ['./scripts/perf.py']
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ def find_runner(runner, **args):
|
||||
|
||||
# run under valgrind?
|
||||
if args.get('valgrind'):
|
||||
cmd[:0] = args['valgrind_tool'] + [
|
||||
cmd[:0] = args['valgrind_path'] + [
|
||||
'--leak-check=full',
|
||||
'--track-origins=yes',
|
||||
'--error-exitcode=4',
|
||||
@@ -532,8 +532,8 @@ def find_runner(runner, **args):
|
||||
if args.get('perf_period') else None,
|
||||
'--perf-events=%s' % args['perf_events']
|
||||
if args.get('perf_events') else None,
|
||||
'--perf-tool=%s' % args['perf_tool']
|
||||
if args.get('perf_tool') else None,
|
||||
'--perf-path=%s' % args['perf_path']
|
||||
if args.get('perf_path') else None,
|
||||
'-o%s' % args['perf']]))
|
||||
|
||||
# other context
|
||||
@@ -1144,24 +1144,24 @@ def run(runner, test_ids=[], **args):
|
||||
cmd = runner_ + [failure.id]
|
||||
|
||||
if args.get('gdb_main'):
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'break main',
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
elif args.get('gdb_case'):
|
||||
path, lineno = find_path(runner_, failure.id, **args)
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'break %s:%d' % (path, lineno),
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
elif failure.assert_ is not None:
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'run',
|
||||
'-ex', 'frame function raise',
|
||||
'-ex', 'up 2',
|
||||
'--args']
|
||||
else:
|
||||
cmd[:0] = args['gdb_tool'] + [
|
||||
cmd[:0] = args['gdb_path'] + [
|
||||
'-ex', 'run',
|
||||
'--args']
|
||||
|
||||
@@ -1353,10 +1353,11 @@ if __name__ == "__main__":
|
||||
help="Drop into gdb on test failure but stop at the beginning "
|
||||
"of main.")
|
||||
test_parser.add_argument(
|
||||
'--gdb-tool',
|
||||
'--gdb-path',
|
||||
type=lambda x: x.split(),
|
||||
default=GDB_TOOL,
|
||||
help="Path to gdb tool to use. Defaults to %r." % GDB_TOOL)
|
||||
default=GDB_PATH,
|
||||
help="Path to the gdb executable, may include flags. "
|
||||
"Defaults to %r." % GDB_PATH)
|
||||
test_parser.add_argument(
|
||||
'--exec',
|
||||
type=lambda e: e.split(),
|
||||
@@ -1367,10 +1368,11 @@ if __name__ == "__main__":
|
||||
help="Run under Valgrind to find memory errors. Implicitly sets "
|
||||
"--isolate.")
|
||||
test_parser.add_argument(
|
||||
'--valgrind-tool',
|
||||
'--valgrind-path',
|
||||
type=lambda x: x.split(),
|
||||
default=VALGRIND_TOOL,
|
||||
help="Path to Valgrind tool to use. Defaults to %r." % VALGRIND_TOOL)
|
||||
default=VALGRIND_PATH,
|
||||
help="Path to the Valgrind executable, may include flags. "
|
||||
"Defaults to %r." % VALGRIND_PATH)
|
||||
test_parser.add_argument(
|
||||
'-p', '--perf',
|
||||
help="Run under Linux's perf to sample performance counters, writing "
|
||||
@@ -1393,10 +1395,10 @@ if __name__ == "__main__":
|
||||
default=PERF_SCRIPT,
|
||||
help="Path to the perf script to use. Defaults to %r." % PERF_SCRIPT)
|
||||
test_parser.add_argument(
|
||||
'--perf-tool',
|
||||
'--perf-path',
|
||||
type=lambda x: x.split(),
|
||||
help="Path to the perf tool to use. This is passed directly to the "
|
||||
"perf script")
|
||||
help="Path to the perf executable, may include flags. This is passed "
|
||||
"directly to the perf script")
|
||||
|
||||
# compilation flags
|
||||
comp_parser = parser.add_argument_group('compilation options')
|
||||
|
||||
Reference in New Issue
Block a user