1 #!/usr/bin/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 6 """Runs the Perf Dashboard Python unit test suite.""" 7 8 import os 9 import sys 10 11 _CATAPULT_PATH = os.path.abspath( 12 os.path.join(os.path.dirname(__file__), '..', '..')) 13 _DASHBOARD_PATH = os.path.join(_CATAPULT_PATH, 'dashboard') 14 15 16 def _AddToPathIfNeeded(path): 17 if path not in sys.path: 18 sys.path.insert(0, path) 19 20 21 if __name__ == '__main__': 22 _AddToPathIfNeeded(_CATAPULT_PATH) 23 _AddToPathIfNeeded(_DASHBOARD_PATH) 24 25 from hooks import install 26 if '--no-install-hooks' in sys.argv: 27 sys.argv.remove('--no-install-hooks') 28 else: 29 install.InstallHooks() 30 31 from catapult_build import run_with_typ 32 import dashboard 33 return_code = run_with_typ.Run( 34 os.path.join(_DASHBOARD_PATH, 'dashboard'), 35 path=dashboard.ExtraPythonLibraryPaths()) 36 sys.exit(return_code) 37