summaryrefslogtreecommitdiffstats
path: root/tools/purify/test_runner.py
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 16:48:01 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 16:48:01 +0000
commit2ccbdbe2508fdf17fde95a96ee197d45faabe467 (patch)
tree073278da9dc4dceaf8a9e1ff282fb7828260d268 /tools/purify/test_runner.py
parentacde9211abf5810732c49da3cfad7ce14650d5a0 (diff)
downloadchromium_src-2ccbdbe2508fdf17fde95a96ee197d45faabe467.zip
chromium_src-2ccbdbe2508fdf17fde95a96ee197d45faabe467.tar.gz
chromium_src-2ccbdbe2508fdf17fde95a96ee197d45faabe467.tar.bz2
A simple one-at-a-time test runner that can be driven by chrome_tests.py.
This allows memory errors to be isolated to a particular test and a crash in one test to affect the tests of others. Review URL: http://codereview.chromium.org/17634 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7938 0039d316-1c4b-4281-b951-d872f2087c98
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()