Commit 6fa7a75c authored by mihaip@chromium.org's avatar mihaip@chromium.org

2011-04-05 Mihai Parparita <mihaip@chromium.org>

        Reviewed by Tony Chang.

        Add --baseline-search-path to NRWT
        https://bugs.webkit.org/show_bug.cgi?id=56233

        Add NRWT option to specify additional directories to look for baselines
        (will be used by hardware GPU bots which will have local per-bot
        expectations for some tests)

        * Scripts/webkitpy/common/system/filesystem_mock.py:
        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:

git-svn-id: svn://svn.chromium.org/blink/trunk@82972 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 10f16bca
2011-04-05 Mihai Parparita <mihaip@chromium.org>
Reviewed by Tony Chang.
Add --baseline-search-path to NRWT
https://bugs.webkit.org/show_bug.cgi?id=56233
Add NRWT option to specify additional directories to look for baselines
(will be used by hardware GPU bots which will have local per-bot
expectations for some tests)
* Scripts/webkitpy/common/system/filesystem_mock.py:
* Scripts/webkitpy/layout_tests/port/base.py:
* Scripts/webkitpy/layout_tests/port/base_unittest.py:
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
2011-04-05 Adam Roben <aroben@apple.com>
Strip off /results.html from results URLs before trying to load leaks files from them
......
......@@ -216,7 +216,9 @@ class MockFileSystem(object):
self.written_files[source] = None
def normpath(self, path):
return path
# Like join(), relies on os.path functionality but normalizes the
# path separator to the mock one.
return re.sub(re.escape(os.path.sep), self.sep, os.path.normpath(path))
def open_binary_tempfile(self, suffix=''):
path = self._mktemp(suffix)
......
......@@ -282,7 +282,7 @@ class Port(object):
baseline_filename = testname + '-expected' + suffix
baseline_search_path = self.baseline_search_path()
baseline_search_path = self.get_option('baseline_search_path', []) + self.baseline_search_path()
baselines = []
for platform_dir in baseline_search_path:
......
......@@ -33,7 +33,7 @@ import unittest
from webkitpy.common.system.executive import Executive, ScriptError
from webkitpy.common.system import executive_mock
from webkitpy.common.system import filesystem
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system import outputcapture
from webkitpy.common.system.path import abspath_to_uri
from webkitpy.thirdparty.mock import Mock
......@@ -232,6 +232,33 @@ class PortTest(unittest.TestCase):
port = base.Port(port_name='foo')
self.assertEqual(port.name(), 'foo')
def test_baseline_search_path(self):
filesystem = MockFileSystem()
options, args = optparse.OptionParser().parse_args([])
port = base.Port(port_name='foo', filesystem=filesystem, options=options)
port.baseline_search_path = lambda: []
layout_test_dir = port.layout_tests_dir()
test_file = filesystem.join(layout_test_dir, 'fast', 'test.html')
# No baseline search path
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[(None, 'fast/test-expected.txt')])
# Simple search path
options.baseline_search_path = ['/tmp/local-baselines']
filesystem.files = {
'/tmp/local-baselines/fast/test-expected.txt': 'foo',
}
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[('/tmp/local-baselines', 'fast/test-expected.txt')])
# Multiple entries in search path
options.baseline_search_path = ['/foo', '/tmp/local-baselines']
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[('/tmp/local-baselines', 'fast/test-expected.txt')])
class VirtualTest(unittest.TestCase):
"""Tests that various methods expected to be virtual are."""
......
......@@ -165,6 +165,16 @@ def _set_up_derived_options(port_obj, options):
options.time_out_ms = str(test_runner.TestRunner.DEFAULT_TEST_TIMEOUT_MS)
options.slow_time_out_ms = str(5 * int(options.time_out_ms))
if options.baseline_search_path:
normalized_search_paths = []
for path in options.baseline_search_path:
if not port_obj._filesystem.isabs(path):
warnings.append("--baseline-search-path=%s is ignored since it is not absolute" % path)
continue
normalized_search_paths.append(port_obj._filesystem.normpath(path))
options.baseline_search_path = normalized_search_paths
return warnings
......@@ -288,6 +298,10 @@ def parse_args(args=None):
optparse.make_option("--reset-results", action="store_true",
default=False, help="Reset any existing baselines to the "
"generated results"),
optparse.make_option("--baseline-search-path", action="append",
default=[], help="Additional directory where to look for test "
"baselines (will take precendence over platform baselines). "
"Specify multiple times to add multiple search path entries."),
optparse.make_option("--no-show-results", action="store_false",
default=True, dest="show_results",
help="Don't launch a browser with results after the tests "
......
......@@ -196,13 +196,13 @@ class MainTest(unittest.TestCase):
self.assertTrue(len(batch) <= 2, '%s had too many tests' % ', '.join(batch))
def test_child_process_1(self):
(res, buildbot_output, regular_output, user) = logging_run(
res, buildbot_output, regular_output, user = logging_run(
['--print', 'config', '--worker-model', 'threads', '--child-processes', '1'])
self.assertTrue('Running one DumpRenderTree\n'
in regular_output.get())
def test_child_processes_2(self):
(res, buildbot_output, regular_output, user) = logging_run(
res, buildbot_output, regular_output, user = logging_run(
['--print', 'config', '--worker-model', 'threads', '--child-processes', '2'])
self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
in regular_output.get())
......@@ -252,8 +252,8 @@ class MainTest(unittest.TestCase):
fs = port.unit_test_filesystem()
# We do a logging run here instead of a passing run in order to
# suppress the output from the json generator.
(res, buildbot_output, regular_output, user) = logging_run(['--clobber-old-results'], record_results=True, filesystem=fs)
(res, buildbot_output, regular_output, user) = logging_run(
res, buildbot_output, regular_output, user = logging_run(['--clobber-old-results'], record_results=True, filesystem=fs)
res, buildbot_output, regular_output, user = logging_run(
['--print-last-failures'], filesystem=fs)
self.assertEqual(regular_output.get(), ['\n\n'])
self.assertEqual(buildbot_output.get(), [])
......@@ -371,7 +371,7 @@ class MainTest(unittest.TestCase):
def test_exit_after_n_failures_upload(self):
fs = port.unit_test_filesystem()
(res, buildbot_output, regular_output, user) = logging_run([
res, buildbot_output, regular_output, user = logging_run([
'failures/unexpected/text-image-checksum.html',
'passes/text.html',
'--exit-after-n-failures', '1',
......@@ -572,6 +572,17 @@ class MainTest(unittest.TestCase):
include_reference_html=True)
self.assertEquals(['passes/mismatch.html', 'passes/mismatch-expected-mismatch.html'], tests_run)
def test_baseline_search_path(self):
self.assertTrue(passing_run(['--baseline-search-path', '/tmp/foo']))
self.assertTrue(passing_run(['--baseline-search-path', '/tmp/../foo']))
self.assertTrue(passing_run(['--baseline-search-path', '/tmp/foo',
'--baseline-search-path', '/tmp/bar']))
res, buildbot_output, regular_output, user = logging_run(
['--baseline-search-path', 'foo'])
self.assertTrue('--baseline-search-path=foo is ignored since it is not absolute\n'
in regular_output.get())
MainTest = skip_if(MainTest, sys.platform == 'cygwin' and compare_version(sys, '2.6')[0] < 0, 'new-run-webkit-tests tests hang on Cygwin Python 2.5.2')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment