Commit e3f33f52 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[flags][testrunner] inform about failing flag expectations

Bug: v8:10577

Change-Id: I28aaec30b73def5034294f71bb6bda466172b4ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2400978
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70055}
parent 8fddce9d
...@@ -91,6 +91,7 @@ class TestCase(object): ...@@ -91,6 +91,7 @@ class TestCase(object):
self._expected_outcomes = None self._expected_outcomes = None
self._checked_flag_contradictions = False self._checked_flag_contradictions = False
self._statusfile_flags = None self._statusfile_flags = None
self.expected_failure_reason = None
self._prepare_outcomes() self._prepare_outcomes()
...@@ -168,6 +169,15 @@ class TestCase(object): ...@@ -168,6 +169,15 @@ class TestCase(object):
return any(flag.startswith(conflicting_flag[:-1]) for flag in flags) return any(flag.startswith(conflicting_flag[:-1]) for flag in flags)
return False return False
def check_flags(incompatible_flags, actual_flags, rule):
for incompatible_flag in incompatible_flags:
if has_flag(incompatible_flag, actual_flags):
self._statusfile_outcomes = outproc.OUTCOMES_FAIL
self._expected_outcomes = outproc.OUTCOMES_FAIL
self.expected_failure_reason = ("Rule " + rule + " in " +
"tools/testrunner/local/variants.py expected a flag " +
"contradiction error with " + incompatible_flag + ".")
if not self._checked_flag_contradictions: if not self._checked_flag_contradictions:
self._checked_flag_contradictions = True self._checked_flag_contradictions = True
...@@ -176,22 +186,19 @@ class TestCase(object): ...@@ -176,22 +186,19 @@ class TestCase(object):
file_specific_flags = [normalize_flag(flag) for flag in file_specific_flags] file_specific_flags = [normalize_flag(flag) for flag in file_specific_flags]
extra_flags = [normalize_flag(flag) for flag in self._get_extra_flags()] extra_flags = [normalize_flag(flag) for flag in self._get_extra_flags()]
incompatible_flags = []
if self.variant in INCOMPATIBLE_FLAGS_PER_VARIANT: if self.variant in INCOMPATIBLE_FLAGS_PER_VARIANT:
incompatible_flags += INCOMPATIBLE_FLAGS_PER_VARIANT[self.variant] check_flags(INCOMPATIBLE_FLAGS_PER_VARIANT[self.variant], file_specific_flags,
"INCOMPATIBLE_FLAGS_PER_VARIANT[\""+self.variant+"\"]")
for variable, flags in INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE.items(): for variable, incompatible_flags in INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE.items():
if self.suite.statusfile.variables[variable]: if self.suite.statusfile.variables[variable]:
incompatible_flags += flags check_flags(incompatible_flags, file_specific_flags,
"INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE[\""+variable+"\"]")
for extra_flag, flags in INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG.items(): for extra_flag, incompatible_flags in INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG.items():
if has_flag(extra_flag, extra_flags): if has_flag(extra_flag, extra_flags):
incompatible_flags += flags check_flags(incompatible_flags, file_specific_flags,
"INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG[\""+extra_flag+"\"]")
for incompatible_flag in incompatible_flags:
if has_flag(incompatible_flag, file_specific_flags):
self._expected_outcomes = outproc.OUTCOMES_FAIL
return self._expected_outcomes return self._expected_outcomes
@property @property
......
...@@ -268,6 +268,8 @@ class CompactProgressIndicator(ProgressIndicator): ...@@ -268,6 +268,8 @@ class CompactProgressIndicator(ProgressIndicator):
else: else:
if test.is_fail: if test.is_fail:
self.printFormatted('failure', "--- UNEXPECTED PASS ---") self.printFormatted('failure', "--- UNEXPECTED PASS ---")
if test.expected_failure_reason != None:
self.printFormatted('failure', test.expected_failure_reason)
else: else:
self.printFormatted('failure', "--- FAILED ---") self.printFormatted('failure', "--- FAILED ---")
......
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