summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authordpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 01:01:40 +0000
committerdpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 01:01:40 +0000
commitdda885c56f7a0da01ffd9d0835342ea6b3faa850 (patch)
treef8a7fde7b3da71eab386fe589ffd6744b5ec436c /webkit/tools
parentb45c207c9449325def739c6e1e07f18c4f332ddb (diff)
downloadchromium_src-dda885c56f7a0da01ffd9d0835342ea6b3faa850.zip
chromium_src-dda885c56f7a0da01ffd9d0835342ea6b3faa850.tar.gz
chromium_src-dda885c56f7a0da01ffd9d0835342ea6b3faa850.tar.bz2
un-revert 36487 (re-committing 36486) and move the missing baselines.
BUG=none TEST=none TBR=victorw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/layout_tests/layout_package/path_utils.py78
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_linux.py21
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_mac.py16
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_win.py48
-rw-r--r--webkit/tools/layout_tests/rebaseline.py12
5 files changed, 90 insertions, 85 deletions
diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py
index b10a54d..ce4bf75 100644
--- a/webkit/tools/layout_tests/layout_package/path_utils.py
+++ b/webkit/tools/layout_tests/layout_package/path_utils.py
@@ -23,7 +23,7 @@ import platform_utils_linux
# Cache some values so we don't have to recalculate them. _basedir is
# used by PathFromBase() and caches the full (native) path to the top
# of the source tree (/src). _baseline_search_path is used by
-# ExpectedBaseline() and caches the list of native paths to search
+# ExpectedBaselines() and caches the list of native paths to search
# for baseline results.
_basedir = None
_baseline_search_path = None
@@ -38,10 +38,22 @@ def LayoutTestsDir():
def ChromiumBaselinePath(platform=None):
"""Returns the full path to the directory containing expected
baseline results from chromium ports. If |platform| is None, the
- currently executing platform is used."""
- if platform is None:
- platform = platform_utils.PlatformName()
- return PathFromBase('webkit', 'data', 'layout_tests', 'platform', platform)
+ currently executing platform is used.
+
+ Note: although directly referencing individual platform_utils_* files is
+ usually discouraged, we allow it here so that the rebaselining tool can
+ pull baselines for platforms other than the host platform."""
+
+ # Normalize the platform string.
+ platform = PlatformName(platform)
+ if platform.startswith('chromium-mac'):
+ return platform_utils_mac.BaselinePath(platform)
+ elif platform.startswith('chromium-win'):
+ return platform_utils_win.BaselinePath(platform)
+ elif platform.startswith('chromium-linux'):
+ return platform_utils_linux.BaselinePath(platform)
+
+ return platform_utils.BaselinePath()
def WebKitBaselinePath(platform):
"""Returns the full path to the directory containing expected
@@ -53,28 +65,24 @@ def BaselineSearchPath(platform=None):
"""Returns the list of directories to search for baselines/results for a
given platform, in order of preference. Paths are relative to the top of the
source tree. If parameter platform is None, returns the list for the current
- platform that the script is running on."""
- if platform is None:
- return platform_utils.BaselineSearchPath(False)
- elif platform.startswith('mac'):
- return platform_utils_mac.BaselineSearchPath(True)
- elif platform.startswith('win'):
- return platform_utils_win.BaselineSearchPath(True)
- elif platform.startswith('linux'):
- return platform_utils_linux.BaselineSearchPath(True)
- else:
- return platform_utils.BaselineSearchPath(False)
+ platform that the script is running on.
-def ExpectedBaseline(filename, suffix, platform=None, all_baselines=False):
- """Given a test name, finds where the baseline result is located. The
- result is returned as a pair of values, the absolute path to top of the test
- results directory, and the relative path from there to the results file.
+ Note: although directly referencing individual platform_utils_* files is
+ usually discouraged, we allow it here so that the rebaselining tool can
+ pull baselines for platforms other than the host platform."""
- Both return values will be in the format appropriate for the
- current platform (e.g., "\\" for path separators on Windows).
+ # Normalize the platform name.
+ platform = PlatformName(platform)
+ if platform.startswith('chromium-mac'):
+ return platform_utils_mac.BaselineSearchPath(platform)
+ elif platform.startswith('chromium-win'):
+ return platform_utils_win.BaselineSearchPath(platform)
+ elif platform.startswith('chromium-linux'):
+ return platform_utils_linux.BaselineSearchPath(platform)
+ return platform_utils.BaselineSearchPath()
- If the results file is not found, then None will be returned for the
- directory, but the expected relative pathname will still be returned.
+def ExpectedBaselines(filename, suffix, platform=None, all_baselines=False):
+ """Given a test name, finds where the baseline results are located.
Args:
filename: absolute filename to test file
@@ -91,6 +99,10 @@ def ExpectedBaseline(filename, suffix, platform=None, all_baselines=False):
results_filename - relative path from top of tree to the results file
(os.path.join of the two gives you the full path to the file, unless
None was returned.)
+ Return values will be in the format appropriate for the current platform
+ (e.g., "\\" for path separators on Windows). If the results file is not
+ found, then None will be returned for the directory, but the expected
+ relative pathname will still be returned.
"""
global _baseline_search_path
global _search_path_platform
@@ -102,21 +114,13 @@ def ExpectedBaseline(filename, suffix, platform=None, all_baselines=False):
_baseline_search_path = BaselineSearchPath(platform)
_search_path_platform = platform
- current_platform_dir = ChromiumBaselinePath(PlatformName(platform))
-
baselines = []
- foundCurrentPlatform = False
for platform_dir in _baseline_search_path:
- # Find current platform from baseline search paths and start from there.
- if platform_dir == current_platform_dir:
- foundCurrentPlatform = True
-
- if foundCurrentPlatform:
- if os.path.exists(os.path.join(platform_dir, baseline_filename)):
- baselines.append((platform_dir, baseline_filename))
+ if os.path.exists(os.path.join(platform_dir, baseline_filename)):
+ baselines.append((platform_dir, baseline_filename))
- if not all_baselines and baselines:
- return baselines
+ if not all_baselines and baselines:
+ return baselines
# If it wasn't found in a platform directory, return the expected result
# in the test directory, even if no such file actually exists.
@@ -145,7 +149,7 @@ def ExpectedFilename(filename, suffix):
search list of directories, e.g., 'chromium-win', or
'chromium-mac-leopard' (we follow the WebKit format)
"""
- platform_dir, baseline_filename = ExpectedBaseline(filename, suffix)[0]
+ platform_dir, baseline_filename = ExpectedBaselines(filename, suffix)[0]
if platform_dir:
return os.path.join(platform_dir, baseline_filename)
return os.path.join(LayoutTestsDir(), baseline_filename)
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
index a153547..d14ca00 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
@@ -12,6 +12,7 @@ import sys
import logging
import path_utils
+import platform_utils_win
def PlatformName():
"""Returns the name of the platform we're currently running on."""
@@ -31,16 +32,20 @@ def GetNumCores():
return num_cores
return 1
-def BaselineSearchPath(all_versions=False):
+def BaselinePath(platform=None):
+ """Returns the path relative to the top of the source tree for the
+ baselines for the specified platform version. If |platform| is None,
+ then the version currently in use is used."""
+ if platform is None:
+ platform = PlatformName()
+ return path_utils.PathFromBase('webkit', 'data', 'layout_tests',
+ 'platform', platform, 'LayoutTests')
+
+def BaselineSearchPath(platform=None):
"""Returns the list of directories to search for baselines/results, in
order of preference. Paths are relative to the top of the source tree."""
- # TODO(dpranke): remove the 'LayoutTests' dirs once we move the baselines.
- return [path_utils.ChromiumBaselinePath(PlatformName()),
- os.path.join(path_utils.ChromiumBaselinePath(PlatformName()),
- "LayoutTests"),
- path_utils.ChromiumBaselinePath('chromium-win'),
- os.path.join(path_utils.ChromiumBaselinePath('chromium-win'),
- "LayoutTests"),
+ return [BaselinePath(platform),
+ platform_utils_win.BaselinePath('chromium-win'),
path_utils.WebKitBaselinePath('win'),
path_utils.WebKitBaselinePath('mac')]
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
index bb78c89..11d434e 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
@@ -41,15 +41,21 @@ def GetNumCores():
this will be double the number of actual processors."""
return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+def BaselinePath(platform=None):
+ """Returns the path relative to the top of the source tree for the
+ baselines for the specified platform version. If |platform| is None,
+ then the version currently in use is used."""
+ if platform is None:
+ platform = PlatformName()
+ return path_utils.PathFromBase('webkit', 'data', 'layout_tests',
+ 'platform', platform, 'LayoutTests')
+
# TODO: We should add leopard and snowleopard to the list of paths to check
# once we start running the tests from snowleopard.
-def BaselineSearchPath(all_versions=False):
+def BaselineSearchPath(platform=None):
"""Returns the list of directories to search for baselines/results, in
order of preference. Paths are relative to the top of the source tree."""
- # TODO(dpranke): remove the 'LayoutTests' dirs once we move the baselines.
- return [path_utils.ChromiumBaselinePath(PlatformName()),
- os.path.join(path_utils.ChromiumBaselinePath(PlatformName()),
- "LayoutTests"),
+ return [BaselinePath(platform),
path_utils.WebKitBaselinePath('mac' + PlatformVersion()),
path_utils.WebKitBaselinePath('mac')]
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 947327e..63a8908 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_win.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_win.py
@@ -34,37 +34,27 @@ def GetNumCores():
this will be double the number of actual processors."""
return int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
-def BaselineSearchPath(all_versions=False):
+def BaselinePath(platform=None):
+ """Returns the path relative to the top of the source tree for the
+ baselines for the specified platform version. If |platform| is None,
+ then the version currently in use is used."""
+ if platform is None:
+ platform = PlatformName()
+ return path_utils.PathFromBase('webkit', 'data', 'layout_tests',
+ 'platform', platform, 'LayoutTests')
+
+def BaselineSearchPath(platform=None):
"""Returns the list of directories to search for baselines/results, in
- order of preference. Paths are relative to the top of the source tree.
-
- If all_versions is True, returns the full list of search directories
- for all versions instead of the current version that the script
- is running on. This is for case that the platform or version of
- the search paths is different from the platform or version that the
- script is running on. For example, the rebaseline tool may run on Mac,
- Linux or Windows Vista to rebaseline for Windows XP, in which case,
- it gets a full list, finds the rebaselining dir (XP) and compares
- the XP baseline with fallback baselines.
- """
-
+ order of preference. Paths are relative to the top of the source tree."""
dirs = []
- # TODO(dpranke): remove the 'LayoutTests' dirs once we move the baselines.
- if all_versions or PlatformVersion() == "-xp":
- dirs.append(path_utils.ChromiumBaselinePath('chromium-win-xp'))
- dirs.append(os.path.join(
- path_utils.ChromiumBaselinePath('chromium-win-xp'), 'LayoutTests'))
- if all_versions or PlatformVersion() in ("-vista", "-xp"):
- dirs.append(path_utils.ChromiumBaselinePath('chromium-win-vista'))
- dirs.append(os.path.join(
- path_utils.ChromiumBaselinePath('chromium-win-vista'), 'LayoutTests'))
- if all_versions or PlatformVersion() in ("-7", "-vista", "-xp"):
- dirs.append(path_utils.ChromiumBaselinePath('chromium-win-7'))
- dirs.append(os.path.join(
- path_utils.ChromiumBaselinePath('chromium-win-7'), 'LayoutTests'))
- dirs.append(path_utils.ChromiumBaselinePath('chromium-win'))
- dirs.append(os.path.join(
- path_utils.ChromiumBaselinePath('chromium-win'), 'LayoutTests'))
+ if platform is None:
+ platform = PlatformName()
+
+ if platform == 'chromium-win-xp':
+ dirs.append(BaselinePath(platform))
+ if platform in ('chromium-win-xp', 'chromium-win-vista'):
+ dirs.append(BaselinePath('chromium-win-vista'))
+ dirs.append(BaselinePath('chromium-win'))
dirs.append(path_utils.WebKitBaselinePath('win'))
dirs.append(path_utils.WebKitBaselinePath('mac'))
return dirs
diff --git a/webkit/tools/layout_tests/rebaseline.py b/webkit/tools/layout_tests/rebaseline.py
index c64358d..81104fc 100644
--- a/webkit/tools/layout_tests/rebaseline.py
+++ b/webkit/tools/layout_tests/rebaseline.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!usr/bin/env python
# Copyright (c) 2006-2009 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.
@@ -394,7 +394,7 @@ class Rebaseliner(object):
expected_filename = '%s-expected%s' % (test_basename, suffix)
expected_fullpath = os.path.join(
- path_utils.ChromiumBaselinePath(platform), "LayoutTests", expected_filename)
+ path_utils.ChromiumBaselinePath(platform), expected_filename)
expected_fullpath = os.path.normpath(expected_fullpath)
logging.debug(' Expected file full path: "%s"', expected_fullpath)
@@ -455,10 +455,10 @@ class Rebaseliner(object):
False otherwise.
"""
test_filepath = os.path.join(path_utils.LayoutTestsDir(), test)
- all_baselines = path_utils.ExpectedBaseline(test_filepath,
- suffix,
- platform,
- True)
+ all_baselines = path_utils.ExpectedBaselines(test_filepath,
+ suffix,
+ platform,
+ True)
for (fallback_dir, fallback_file) in all_baselines:
if fallback_dir and fallback_file:
fallback_fullpath = os.path.normpath(