v8/tools/gcmole/run-gcmole.py
Alexander Schulze ad7248787f [py3] Bump gcmole to py3
Bug: v8:12581
Change-Id: I6c665161a3f376321feb773d809c5453ef1d46f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3568445
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Alexander Schulze <alexschulze@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79735}
2022-04-04 11:48:13 +00:00

41 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import os.path
import signal
import subprocess
import sys
GCMOLE_PATH = os.path.dirname(os.path.abspath(__file__))
CLANG_BIN = os.path.join(GCMOLE_PATH, 'gcmole-tools', 'bin')
CLANG_PLUGINS = os.path.join(GCMOLE_PATH, 'gcmole-tools')
DRIVER = os.path.join(GCMOLE_PATH, 'gcmole.py')
BASE_PATH = os.path.dirname(os.path.dirname(GCMOLE_PATH))
assert len(sys.argv) >= 2
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)
proc = subprocess.Popen(
[sys.executable, DRIVER] + sys.argv[1:],
env={'CLANG_BIN': CLANG_BIN, 'CLANG_PLUGINS': CLANG_PLUGINS},
cwd=BASE_PATH,
)
def handle_sigterm(*args):
try:
proc.kill()
except OSError:
pass
signal.signal(signal.SIGTERM, handle_sigterm)
proc.communicate()
sys.exit(proc.returncode)