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 sys 8 9_CATAPULT_PATH = os.path.abspath( 10 os.path.join(os.path.dirname(__file__), '..', '..', '..')) 11 12_PY_TRACE_EVENT_PATH = os.path.abspath( 13 os.path.join(os.path.dirname(__file__), '..')) 14 15 16def _RunTestsOrDie(top_level_dir): 17 # Need everything in one process for tracing to work. 18 exit_code = run_with_typ.Run( 19 top_level_dir, path=[_PY_TRACE_EVENT_PATH], jobs=1) 20 if exit_code: 21 sys.exit(exit_code) 22 23 24def _AddToPathIfNeeded(path): 25 if path not in sys.path: 26 sys.path.insert(0, path) 27 28 29if __name__ == '__main__': 30 _AddToPathIfNeeded(_CATAPULT_PATH) 31 32 from catapult_build import run_with_typ 33 34 _RunTestsOrDie(_PY_TRACE_EVENT_PATH) 35 36