summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/chrome_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/valgrind/chrome_tests.py')
-rwxr-xr-xtools/valgrind/chrome_tests.py67
1 files changed, 41 insertions, 26 deletions
diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py
index 27b9d9f..a6b5e67 100755
--- a/tools/valgrind/chrome_tests.py
+++ b/tools/valgrind/chrome_tests.py
@@ -22,6 +22,8 @@ import valgrind_test
class TestNotFound(Exception): pass
+class MultipleGTestFiltersSpecified(Exception): pass
+
def Dir2IsNewer(dir1, dir2):
if dir2 == None or not os.path.isdir(dir2):
return False
@@ -58,31 +60,21 @@ def FindDirContainingNewestFile(dirs, file):
class ChromeTests:
def __init__(self, options, args, test):
- # The known list of tests.
- # Recognise the original abbreviations as well as full executable names.
- self._test_list = {
- "base": self.TestBase, "base_unittests": self.TestBase,
- "browser": self.TestBrowser, "browser_tests": self.TestBrowser,
- "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL,
- "ipc": self.TestIpc, "ipc_tests": self.TestIpc,
- "layout": self.TestLayout, "layout_tests": self.TestLayout,
- "media": self.TestMedia, "media_unittests": self.TestMedia,
- "net": self.TestNet, "net_unittests": self.TestNet,
- "printing": self.TestPrinting, "printing_unittests": self.TestPrinting,
- "startup": self.TestStartup, "startup_tests": self.TestStartup,
- "sync": self.TestSync, "sync_unit_tests": self.TestSync,
- "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell,
- "ui": self.TestUI, "ui_tests": self.TestUI,
- "unit": self.TestUnit, "unit_tests": self.TestUnit,
- "app": self.TestApp, "app_unittests": self.TestApp,
- }
-
- if test not in self._test_list:
+ if ':' in test:
+ (self._test, self._gtest_filter) = test.split(':', 1)
+ else:
+ self._test = test
+ self._gtest_filter = options.gtest_filter
+
+ if self._test not in self._test_list:
raise TestNotFound("Unknown test: %s" % test)
+ if options.gtest_filter and options.gtest_filter != self._gtest_filter:
+ raise MultipleGTestFiltersSpecified("Can not specify both --gtest_filter "
+ "and --test %s" % test)
+
self._options = options
self._args = args
- self._test = test
script_dir = path_utils.ScriptDir()
# Compute the top of the tree (the "source dir") from the script dir (where
@@ -163,7 +155,7 @@ class ChromeTests:
def Run(self):
''' Runs the test specified by command-line argument --test '''
logging.info("running test %s" % (self._test))
- return self._test_list[self._test]()
+ return self._test_list[self._test](self)
def _ReadGtestFilterFile(self, name, cmd):
'''Read a file which is a list of tests to filter out with --gtest_filter
@@ -189,7 +181,7 @@ class ChromeTests:
continue
line = line.rstrip()
filters.append(line)
- gtest_filter = self._options.gtest_filter
+ gtest_filter = self._gtest_filter
if len(filters):
if gtest_filter:
gtest_filter += ":"
@@ -374,14 +366,34 @@ class ChromeTests:
# summary list for long, but will be useful for someone reviewing this bot.
return ret
+ # The known list of tests.
+ # Recognise the original abbreviations as well as full executable names.
+ _test_list = {
+ "base": TestBase, "base_unittests": TestBase,
+ "browser": TestBrowser, "browser_tests": TestBrowser,
+ "googleurl": TestGURL, "googleurl_unittests": TestGURL,
+ "ipc": TestIpc, "ipc_tests": TestIpc,
+ "layout": TestLayout, "layout_tests": TestLayout,
+ "media": TestMedia, "media_unittests": TestMedia,
+ "net": TestNet, "net_unittests": TestNet,
+ "printing": TestPrinting, "printing_unittests": TestPrinting,
+ "startup": TestStartup, "startup_tests": TestStartup,
+ "sync": TestSync, "sync_unit_tests": TestSync,
+ "test_shell": TestTestShell, "test_shell_tests": TestTestShell,
+ "ui": TestUI, "ui_tests": TestUI,
+ "unit": TestUnit, "unit_tests": TestUnit,
+ "app": TestApp, "app_unittests": TestApp,
+ }
+
def _main(_):
parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> "
"[-t <test> ...]")
parser.disable_interspersed_args()
parser.add_option("-b", "--build_dir",
help="the location of the output of the compiler output")
- parser.add_option("-t", "--test", action="append",
- help="which test to run")
+ parser.add_option("-t", "--test", action="append", default=[],
+ help="which test to run, supports test:gtest_filter format "
+ "as well.")
parser.add_option("", "--baseline", action="store_true", default=False,
help="generate baseline data instead of validating")
parser.add_option("", "--gtest_filter",
@@ -408,9 +420,12 @@ def _main(_):
else:
logging_utils.config_root()
- if not options.test or not len(options.test):
+ if not options.test:
parser.error("--test not specified")
+ if len(options.test) != 1 and options.gtest_filter:
+ parser.error("--gtest_filter and multiple tests don't make sense together")
+
for t in options.test:
tests = ChromeTests(options, args, t)
ret = tests.Run()