[gcmole] Make wrapper backwards-compatible to gcmole modes

In a follow up we want to introduce a mode for just collecting or
processing. In the infrastructure however, we still call the wrapper
script with old arguments on release branches. This ensures that
we stay backwards compatible.

Bug: v8:12660
Change-Id: I08da713719d10cb58c2cd5ea7f711570bd57572c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4035976
Reviewed-by: Alexander Schulze <alexschulze@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84380}
This commit is contained in:
Michael Achenbach 2022-11-21 10:02:47 +01:00 committed by V8 LUCI CQ
parent f7196c26ca
commit 3afea88feb

View File

@ -18,34 +18,43 @@ V8_ROOT_DIR = os.path.dirname(os.path.dirname(GCMOLE_PATH))
def print_help():
print(
"""Usage: ./run-gcmole.py TOOLS_GCMOLE_DIR V8_TARGET_CPU [gcmole.py OPTION]...
"""Usage: ./run-gcmole.py [MODE] V8_TARGET_CPU [gcmole.py OPTION]...
Helper script to run gcmole.py on the bots.""")
args = sys.argv[1:]
if "--help" in args:
print_help()
exit(0)
for arg in sys.argv:
if arg == "--help":
print_help()
exit(0)
if len(sys.argv) < 2:
# Different modes of running gcmole. Optional to stay backwards-compatible.
# TODO(https://crbug.com/v8/12660): Add more modes.
mode = 'full'
if args and args[0] in ['full']:
mode = args[0]
args = args[1:]
if not args:
print("Missing arguments!")
print_help()
exit(1)
if not os.path.isfile("out/build/gen/torque-generated/builtin-definitions.h"):
print("Expected generated headers in out/build/gen.")
print("Either build v8 in out/build or change the 'out/build/gen' location in gcmole.py")
sys.exit(-1)
gcmole_py_options = sys.argv[2:]
gcmole_py_options = args[1:]
proc = subprocess.Popen(
[
sys.executable,
GCMOLE_PY,
"full",
mode,
"--v8-build-dir=%s" % os.path.join(V8_ROOT_DIR, 'out', 'build'),
"--v8-target-cpu=%s" % sys.argv[1],
"--v8-target-cpu=%s" % args[0],
"--clang-plugins-dir=%s" % CLANG_PLUGINS,
"--clang-bin-dir=%s" % CLANG_BIN,
"--is-bot",