1#!/usr/bin/env python 2# Copyright (c) 2015 The Chromium 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 platform 8import sys 9 10_CATAPULT_PATH = os.path.abspath(os.path.join( 11 os.path.dirname(__file__), os.path.pardir, os.path.pardir)) 12_TRACING_PATH = os.path.join(_CATAPULT_PATH, 'tracing') 13 14 15def _RunTestsOrDie(top_level_dir): 16 exit_code = run_with_typ.Run(top_level_dir, path=[_TRACING_PATH]) 17 if exit_code: 18 sys.exit(exit_code) 19 20 21def _AddToPathIfNeeded(path): 22 if path not in sys.path: 23 sys.path.insert(0, path) 24 25 26if __name__ == '__main__': 27 _AddToPathIfNeeded(_CATAPULT_PATH) 28 29 from hooks import install 30 if '--no-install-hooks' in sys.argv: 31 sys.argv.remove('--no-install-hooks') 32 else: 33 install.InstallHooks() 34 35 from catapult_build import run_with_typ 36 # https://github.com/catapult-project/catapult/issues/2050 37 if platform.system() != 'Windows': 38 _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing')) 39 _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing_build')) 40 sys.exit(0) 41