Commit 7a24b613 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Move wildcards checking to statusfile presubmit.

Bug: v8:6917
Change-Id: Ia2ff836fc5b8bba42d9abe74c2387c26a63ad048
Reviewed-on: https://chromium-review.googlesource.com/782499Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#49601}
parent e9c6897b
...@@ -508,11 +508,30 @@ class StatusFilesProcessor(SourceFileProcessor): ...@@ -508,11 +508,30 @@ class StatusFilesProcessor(SourceFileProcessor):
return True return True
def GetPathsToSearch(self): def GetPathsToSearch(self):
return ['test'] return ['test', 'tools/testrunner']
def ProcessFiles(self, files): def ProcessFiles(self, files):
success = True
for status_file_path in sorted(self._GetStatusFiles(files)):
success &= statusfile.PresubmitCheck(status_file_path)
success &= _CheckStatusFileForDuplicateKeys(status_file_path)
return success
def _GetStatusFiles(self, files):
test_path = join(dirname(TOOLS_PATH), 'test') test_path = join(dirname(TOOLS_PATH), 'test')
status_files = set([]) testrunner_path = join(TOOLS_PATH, 'testrunner')
status_files = set()
for file_path in files:
if file_path.startswith(testrunner_path):
for suitepath in os.listdir(test_path):
suitename = os.path.basename(suitepath)
status_file = os.path.join(
test_path, suitename, suitename + ".status")
if os.path.exists(status_file):
status_files.add(status_file)
return status_files
for file_path in files: for file_path in files:
if file_path.startswith(test_path): if file_path.startswith(test_path):
# Strip off absolute path prefix pointing to test suites. # Strip off absolute path prefix pointing to test suites.
...@@ -526,12 +545,7 @@ class StatusFilesProcessor(SourceFileProcessor): ...@@ -526,12 +545,7 @@ class StatusFilesProcessor(SourceFileProcessor):
if not os.path.exists(status_file): if not os.path.exists(status_file):
continue continue
status_files.add(status_file) status_files.add(status_file)
return status_files
success = True
for status_file_path in sorted(status_files):
success &= statusfile.PresubmitCheck(status_file_path)
success &= _CheckStatusFileForDuplicateKeys(status_file_path)
return success
def CheckDeps(workspace): def CheckDeps(workspace):
......
...@@ -250,10 +250,6 @@ def _ReadSection(section, variables, rules, prefix_rules): ...@@ -250,10 +250,6 @@ def _ReadSection(section, variables, rules, prefix_rules):
for rule, outcome_list in section.iteritems(): for rule, outcome_list in section.iteritems():
assert type(rule) == str assert type(rule) == str
# Wildcards are allowed only as the last character.
wildcards_count = rule.count('*')
assert wildcards_count == 0 or (wildcards_count == 1 and rule[-1] == '*')
if rule[-1] == '*': if rule[-1] == '*':
_ParseOutcomeList(rule[:-1], outcome_list, variables, prefix_rules) _ParseOutcomeList(rule[:-1], outcome_list, variables, prefix_rules)
else: else:
...@@ -293,6 +289,8 @@ def PresubmitCheck(path): ...@@ -293,6 +289,8 @@ def PresubmitCheck(path):
"Suite name prefix must not be used in rule keys") "Suite name prefix must not be used in rule keys")
_assert(not rule.endswith('.js'), _assert(not rule.endswith('.js'),
".js extension must not be used in rule keys.") ".js extension must not be used in rule keys.")
_assert('*' not in rule or (rule.count('*') == 1 and rule[-1] == '*'),
"Only the last character of a rule key can be a wildcard")
if basename in JS_TEST_PATHS and '*' not in rule: if basename in JS_TEST_PATHS and '*' not in rule:
_assert(any(os.path.exists(os.path.join(os.path.dirname(path), _assert(any(os.path.exists(os.path.join(os.path.dirname(path),
*(paths + [rule + ".js"]))) *(paths + [rule + ".js"])))
......
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