Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: tools/testrunner/local/testsuite.py

Issue 526133003: Refactoring: Make gtest testsuite the default. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/libplatform-unittests/testcfg.py ('k') | tools/testrunner/local/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/testsuite.py
diff --git a/tools/testrunner/local/testsuite.py b/tools/testrunner/local/testsuite.py
index 0fd3f3a3000a35ac2c06549b36e7c4cecd907e80..e831c48c3a0d28ae6636e9a786f4e04918ba6cf9 100644
--- a/tools/testrunner/local/testsuite.py
+++ b/tools/testrunner/local/testsuite.py
@@ -41,11 +41,13 @@ class TestSuite(object):
try:
(f, pathname, description) = imp.find_module("testcfg", [root])
module = imp.load_module("testcfg", f, pathname, description)
- suite = module.GetSuite(name, root)
+ return module.GetSuite(name, root)
+ except:
+ # Use default if no testcfg is present.
+ return GoogleTestSuite(name, root)
finally:
if f:
f.close()
- return suite
def __init__(self, name, root):
self.name = name # string
@@ -214,3 +216,40 @@ class TestSuite(object):
for t in self.tests:
self.total_duration += t.duration
return self.total_duration
+
+
+class GoogleTestSuite(TestSuite):
+ def __init__(self, name, root):
+ super(GoogleTestSuite, self).__init__(name, root)
+
+ def ListTests(self, context):
+ shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
+ if utils.IsWindows():
+ shell += ".exe"
+ output = commands.Execute(context.command_prefix +
+ [shell, "--gtest_list_tests"] +
+ context.extra_flags)
+ if output.exit_code != 0:
+ print output.stdout
+ print output.stderr
+ return []
+ tests = []
+ test_case = ''
+ for line in output.stdout.splitlines():
+ test_desc = line.strip().split()[0]
+ if test_desc.endswith('.'):
+ test_case = test_desc
+ elif test_case and test_desc:
+ test = testcase.TestCase(self, test_case + test_desc, dependency=None)
+ tests.append(test)
+ tests.sort()
+ return tests
+
+ def GetFlagsForTestCase(self, testcase, context):
+ return (testcase.flags + ["--gtest_filter=" + testcase.path] +
+ ["--gtest_random_seed=%s" % context.random_seed] +
+ ["--gtest_print_time=0"] +
+ context.mode_flags)
+
+ def shell(self):
+ return self.name
« no previous file with comments | « test/libplatform-unittests/testcfg.py ('k') | tools/testrunner/local/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698