Changeset 82972 in webkit


Ignore:
Timestamp:
Apr 5, 2011 1:03:18 PM (13 years ago)
Author:
mihaip@chromium.org
Message:

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:
Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r82967 r82972  
     12011-04-05  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        Add --baseline-search-path to NRWT
     6        https://bugs.webkit.org/show_bug.cgi?id=56233
     7       
     8        Add NRWT option to specify additional directories to look for baselines
     9        (will be used by hardware GPU bots which will have local per-bot
     10        expectations for some tests)
     11
     12        * Scripts/webkitpy/common/system/filesystem_mock.py:
     13        * Scripts/webkitpy/layout_tests/port/base.py:
     14        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
     15        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     16
    1172011-04-05  Adam Roben  <aroben@apple.com>
    218
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py

    r82279 r82972  
    217217
    218218    def normpath(self, path):
    219         return path
     219        # Like join(), relies on os.path functionality but normalizes the
     220        # path separator to the mock one.
     221        return re.sub(re.escape(os.path.sep), self.sep, os.path.normpath(path))
    220222
    221223    def open_binary_tempfile(self, suffix=''):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r82705 r82972  
    283283        baseline_filename = testname + '-expected' + suffix
    284284
    285         baseline_search_path = self.baseline_search_path()
     285        baseline_search_path = self.get_option('baseline_search_path', []) + self.baseline_search_path()
    286286
    287287        baselines = []
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py

    r82705 r82972  
    3434from webkitpy.common.system.executive import Executive, ScriptError
    3535from webkitpy.common.system import executive_mock
    36 from webkitpy.common.system import filesystem
     36from webkitpy.common.system.filesystem_mock import MockFileSystem
    3737from webkitpy.common.system import outputcapture
    3838from webkitpy.common.system.path import abspath_to_uri
     
    233233        self.assertEqual(port.name(), 'foo')
    234234
     235    def test_baseline_search_path(self):
     236        filesystem = MockFileSystem()
     237        options, args = optparse.OptionParser().parse_args([])
     238        port = base.Port(port_name='foo', filesystem=filesystem, options=options)
     239        port.baseline_search_path = lambda: []
     240        layout_test_dir = port.layout_tests_dir()
     241        test_file = filesystem.join(layout_test_dir, 'fast', 'test.html')
     242
     243        # No baseline search path
     244        self.assertEqual(
     245            port.expected_baselines(test_file, '.txt'),
     246            [(None, 'fast/test-expected.txt')])
     247
     248        # Simple search path
     249        options.baseline_search_path = ['/tmp/local-baselines']
     250        filesystem.files = {
     251            '/tmp/local-baselines/fast/test-expected.txt': 'foo',
     252        }
     253        self.assertEqual(
     254            port.expected_baselines(test_file, '.txt'),
     255            [('/tmp/local-baselines', 'fast/test-expected.txt')])
     256
     257        # Multiple entries in search path
     258        options.baseline_search_path = ['/foo', '/tmp/local-baselines']
     259        self.assertEqual(
     260            port.expected_baselines(test_file, '.txt'),
     261            [('/tmp/local-baselines', 'fast/test-expected.txt')])
    235262
    236263class VirtualTest(unittest.TestCase):
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r82055 r82972  
    166166
    167167    options.slow_time_out_ms = str(5 * int(options.time_out_ms))
     168
     169    if options.baseline_search_path:
     170        normalized_search_paths = []
     171        for path in options.baseline_search_path:
     172            if not port_obj._filesystem.isabs(path):
     173                warnings.append("--baseline-search-path=%s is ignored since it is not absolute" % path)
     174                continue
     175            normalized_search_paths.append(port_obj._filesystem.normpath(path))
     176        options.baseline_search_path = normalized_search_paths
     177
    168178    return warnings
    169179
     
    289299            default=False, help="Reset any existing baselines to the "
    290300                 "generated results"),
     301        optparse.make_option("--baseline-search-path", action="append",
     302            default=[], help="Additional directory where to look for test "
     303                 "baselines (will take precendence over platform baselines). "
     304                 "Specify multiple times to add multiple search path entries."),
    291305        optparse.make_option("--no-show-results", action="store_false",
    292306            default=True, dest="show_results",
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

    r82704 r82972  
    197197
    198198    def test_child_process_1(self):
    199         (res, buildbot_output, regular_output, user) = logging_run(
     199        res, buildbot_output, regular_output, user = logging_run(
    200200             ['--print', 'config', '--worker-model', 'threads', '--child-processes', '1'])
    201201        self.assertTrue('Running one DumpRenderTree\n'
     
    203203
    204204    def test_child_processes_2(self):
    205         (res, buildbot_output, regular_output, user) = logging_run(
     205        res, buildbot_output, regular_output, user = logging_run(
    206206             ['--print', 'config', '--worker-model', 'threads', '--child-processes', '2'])
    207207        self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
     
    253253        # We do a logging run here instead of a passing run in order to
    254254        # suppress the output from the json generator.
    255         (res, buildbot_output, regular_output, user) = logging_run(['--clobber-old-results'], record_results=True, filesystem=fs)
    256         (res, buildbot_output, regular_output, user) = logging_run(
     255        res, buildbot_output, regular_output, user = logging_run(['--clobber-old-results'], record_results=True, filesystem=fs)
     256        res, buildbot_output, regular_output, user = logging_run(
    257257            ['--print-last-failures'], filesystem=fs)
    258258        self.assertEqual(regular_output.get(), ['\n\n'])
     
    372372    def test_exit_after_n_failures_upload(self):
    373373        fs = port.unit_test_filesystem()
    374         (res, buildbot_output, regular_output, user) = logging_run([
     374        res, buildbot_output, regular_output, user = logging_run([
    375375                'failures/unexpected/text-image-checksum.html',
    376376                'passes/text.html',
     
    572572                                  include_reference_html=True)
    573573        self.assertEquals(['passes/mismatch.html', 'passes/mismatch-expected-mismatch.html'], tests_run)
     574
     575    def test_baseline_search_path(self):
     576        self.assertTrue(passing_run(['--baseline-search-path', '/tmp/foo']))
     577        self.assertTrue(passing_run(['--baseline-search-path', '/tmp/../foo']))
     578        self.assertTrue(passing_run(['--baseline-search-path', '/tmp/foo',
     579            '--baseline-search-path', '/tmp/bar']))
     580
     581        res, buildbot_output, regular_output, user = logging_run(
     582             ['--baseline-search-path', 'foo'])
     583        self.assertTrue('--baseline-search-path=foo is ignored since it is not absolute\n'
     584                        in regular_output.get())
    574585
    575586
Note: See TracChangeset for help on using the changeset viewer.