1#!/usr/bin/env python 2# Copyright 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 sys 8import platform 9 10_CATAPULT_PATH = os.path.abspath(os.path.join( 11 os.path.dirname(__file__), os.path.pardir, os.path.pardir)) 12_PERF_INSIGHTS_PATH = os.path.join(_CATAPULT_PATH, 'perf_insights') 13 14 15def _RunTestsOrDie(top_level_dir): 16 exit_code = run_with_typ.Run(top_level_dir, path=[_PERF_INSIGHTS_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 _RunTestsOrDie(os.path.join(_PERF_INSIGHTS_PATH, 'perf_insights')) 37 _RunTestsOrDie(os.path.join(_PERF_INSIGHTS_PATH, 'perf_insights_build')) 38