Пример #1
0
 def test_is_testharness_baseline(self):
     self.assertTrue(is_testharness_baseline('fake-test-expected.txt'))
     self.assertTrue(
         is_testharness_baseline('external/wpt/fake-test-expected.txt'))
     self.assertTrue(
         is_testharness_baseline('/tmp/wpt/fake-test-expected.txt'))
     self.assertFalse(is_testharness_baseline('fake-test-expected.html'))
     self.assertFalse(
         is_testharness_baseline('external/wpt/fake-test-expected.html'))
Пример #2
0
    def _delete_orphaned_baselines(self):
        _log.info('Deleting any orphaned baselines.')

        is_baseline_filter = lambda fs, dirname, basename: is_testharness_baseline(
            basename)

        baselines = self.fs.files_under(self.dest_path,
                                        file_filter=is_baseline_filter)

        # TODO(qyearsley): Factor out the manifest path to a common location.
        # TODO(qyearsley): Factor out the manifest reading from here and Port
        # to WPTManifest.
        manifest_path = self.finder.path_from_layout_tests(
            'external', 'wpt', 'MANIFEST.json')
        manifest = WPTManifest(self.fs.read_text_file(manifest_path))
        wpt_urls = manifest.all_urls()

        # Currently baselines for tests with query strings are merged,
        # so that the tests foo.html?r=1 and foo.html?r=2 both have the same
        # baseline, foo-expected.txt.
        # TODO(qyearsley): Remove this when this behavior is fixed.
        wpt_urls = [url.split('?')[0] for url in wpt_urls]

        wpt_dir = self.finder.path_from_layout_tests('external', 'wpt')
        for full_path in baselines:
            rel_path = self.fs.relpath(full_path, wpt_dir)
            if not self._has_corresponding_test(rel_path, wpt_urls):
                self.fs.remove(full_path)