aboutsummaryrefslogtreecommitdiff
path: root/catapult/common/py_trace_event/bin/run_tests
diff options
context:
space:
mode:
Diffstat (limited to 'catapult/common/py_trace_event/bin/run_tests')
-rwxr-xr-xcatapult/common/py_trace_event/bin/run_tests35
1 files changed, 35 insertions, 0 deletions
diff --git a/catapult/common/py_trace_event/bin/run_tests b/catapult/common/py_trace_event/bin/run_tests
new file mode 100755
index 00000000..b9e1cbe6
--- /dev/null
+++ b/catapult/common/py_trace_event/bin/run_tests
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright (c) 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+_CATAPULT_PATH = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), '..', '..', '..'))
+
+_PY_TRACE_EVENT_PATH = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), '..'))
+
+
+def _RunTestsOrDie(top_level_dir):
+ # Need everything in one process for tracing to work.
+ exit_code = run_with_typ.Run(
+ top_level_dir, path=[_PY_TRACE_EVENT_PATH], jobs=1)
+ if exit_code:
+ sys.exit(exit_code)
+
+
+def _AddToPathIfNeeded(path):
+ if path not in sys.path:
+ sys.path.insert(0, path)
+
+
+if __name__ == '__main__':
+ _AddToPathIfNeeded(_CATAPULT_PATH)
+
+ from catapult_build import run_with_typ
+
+ _RunTestsOrDie(_PY_TRACE_EVENT_PATH)
+