diff options
author | victorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 16:15:26 +0000 |
---|---|---|
committer | victorw@chromium.org <victorw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 16:15:26 +0000 |
commit | 57701a5b374ad2efe1bc919063d8236ee810bb71 (patch) | |
tree | 5eb164a00301dfc12cd4c1fbb2f9bc340f1fe611 /webkit/tools/layout_tests | |
parent | b6e9a55f5c6542ed032c41dc06b85fec5ed63931 (diff) | |
download | chromium_src-57701a5b374ad2efe1bc919063d8236ee810bb71.zip chromium_src-57701a5b374ad2efe1bc919063d8236ee810bb71.tar.gz chromium_src-57701a5b374ad2efe1bc919063d8236ee810bb71.tar.bz2 |
Allow layout tests to be located both in src/webkit/data/layout_tests and third_party/WebKit.
For tests in LayoutTests directory, the script checks whether the LayoutTests directory exists in webkit/data/layout_tests, if not, assume it is in
third_party/WebKit.
Basically, this patch = http_server change + Dimitri Glazkov's patch (http://codereview.chromium.org/115302).
BUG=8765
TEST=none
Review URL: http://codereview.chromium.org/146112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/layout_tests')
7 files changed, 55 insertions, 24 deletions
diff --git a/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py b/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py index 21022f4..26e2adf 100644 --- a/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py +++ b/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py @@ -48,7 +48,7 @@ class CompareFailuresUnittest(unittest.TestCase): # Test force generation of new baseline files with a new failure and one # less passing. - pass_file = os.path.join(path_utils.LayoutDataDir(), 'fast', 'pass1.html') + pass_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'pass1.html') failures[pass_file] = [test_failures.FailureTextMismatch(None)] cf = compare_failures.CompareFailures(self.GetTestFiles(), failures, @@ -65,7 +65,7 @@ class CompareFailuresUnittest(unittest.TestCase): # Test case where we don't update new baseline. We have a new failure, # but it shouldn't be added to the expected-failures.txt file. - pass_file = os.path.join(path_utils.LayoutDataDir(), 'fast', 'pass1.html') + pass_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'pass1.html') failures[pass_file] = [test_failures.FailureTextMismatch(None)] self.CheckNoChanges(failures) @@ -80,7 +80,7 @@ class CompareFailuresUnittest(unittest.TestCase): # Test case where we don't update new baseline. A failure moving to a # crash shouldn't be added to the expected-crashes.txt file. - failure_file = os.path.join(path_utils.LayoutDataDir(), + failure_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'foo', 'fail1.html') failures[failure_file] = [test_failures.FailureCrash()] self.CheckNoChanges(failures) @@ -91,7 +91,7 @@ class CompareFailuresUnittest(unittest.TestCase): # Remove one of the failing test cases from the failures dictionary. This # makes failure_file considered to be passing. - failure_file = os.path.join(path_utils.LayoutDataDir(), + failure_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'bar', 'fail2.html') del failures[failure_file] @@ -107,7 +107,7 @@ class CompareFailuresUnittest(unittest.TestCase): """This is better than before, so we update the crashes file.""" failures = self.GetTestFailures() - crash_file = os.path.join(path_utils.LayoutDataDir(), + crash_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'bar', 'betz', 'crash3.html') del failures[crash_file] cf = compare_failures.CompareFailures(self.GetTestFiles(), failures, @@ -122,7 +122,7 @@ class CompareFailuresUnittest(unittest.TestCase): """This is better than before, so we should update both lists.""" failures = self.GetTestFailures() - crash_file = os.path.join(path_utils.LayoutDataDir(), + crash_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'bar', 'betz', 'crash3.html') failures[crash_file] = [test_failures.FailureTextMismatch(None)] cf = compare_failures.CompareFailures(self.GetTestFiles(), failures, @@ -136,7 +136,7 @@ class CompareFailuresUnittest(unittest.TestCase): def testNewTestPass(self): """After a merge, we need to update new passing tests properly.""" files = self.GetTestFiles() - new_test_file = os.path.join(path_utils.LayoutDataDir(), "new-test.html") + new_test_file = os.path.join(path_utils.LayoutTestsDir(), "new-test.html") files.add(new_test_file) failures = self.GetTestFailures() @@ -151,7 +151,7 @@ class CompareFailuresUnittest(unittest.TestCase): def testNewTestFail(self): """After a merge, we need to update new failing tests properly.""" files = self.GetTestFiles() - new_test_file = os.path.join(path_utils.LayoutDataDir(), "new-test.html") + new_test_file = os.path.join(path_utils.LayoutTestsDir(), "new-test.html") files.add(new_test_file) failures = self.GetTestFailures() @@ -167,7 +167,7 @@ class CompareFailuresUnittest(unittest.TestCase): def testNewTestCrash(self): """After a merge, we need to update new crashing tests properly.""" files = self.GetTestFiles() - new_test_file = os.path.join(path_utils.LayoutDataDir(), "new-test.html") + new_test_file = os.path.join(path_utils.LayoutTestsDir(), "new-test.html") files.add(new_test_file) failures = self.GetTestFailures() @@ -190,7 +190,7 @@ class CompareFailuresUnittest(unittest.TestCase): self.failUnless(not cf.HasNewFailures()) # test goes from passing to failing - pass_file = os.path.join(path_utils.LayoutDataDir(), 'fast', 'pass1.html') + pass_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'pass1.html') failures[pass_file] = [test_failures.FailureTextMismatch(None)] cf = compare_failures.CompareFailures(files, failures, set(), set(), self.GetTmpDir(), False) @@ -198,7 +198,7 @@ class CompareFailuresUnittest(unittest.TestCase): # Failing to passing failures = self.GetTestFailures() - failure_file = os.path.join(path_utils.LayoutDataDir(), + failure_file = os.path.join(path_utils.LayoutTestsDir(), 'fast', 'bar', 'fail2.html') del failures[failure_file] cf = compare_failures.CompareFailures(files, failures, set(), set(), @@ -206,7 +206,7 @@ class CompareFailuresUnittest(unittest.TestCase): self.failUnless(not cf.HasNewFailures()) # A new test that fails, this doesn't count as a new failure. - new_test_file = os.path.join(path_utils.LayoutDataDir(), "new-test.html") + new_test_file = os.path.join(path_utils.LayoutTestsDir(), "new-test.html") files.add(new_test_file) failures = self.GetTestFailures() failures[new_test_file] = [test_failures.FailureCrash()] @@ -250,7 +250,7 @@ class CompareFailuresUnittest(unittest.TestCase): def GetTestFiles(self): """Get a set of files that includes the expected crashes and failures along with two passing tests.""" - layout_dir = path_utils.LayoutDataDir() + layout_dir = path_utils.LayoutTestsDir() files = [ 'fast\\pass1.html', 'fast\\foo\\pass2.html', diff --git a/webkit/tools/layout_tests/layout_package/http_server.py b/webkit/tools/layout_tests/layout_package/http_server.py index a65c51a..b839385 100644 --- a/webkit/tools/layout_tests/layout_package/http_server.py +++ b/webkit/tools/layout_tests/layout_package/http_server.py @@ -34,7 +34,13 @@ class Lighttpd: _webkit_tests = PathFromBase('webkit', 'data', 'layout_tests', 'LayoutTests', 'http', 'tests') except google.path_utils.PathNotFound: - _webkit_tests = None + # If webkit/data/layout_tests/LayoutTests/http/tests does not exist, assume + # wekit tests are located in third_party/WebKit/LayoutTests/http/tests. + try: + _webkit_tests = PathFromBase('third_party', 'WebKit', + 'LayoutTests', 'http', 'tests') + except google.path_utils.PathNotFound: + _webkit_tests = None # New tests for Chrome try: diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py index 2e0e464..dcff738 100644 --- a/webkit/tools/layout_tests/layout_package/path_utils.py +++ b/webkit/tools/layout_tests/layout_package/path_utils.py @@ -19,6 +19,7 @@ class PathNotFound(Exception): pass # Save some paths here so we don't keep re-evaling. _webkit_root = None _layout_data_dir = None +_layout_tests_dir = None # A map from platform description to directory list. _platform_results_dirs = {} @@ -51,6 +52,27 @@ def LayoutDataDir(): 'data', 'layout_tests') return _layout_data_dir +def LayoutTestsDir(path = None): + """Returns the full path to the directory containing layout tests, based on + the supplied relative or absolute path to a layout tests. If the path contains + "LayoutTests" directory, locates this directory, assuming it's either in + in webkit/data/layout_tests or in third_party/WebKit.""" + + if path != None and path.find('LayoutTests') == -1: + return LayoutDataDir() + + global _layout_tests_dir + if _layout_tests_dir: + return _layout_tests_dir + + if os.path.exists(os.path.join(LayoutDataDir(), 'LayoutTests')): + _layout_tests_dir = LayoutDataDir() + else: + _layout_tests_dir = google.path_utils.FindUpward( + google.path_utils.ScriptDir(), 'third_party', 'WebKit') + + return _layout_tests_dir + def ChromiumPlatformResultsEnclosingDir(): """Returns the full path to the directory containing Chromium platform result directories. @@ -61,7 +83,7 @@ def ChromiumPlatformResultsEnclosingDir(): def WebKitPlatformResultsEnclosingDir(): """Gets the full path to just above the platform results directory.""" - return os.path.join(LayoutDataDir(), 'LayoutTests', 'platform') + return os.path.join(LayoutTestsDir(), 'LayoutTests', 'platform') def PlatformResultsEnclosingDir(platform): """Gets the path to just above the results directory for this platform.""" @@ -200,7 +222,7 @@ def LayoutTestHelperBinaryPath(target): def RelativeTestFilename(filename): """Provide the filename of the test relative to the layout data directory as a unix style path (a/b/c).""" - return WinPathToUnix(filename[len(LayoutDataDir()) + 1:]) + return WinPathToUnix(filename[len(LayoutTestsDir(filename)) + 1:]) def GetPlatformUtil(): """Returns a singleton instance of the PlatformUtility.""" diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_win.py b/webkit/tools/layout_tests/layout_package/platform_utils_win.py index 1a38f8f..2ba299a 100644 --- a/webkit/tools/layout_tests/layout_package/platform_utils_win.py +++ b/webkit/tools/layout_tests/layout_package/platform_utils_win.py @@ -118,7 +118,7 @@ class PlatformUtility(google.platform_utils_win.PlatformUtility): command for Apache 2.x instead of Apache 1.3.x """ layout_dir = google.platform_utils_win.GetCygwinPath( - layout_package_path_utils.LayoutDataDir()) + layout_package_path_utils.LayoutTestsDir()) main_document_root = os.path.join(layout_dir, "LayoutTests", "http", "tests") pending_document_root = os.path.join(layout_dir, "pending", diff --git a/webkit/tools/layout_tests/layout_package/test_expectations.py b/webkit/tools/layout_tests/layout_package/test_expectations.py index 0df9092..51945a6 100644 --- a/webkit/tools/layout_tests/layout_package/test_expectations.py +++ b/webkit/tools/layout_tests/layout_package/test_expectations.py @@ -455,7 +455,8 @@ class TestExpectationsFile: 'test times out indefinitely, the it should be listed as timeout.', test_and_expectations) - full_path = os.path.join(path_utils.LayoutDataDir(), test_list_path) + full_path = os.path.join(path_utils.LayoutTestsDir(test_list_path), + test_list_path) full_path = os.path.normpath(full_path) # WebKit's way of skipping tests is to add a -disabled suffix. # So we should consider the path existing if the path or the -disabled @@ -504,7 +505,8 @@ class TestExpectationsFile: def _ExpandTests(self, test_list_path): # Convert the test specification to an absolute, normalized # path and make sure directories end with the OS path separator. - path = os.path.join(path_utils.LayoutDataDir(), test_list_path) + path = os.path.join(path_utils.LayoutTestsDir(test_list_path), + test_list_path) path = os.path.normpath(path) if os.path.isdir(path): path = os.path.join(path, '') # This is kind of slow - O(n*m) - since this is called for all diff --git a/webkit/tools/layout_tests/rebaseline.py b/webkit/tools/layout_tests/rebaseline.py index 9d977ad..c3af23c 100644 --- a/webkit/tools/layout_tests/rebaseline.py +++ b/webkit/tools/layout_tests/rebaseline.py @@ -667,7 +667,7 @@ class HtmlGenerator(object): rows.append(self.HTML_TR % row) if rows: - test_path = os.path.join(path_utils.LayoutDataDir(), test) + test_path = os.path.join(path_utils.LayoutTestsDir(), test) html = self.HTML_TR_TEST % (path_utils.FilenameToUri(test_path), test) html += self.HTML_TEST_DETAIL % ' '.join(rows) diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py index 8465800..03ae887 100755 --- a/webkit/tools/layout_tests/run_webkit_tests.py +++ b/webkit/tools/layout_tests/run_webkit_tests.py @@ -146,9 +146,12 @@ class TestRunner: directory. glob patterns are ok. """ paths_to_walk = set() + # if paths is empty, provide a pre-defined list. + if not paths: + paths = TestRunner._shardable_directories for path in paths: # If there's an * in the name, assume it's a glob pattern. - path = os.path.join(path_utils.LayoutDataDir(), path) + path = os.path.join(path_utils.LayoutTestsDir(path), path) if path.find('*') > -1: filenames = glob.glob(path) paths_to_walk.update(filenames) @@ -676,7 +679,7 @@ class TestRunner: def _PrintTestListTiming(self, title, test_list): logging.debug(title) for test_tuple in test_list: - filename = test_tuple.filename[len(path_utils.LayoutDataDir()) + 1:] + filename = test_tuple.filename[len(path_utils.LayoutTestsDir()) + 1:] filename = filename.replace('\\', '/') test_run_time = round(test_tuple.test_run_time, 1) logging.debug("%s took %s seconds" % (filename, test_run_time)) @@ -1002,8 +1005,6 @@ def main(options, args): paths = [] if options.test_list: paths += ReadTestFiles(options.test_list) - if not paths: - paths = ['.'] test_runner = TestRunner(options, paths, platform_new_results_dir) |