1#!/usr/bin/env python3 2# Copyright 2016 the V8 project authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import os 7import os.path 8import signal 9import subprocess 10import sys 11 12GCMOLE_PATH = os.path.dirname(os.path.abspath(__file__)) 13CLANG_BIN = os.path.join(GCMOLE_PATH, 'gcmole-tools', 'bin') 14CLANG_PLUGINS = os.path.join(GCMOLE_PATH, 'gcmole-tools') 15DRIVER = os.path.join(GCMOLE_PATH, 'gcmole.py') 16BASE_PATH = os.path.dirname(os.path.dirname(GCMOLE_PATH)) 17 18assert len(sys.argv) >= 2 19 20if not os.path.isfile("out/build/gen/torque-generated/builtin-definitions.h"): 21 print("Expected generated headers in out/build/gen.") 22 print("Either build v8 in out/build or change the 'out/build/gen' location in gcmole.py") 23 sys.exit(-1) 24 25proc = subprocess.Popen( 26 [sys.executable, DRIVER] + sys.argv[1:], 27 env={'CLANG_BIN': CLANG_BIN, 'CLANG_PLUGINS': CLANG_PLUGINS}, 28 cwd=BASE_PATH, 29) 30 31def handle_sigterm(*args): 32 try: 33 proc.kill() 34 except OSError: 35 pass 36 37signal.signal(signal.SIGTERM, handle_sigterm) 38 39proc.communicate() 40sys.exit(proc.returncode) 41