summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 01:24:37 +0000
committerpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 01:24:37 +0000
commita3092904ae9d100bd7e9e12a2df1897382837c9b (patch)
tree16ff9ecb3037f1d69e7a23b03b83d55951b811b6
parentc7c42339edf2a4ee2e77736d90c916125365341c (diff)
downloadchromium_src-a3092904ae9d100bd7e9e12a2df1897382837c9b.zip
chromium_src-a3092904ae9d100bd7e9e12a2df1897382837c9b.tar.gz
chromium_src-a3092904ae9d100bd7e9e12a2df1897382837c9b.tar.bz2
Place all new baseline files in the most specific platform directory.
The --new-baseline option no longer takes a directory name. BUG=4408 TEST=try re-baselining a file, make sure results go in the right place Review URL: http://codereview.chromium.org/10926 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5524 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/layout_tests/layout_package/path_utils.py7
-rw-r--r--webkit/tools/layout_tests/run_webkit_tests.py22
-rw-r--r--webkit/tools/layout_tests/test_types/image_diff.py10
-rw-r--r--webkit/tools/layout_tests/test_types/simplified_text_diff.py6
-rw-r--r--webkit/tools/layout_tests/test_types/test_type_base.py32
-rw-r--r--webkit/tools/layout_tests/test_types/text_diff.py5
6 files changed, 38 insertions, 44 deletions
diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py
index f7207b6..6659439 100644
--- a/webkit/tools/layout_tests/layout_package/path_utils.py
+++ b/webkit/tools/layout_tests/layout_package/path_utils.py
@@ -53,19 +53,18 @@ def LayoutDataDir():
def ChromiumPlatformResultsDir():
"""Returns the full path to the directory containing Chromium platform
- result directories. Raises PathNotFound if we're unable to find it.
+ result directories.
"""
# TODO(pamg): Once we move platform/chromium-* into LayoutTests/platform/,
# remove this and use PlatformResultsDir() for everything.
return os.path.join(LayoutDataDir(), 'platform')
def WebKitPlatformResultsDir():
- """Gets the full path to the platform results directory. Raises
- PathNotFound if we're unable to find it."""
+ """Gets the full path to just above the platform results directory."""
return os.path.join(LayoutDataDir(), 'LayoutTests', 'platform')
def PlatformResultsDir(platform):
- """Gets the full path to the results directory for this platform."""
+ """Gets the path to just above the results directory for this platform."""
if platform.startswith('chromium'):
return ChromiumPlatformResultsDir()
return WebKitPlatformResultsDir()
diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py
index 91cca89..83550d0 100644
--- a/webkit/tools/layout_tests/run_webkit_tests.py
+++ b/webkit/tools/layout_tests/run_webkit_tests.py
@@ -232,12 +232,7 @@ class TestRunner:
test_args.png_path = png_path
test_args.wdiff = self._options.wdiff
-
- if self._options.new_baseline:
- test_args.new_baseline = self._options.new_baseline
- if self._options.no_pixel_tests:
- test_args.text_baseline = True
-
+ test_args.new_baseline = self._options.new_baseline
test_args.show_sources = self._options.sources
# Create separate TestTypes instances for each thread.
@@ -515,6 +510,10 @@ def main(options, args):
logging.info("Using platform '%s'" % options.platform)
logging.info("Placing test results in %s" % options.results_directory)
+ if options.new_baseline:
+ logging.info("Placing new baselines in %s" %
+ os.path.join(path_utils.PlatformResultsDir(options.platform),
+ options.platform))
logging.info("Using %s build at %s" %
(options.target, test_shell_binary_path))
if not options.no_pixel_tests:
@@ -568,12 +567,11 @@ if '__main__' == __name__:
default="layout-test-results",
help="Output results directory source dir,"
" relative to Debug or Release")
- option_parser.add_option("", "--new-baseline", default=None, metavar="DIR",
- help="save results as new baselines into this "
- "directory (e.g. layout_test_results/v8), "
- "overwriting whatever's already there. "
- "If pixel tests are being run, only image "
- "baselines will be saved, not text.")
+ option_parser.add_option("", "--new-baseline", action="store_true",
+ default=False,
+ help="save all generated results as new baselines "
+ "into the platform directory, overwriting "
+ "whatever's already there.")
option_parser.add_option("", "--noshow-results", action="store_true",
default=False, help="don't launch the test_shell"
" with results after the tests are done")
diff --git a/webkit/tools/layout_tests/test_types/image_diff.py b/webkit/tools/layout_tests/test_types/image_diff.py
index 0964266..07c7561 100644
--- a/webkit/tools/layout_tests/test_types/image_diff.py
+++ b/webkit/tools/layout_tests/test_types/image_diff.py
@@ -39,20 +39,19 @@ class ImageDiff(test_type_base.TestTypeBase):
if errno.ENOENT != e.errno:
raise
- def _SaveBaselineFiles(self, filename, dest_dir, png_path, checksum):
+ def _SaveBaselineFiles(self, filename, png_path, checksum):
"""Saves new baselines for the PNG and checksum.
Args:
filename: test filename
- dest_dir: outer directory into which the results should be saved.
png_path: path to the actual PNG result file
checksum: value of the actual checksum result
"""
png_file = open(png_path, "rb")
png_data = png_file.read()
png_file.close()
- self._SaveBaselineData(filename, dest_dir, png_data, ".png")
- self._SaveBaselineData(filename, dest_dir, checksum, ".checksum")
+ self._SaveBaselineData(filename, png_data, ".png")
+ self._SaveBaselineData(filename, checksum, ".checksum")
def CompareOutput(self, filename, proc, output, test_args):
"""Implementation of CompareOutput that checks the output image and
@@ -66,8 +65,7 @@ class ImageDiff(test_type_base.TestTypeBase):
# If we're generating a new baseline, we pass.
if test_args.new_baseline:
- self._SaveBaselineFiles(filename, test_args.new_baseline,
- test_args.png_path, test_args.hash)
+ self._SaveBaselineFiles(filename, test_args.png_path, test_args.hash)
return failures
# Compare hashes.
diff --git a/webkit/tools/layout_tests/test_types/simplified_text_diff.py b/webkit/tools/layout_tests/test_types/simplified_text_diff.py
index 46e7e8a..bd1de3e 100644
--- a/webkit/tools/layout_tests/test_types/simplified_text_diff.py
+++ b/webkit/tools/layout_tests/test_types/simplified_text_diff.py
@@ -83,7 +83,7 @@ class SimplifiedTextDiff(text_diff.TestTextDiff):
return text
- def CompareOutput(self, filename, proc, output, unused_test_args):
+ def CompareOutput(self, filename, proc, output, test_args):
"""Implementation of CompareOutput that removes most numbers before
computing the diff.
@@ -92,6 +92,10 @@ class SimplifiedTextDiff(text_diff.TestTextDiff):
"""
failures = []
+ # If we're generating a new baseline, we pass.
+ if test_args.new_baseline:
+ return failures
+
# Normalize text to diff
output = self.GetNormalizedOutputText(output)
# The full text diff already gave the result file if requested, so we'll
diff --git a/webkit/tools/layout_tests/test_types/test_type_base.py b/webkit/tools/layout_tests/test_types/test_type_base.py
index 9e1a163..ea5308b 100644
--- a/webkit/tools/layout_tests/test_types/test_type_base.py
+++ b/webkit/tools/layout_tests/test_types/test_type_base.py
@@ -20,12 +20,8 @@ from layout_package import platform_utils
class TestArguments(object):
"""Struct-like wrapper for additional arguments needed by specific tests."""
- # Outer directory in which to place new baseline results.
- new_baseline = None
-
- # Whether to save new text baseline files (otherwise only save image
- # results as a new baseline).
- text_baseline = False
+ # Whether to save new baseline results.
+ new_baseline = False
# Path to the actual PNG file generated by pixel tests
png_path = None
@@ -63,26 +59,26 @@ class TestTypeBase(object):
path_utils.RelativeTestFilename(filename))
google.path_utils.MaybeMakeDirectory(os.path.split(output_filename)[0])
- def _SaveBaselineData(self, filename, dest_dir, data, modifier):
- """Saves a new baseline file.
+ def _SaveBaselineData(self, filename, data, modifier):
+ """Saves a new baseline file into the platform directory.
The file will be named simply "<test>-expected<modifier>", suitable for
use as the expected results in a later run.
Args:
- filename: the test filename
- dest_dir: the outer directory into which the results should be saved.
- The subdirectory corresponding to this test will be created if
- necessary.
+ filename: path to the test file
data: result to be saved as the new baseline
modifier: type of the result file, e.g. ".txt" or ".png"
"""
- output_filename = os.path.join(dest_dir,
- path_utils.RelativeTestFilename(filename))
- output_filename = (os.path.splitext(output_filename)[0] +
- self.FILENAME_SUFFIX_EXPECTED + modifier)
- google.path_utils.MaybeMakeDirectory(os.path.split(output_filename)[0])
- open(output_filename, "wb").write(data)
+ relative_dir = os.path.dirname(path_utils.RelativeTestFilename(filename))
+ output_dir = os.path.join(path_utils.PlatformResultsDir(self._platform),
+ self._platform,
+ relative_dir)
+ output_file = os.path.basename(os.path.splitext(filename)[0] +
+ self.FILENAME_SUFFIX_EXPECTED + modifier)
+
+ google.path_utils.MaybeMakeDirectory(output_dir)
+ open(os.path.join(output_dir, output_file), "wb").write(data)
def OutputFilename(self, filename, modifier):
"""Returns a filename inside the output dir that contains modifier.
diff --git a/webkit/tools/layout_tests/test_types/text_diff.py b/webkit/tools/layout_tests/test_types/text_diff.py
index 8b188cd..97e11b3 100644
--- a/webkit/tools/layout_tests/test_types/text_diff.py
+++ b/webkit/tools/layout_tests/test_types/text_diff.py
@@ -51,9 +51,8 @@ class TestTextDiff(test_type_base.TestTypeBase):
failures = []
# If we're generating a new baseline, we pass.
- if test_args.text_baseline:
- self._SaveBaselineData(filename, test_args.new_baseline,
- output, ".txt")
+ if test_args.new_baseline:
+ self._SaveBaselineData(filename, output, ".txt")
return failures
# Normalize text to diff