summaryrefslogtreecommitdiffstats
path: root/tools/purify/chrome_tests.py
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 19:17:55 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 19:17:55 +0000
commitd3f216ff6c7cbcfd87215cf7016a3f177ac32e07 (patch)
tree0885c66fae24bc9e9ee375349e852f7e51cc335e /tools/purify/chrome_tests.py
parent82a5f66c7c15aa7b0b27ba734889a85980f8676a (diff)
downloadchromium_src-d3f216ff6c7cbcfd87215cf7016a3f177ac32e07.zip
chromium_src-d3f216ff6c7cbcfd87215cf7016a3f177ac32e07.tar.gz
chromium_src-d3f216ff6c7cbcfd87215cf7016a3f177ac32e07.tar.bz2
Add support for running the v8 tests under Purify.
Review URL: http://codereview.chromium.org/50019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/purify/chrome_tests.py')
-rw-r--r--tools/purify/chrome_tests.py82
1 files changed, 53 insertions, 29 deletions
diff --git a/tools/purify/chrome_tests.py b/tools/purify/chrome_tests.py
index a77e888..b6c095a 100644
--- a/tools/purify/chrome_tests.py
+++ b/tools/purify/chrome_tests.py
@@ -37,7 +37,8 @@ class ChromeTests:
"layout": self.TestLayout,
"dll": self.TestDll,
"layout_all": self.TestLayoutAll,
- "ui": self.TestUI}
+ "ui": self.TestUI,
+ "v8": self.TestV8}
if test not in self._test_list:
raise TestNotFound("Unknown test: %s" % test)
@@ -83,6 +84,38 @@ class ChromeTests:
"--source_dir=%s" % (self._source_dir),
"--save_cache"]
+ def ComputeBuildDir(self, module, exe=None):
+ ''' Computes the build dir for the given module / exe '''
+ if self._options.build_dir:
+ self._build_dir = self._options.build_dir
+ return self._build_dir
+ # Recompute _build_dir since the module and exe might have changed from
+ # a previous call (we might be running multiple tests).
+ module_dir = os.path.join(self._source_dir, module)
+ dir_chrome = os.path.join(self._source_dir, "chrome", "Release")
+ dir_module = os.path.join(module_dir, "Release")
+ if exe:
+ exe_chrome = os.path.join(dir_chrome, exe)
+ exe_module = os.path.join(dir_module, exe)
+ if os.path.isfile(exe_chrome) and not os.path.isfile(exe_module):
+ self._build_dir = dir_chrome
+ elif os.path.isfile(exe_module) and not os.path.isfile(exe_chrome):
+ self._build_dir = dir_module
+ elif os.stat(exe_module)[stat.ST_MTIME] > os.stat(exe_chrome)[stat.ST_MTIME]:
+ self._build_dir = dir_module
+ else:
+ self._build_dir = dir_chrome
+ else:
+ if os.path.isdir(dir_chrome) and not os.path.isdir(dir_module):
+ self._build_dir = dir_chrome
+ elif os.path.isdir(dir_module) and not os.path.isdir(dir_chrome):
+ self._build_dir = dir_module
+ elif os.stat(dir_module)[stat.ST_MTIME] > os.stat(dir_chrome)[stat.ST_MTIME]:
+ self._build_dir = dir_module
+ else:
+ self._build_dir = dir_chrome
+ return self._build_dir;
+
def _DefaultCommand(self, module, exe=None):
'''Generates the default command array that most tests will use.'''
module_dir = os.path.join(self._source_dir, module)
@@ -91,31 +124,7 @@ class ChromeTests:
self._data_dir = os.path.join(module_dir, "test", "data", "purify")
else:
self._data_dir = os.path.join(module_dir, "data", "purify")
-
- if not self._options.build_dir:
- dir_chrome = os.path.join(self._source_dir, "chrome", "Release")
- dir_module = os.path.join(module_dir, "Release")
- if exe:
- exe_chrome = os.path.join(dir_chrome, exe)
- exe_module = os.path.join(dir_module, exe)
- if os.path.isfile(exe_chrome) and not os.path.isfile(exe_module):
- self._options.build_dir = dir_chrome
- elif os.path.isfile(exe_module) and not os.path.isfile(exe_chrome):
- self._options.build_dir = dir_module
- elif os.stat(exe_module)[stat.ST_MTIME] > os.stat(exe_chrome)[stat.ST_MTIME]:
- self._options.build_dir = dir_module
- else:
- self._options.build_dir = dir_chrome
- else:
- if os.path.isdir(dir_chrome) and not os.path.isdir(dir_module):
- self._options.build_dir = dir_chrome
- elif os.path.isdir(dir_module) and not os.path.isdir(dir_chrome):
- self._options.build_dir = dir_module
- elif os.stat(dir_module)[stat.ST_MTIME] > os.stat(dir_chrome)[stat.ST_MTIME]:
- self._options.build_dir = dir_module
- else:
- self._options.build_dir = dir_chrome
-
+
cmd = list(self._command_preamble)
cmd.append("--data_dir=%s" % self._data_dir)
cmd.append("--report_dir=%s" % self._report_dir)
@@ -123,8 +132,9 @@ class ChromeTests:
cmd.append("--baseline")
if self._options.verbose:
cmd.append("--verbose")
+ self.ComputeBuildDir(module, exe);
if exe:
- cmd.append(os.path.join(self._options.build_dir, exe))
+ cmd.append(os.path.join(self._build_dir, exe))
return cmd
def Run(self):
@@ -331,8 +341,22 @@ class ChromeTests:
"--ui-test-action-timeout=80000",
"--ui-test-action-max-timeout=180000",
"--ui-test-sleep-timeout=40000"],
- multi=True)
-
+ multi=True)
+
+ def TestV8(self):
+ shell = "v8_shell_sample.exe"
+ # We need to compute _build_dir early to in order to pass in the
+ # shell path as an argument to the test script.
+ self.ComputeBuildDir("chrome", shell)
+ script = os.path.join(self._source_dir, "v8", "tools", "test.py")
+ shell_path = os.path.join(self._options.build_dir, shell)
+ return self.ScriptedTest("chrome", shell, "v8",
+ ["python.exe",
+ script,
+ "--no-build",
+ "--progress=dots",
+ "--shell=" + shell_path],
+ multi = True)
def _main(argv):
parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> "