Checks status files for incorrect syntax and duplicate keys.
| 732 | |
| 733 | |
| 734 | class StatusFilesProcessor(SourceFileProcessor): |
| 735 | """Checks status files for incorrect syntax and duplicate keys.""" |
| 736 | |
| 737 | def IsRelevant(self, name): |
| 738 | # Several changes to files under the test directories could impact status |
| 739 | # files. |
| 740 | return True |
| 741 | |
| 742 | def GetPathsToSearch(self): |
| 743 | return ['test', 'tools/testrunner'] |
| 744 | |
| 745 | def ProcessFiles(self, files): |
| 746 | success = True |
| 747 | for status_file_path in sorted(self._GetStatusFiles(files)): |
| 748 | success &= statusfile.PresubmitCheck(status_file_path) |
| 749 | success &= _CheckStatusFileForDuplicateKeys(status_file_path) |
| 750 | return success |
| 751 | |
| 752 | def _GetStatusFiles(self, files): |
| 753 | test_path = join(dirname(TOOLS_PATH), 'test') |
| 754 | testrunner_path = join(TOOLS_PATH, 'testrunner') |
| 755 | status_files = set() |
| 756 | |
| 757 | for file_path in files: |
| 758 | if file_path.startswith(testrunner_path): |
| 759 | for suitepath in os.listdir(test_path): |
| 760 | suitename = basename(suitepath) |
| 761 | status_file = join( |
| 762 | test_path, suitename, suitename + ".status") |
| 763 | if exists(status_file): |
| 764 | status_files.add(status_file) |
| 765 | return status_files |
| 766 | |
| 767 | for file_path in files: |
| 768 | if file_path.startswith(test_path): |
| 769 | # Strip off absolute path prefix pointing to test suites. |
| 770 | pieces = file_path[len(test_path):].lstrip(os.sep).split(os.sep) |
| 771 | if pieces: |
| 772 | # Infer affected status file name. Only care for existing status |
| 773 | # files. Some directories under "test" don't have any. |
| 774 | if not isdir(join(test_path, pieces[0])): |
| 775 | continue |
| 776 | status_file = join(test_path, pieces[0], pieces[0] + ".status") |
| 777 | if not exists(status_file): |
| 778 | continue |
| 779 | status_files.add(status_file) |
| 780 | return status_files |
| 781 | |
| 782 | |
| 783 | class GCMoleProcessor(SourceFileProcessor): |
no outgoing calls
no test coverage detected
searching dependent graphs…