[gcmole] Add subparsers
This will enable running the main gcmole script in different modes in the future, full run (this CL), later suspect generation only and analysis only. Bug: v8:12660 Change-Id: Ica87366fb3c5b6e238f5a1efaf347ebbeb01003a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4026062 Commit-Queue: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#84357}
This commit is contained in:
parent
74175dfafd
commit
506fb93ebe
@ -524,8 +524,9 @@ def main(argv):
|
||||
default_gcmole_dir = relative_parents(Path(argv[0]))
|
||||
if default_gcmole_dir or not default_gcmole_dir.exists():
|
||||
default_gcmole_dir = default_root_dir / 'tools' / 'gcmole'
|
||||
default_clang_bin_dir = default_gcmole_dir / 'gcmole-tools/bin'
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
def add_common_args(parser):
|
||||
archs = list(ARCHITECTURES.keys())
|
||||
parser.add_argument(
|
||||
"--v8-root-dir",
|
||||
@ -539,7 +540,6 @@ def main(argv):
|
||||
choices=archs,
|
||||
help="Tested CPU architecture. Choices: {}".format(archs),
|
||||
metavar="CPU")
|
||||
default_clang_bin_dir = default_gcmole_dir / 'gcmole-tools/bin'
|
||||
parser.add_argument(
|
||||
"--clang-bin-dir",
|
||||
metavar="DIR",
|
||||
@ -608,6 +608,14 @@ def main(argv):
|
||||
default=False,
|
||||
help="Test gcmole on tools/gcmole/gcmole-test.cc")
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
subps = parser.add_subparsers()
|
||||
|
||||
subp = subps.add_parser(
|
||||
"full", description="Run both gcmole analysis passes.")
|
||||
add_common_args(subp)
|
||||
subp.set_defaults(func=full_run)
|
||||
|
||||
options = parser.parse_args(argv[1:])
|
||||
|
||||
verify_and_convert_dirs(parser, options, default_gcmole_dir,
|
||||
@ -616,6 +624,10 @@ def main(argv):
|
||||
prepare_gcmole_files(options)
|
||||
verify_build_config(parser, options)
|
||||
|
||||
options.func(options)
|
||||
|
||||
|
||||
def full_run(options):
|
||||
any_errors_found = False
|
||||
if not test_run(options):
|
||||
any_errors_found = True
|
||||
|
@ -43,6 +43,7 @@ proc = subprocess.Popen(
|
||||
[
|
||||
sys.executable,
|
||||
GCMOLE_PY,
|
||||
"full",
|
||||
"--v8-build-dir=%s" % os.path.join(V8_ROOT_DIR, 'out', 'build'),
|
||||
"--v8-target-cpu=%s" % sys.argv[1],
|
||||
"--clang-plugins-dir=%s" % CLANG_PLUGINS,
|
||||
|
Loading…
Reference in New Issue
Block a user