Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 2729133006: Fix orphaned wpt -expected.txt file deletion logic. (Closed)
Patch Set: Remove orphan baselines; remove print line Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 """Returns a list of expectation (== or !=) and filename pairs""" 654 """Returns a list of expectation (== or !=) and filename pairs"""
655 655
656 # Try to extract information from reftest.list. 656 # Try to extract information from reftest.list.
657 reftest_list = self._get_reftest_list(test_name) 657 reftest_list = self._get_reftest_list(test_name)
658 if reftest_list: 658 if reftest_list:
659 return reftest_list.get(self._filesystem.join(self.layout_tests_dir( ), test_name), []) 659 return reftest_list.get(self._filesystem.join(self.layout_tests_dir( ), test_name), [])
660 660
661 # Try to find -expected.* or -expected-mismatch.* in the same directory. 661 # Try to find -expected.* or -expected-mismatch.* in the same directory.
662 reftest_list = [] 662 reftest_list = []
663 for expectation, prefix in (('==', ''), ('!=', '-mismatch')): 663 for expectation, prefix in (('==', ''), ('!=', '-mismatch')):
664 for extension in Port._supported_file_extensions: 664 for extension in Port.supported_file_extensions:
665 path = self.expected_filename(test_name, prefix + extension) 665 path = self.expected_filename(test_name, prefix + extension)
666 if self._filesystem.exists(path): 666 if self._filesystem.exists(path):
667 reftest_list.append((expectation, path)) 667 reftest_list.append((expectation, path))
668 if reftest_list: 668 if reftest_list:
669 return reftest_list 669 return reftest_list
670 670
671 # Try to extract information from MANIFEST.json. 671 # Try to extract information from MANIFEST.json.
672 match = re.match(r'external/wpt/(.*)', test_name) 672 match = re.match(r'external/wpt/(.*)', test_name)
673 if not match: 673 if not match:
674 return [] 674 return []
(...skipping 14 matching lines...) Expand all
689 tests.extend(self._all_virtual_tests(suites)) 689 tests.extend(self._all_virtual_tests(suites))
690 return tests 690 return tests
691 691
692 def real_tests(self, paths): 692 def real_tests(self, paths):
693 # When collecting test cases, skip these directories. 693 # When collecting test cases, skip these directories.
694 skipped_directories = set(['.svn', '_svn', 'platform', 'resources', 'sup port', 'script-tests', 'reference', 'reftest']) 694 skipped_directories = set(['.svn', '_svn', 'platform', 'resources', 'sup port', 'script-tests', 'reference', 'reftest'])
695 files = find_files.find(self._filesystem, self.layout_tests_dir(), paths , 695 files = find_files.find(self._filesystem, self.layout_tests_dir(), paths ,
696 skipped_directories, functools.partial(Port.is_t est_file, self), self.test_key) 696 skipped_directories, functools.partial(Port.is_t est_file, self), self.test_key)
697 return self._convert_wpt_file_paths_to_url_paths([self.relative_test_fil ename(f) for f in files]) 697 return self._convert_wpt_file_paths_to_url_paths([self.relative_test_fil ename(f) for f in files])
698 698
699 # When collecting test cases, we include any file with these extensions.
700 _supported_file_extensions = set(['.html', '.xml', '.xhtml', '.xht', '.pl',
701 '.htm', '.php', '.svg', '.mht', '.pdf'])
702
703 @staticmethod 699 @staticmethod
704 # If any changes are made here be sure to update the isUsedInReftest method in old-run-webkit-tests as well. 700 # If any changes are made here be sure to update the isUsedInReftest method in old-run-webkit-tests as well.
705 def is_reference_html_file(filesystem, dirname, filename): 701 def is_reference_html_file(filesystem, dirname, filename):
706 if filename.startswith('ref-') or filename.startswith('notref-'): 702 if filename.startswith('ref-') or filename.startswith('notref-'):
707 return True 703 return True
708 filename_without_ext, _ = filesystem.splitext(filename) 704 filename_without_ext, _ = filesystem.splitext(filename)
709 for suffix in ['-expected', '-expected-mismatch', '-ref', '-notref']: 705 for suffix in ['-expected', '-expected-mismatch', '-ref', '-notref']:
710 if filename_without_ext.endswith(suffix): 706 if filename_without_ext.endswith(suffix):
711 return True 707 return True
712 return False 708 return False
713 709
710 # When collecting test cases, we include any file with these extensions.
711 supported_file_extensions = set([
712 '.html', '.xml', '.xhtml', '.xht', '.pl',
713 '.htm', '.php', '.svg', '.mht', '.pdf',
714 ])
715
714 @staticmethod 716 @staticmethod
715 def _has_supported_extension(filesystem, filename): 717 def _has_supported_extension(filesystem, filename):
716 """Returns True if filename is one of the file extensions we want to run a test on.""" 718 """Returns True if filename is one of the file extensions we want to run a test on."""
717 extension = filesystem.splitext(filename)[1] 719 extension = filesystem.splitext(filename)[1]
718 return extension in Port._supported_file_extensions 720 return extension in Port.supported_file_extensions
719 721
720 def is_test_file(self, filesystem, dirname, filename): 722 def is_test_file(self, filesystem, dirname, filename):
721 match = re.search(r'[/\\]external[/\\]wpt([/\\].*)?$', dirname) 723 match = re.search(r'[/\\]external[/\\]wpt([/\\].*)?$', dirname)
722 if match: 724 if match:
723 if match.group(1): 725 if match.group(1):
724 path_in_wpt = match.group(1)[1:].replace('\\', '/') + '/' + file name 726 path_in_wpt = match.group(1)[1:].replace('\\', '/') + '/' + file name
725 else: 727 else:
726 path_in_wpt = filename 728 path_in_wpt = filename
727 return self._wpt_manifest().is_test_file(path_in_wpt) 729 return self._wpt_manifest().is_test_file(path_in_wpt)
728 if 'inspector-unit' in dirname: 730 if 'inspector-unit' in dirname:
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 1637
1636 def __init__(self, base, args, reference_args=None): 1638 def __init__(self, base, args, reference_args=None):
1637 self.name = base 1639 self.name = base
1638 self.base = base 1640 self.base = base
1639 self.args = args 1641 self.args = args
1640 self.reference_args = args if reference_args is None else reference_args 1642 self.reference_args = args if reference_args is None else reference_args
1641 self.tests = set() 1643 self.tests = set()
1642 1644
1643 def __repr__(self): 1645 def __repr__(self):
1644 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1646 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698