• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(
11    os.path.join(
12        os.path.dirname(os.path.realpath(__file__)),
13        os.path.pardir,
14        os.path.pardir))
15_TRACING_PATH = os.path.join(_CATAPULT_PATH, 'tracing')
16
17
18def _RunTestsOrDie(top_level_dir):
19  exit_code = run_with_typ.Run(top_level_dir, path=[_TRACING_PATH])
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 hooks import install
33  if '--no-install-hooks' in sys.argv:
34    sys.argv.remove('--no-install-hooks')
35  else:
36    install.InstallHooks()
37
38  from catapult_build import run_with_typ
39  # https://github.com/catapult-project/catapult/issues/2050
40  if platform.system() != 'Windows':
41    _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing'))
42  _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing_build'))
43  sys.exit(0)
44