summaryrefslogtreecommitdiffstats
path: root/tools/purify/test_runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/purify/test_runner.py')
-rw-r--r--tools/purify/test_runner.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/purify/test_runner.py b/tools/purify/test_runner.py
new file mode 100644
index 0000000..78ab615
--- /dev/null
+++ b/tools/purify/test_runner.py
@@ -0,0 +1,51 @@
+#!/bin/env python
+# Copyright (c) 2006-2008 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.
+
+# test_runner
+
+import optparse
+import os
+import re
+import subprocess
+import sys
+
+import google.logging_utils
+import google.path_utils
+
+import common
+
+
+def GetAllTests(exe):
+ cmd = [exe, "--gtest_list_tests"]
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ line = p.stdout.readline().rstrip()
+ test = line
+ tests = []
+ while line:
+ line = p.stdout.readline().rstrip()
+ if line.startswith(' '):
+ tests.append(test + line.lstrip())
+ else:
+ test = line
+ return tests
+
+
+def RunTestsSingly(exe, tests):
+ for test in tests:
+ filter = test
+ if len(sys.argv) > 2:
+ filter = filter + ":" + sys.argv[2]
+ cmd = [exe, "--gtest_filter=" + filter]
+ common.RunSubprocess(cmd)
+
+
+def main():
+ exe = sys.argv[1]
+ all_tests = GetAllTests(exe)
+ RunTestsSingly(exe, all_tests)
+
+
+if __name__ == "__main__":
+ main()