mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
validate:launcher: Handle checking bug status for expected failures
This commit is contained in:
parent
7193b04770
commit
e132c11a95
2 changed files with 63 additions and 25 deletions
|
@ -733,7 +733,7 @@ class GstValidateTest(Test):
|
|||
return value
|
||||
|
||||
def report_matches_expected_failure(self, report, expected_failure):
|
||||
for key in ['bug', 'sometimes']:
|
||||
for key in ['bug', 'bugs', 'sometimes']:
|
||||
if key in expected_failure:
|
||||
del expected_failure[key]
|
||||
for key, value in list(report.items()):
|
||||
|
@ -1088,9 +1088,8 @@ class TestsManager(Loggable):
|
|||
|
||||
def set_blacklists(self):
|
||||
if self.blacklisted_tests:
|
||||
printc("\nCurrently 'hardcoded' %s blacklisted tests:\n"
|
||||
"--------------------------------------------" % self.name,
|
||||
Colors.WARNING)
|
||||
printc("\nCurrently 'hardcoded' %s blacklisted tests:" %
|
||||
self.name, Colors.WARNING, title_char='-')
|
||||
|
||||
if self.options.check_bugs_status:
|
||||
if not check_bugs_resolution(self.blacklisted_tests):
|
||||
|
@ -1103,6 +1102,33 @@ class TestsManager(Loggable):
|
|||
|
||||
return True
|
||||
|
||||
def check_expected_failures(self):
|
||||
if not self.blacklisted_tests:
|
||||
return True
|
||||
|
||||
if self.expected_failures:
|
||||
printc("\nCurrently known failures in the %s testsuite:"
|
||||
% self.name, Colors.WARNING, title_char='-')
|
||||
|
||||
bugs_definitions = {}
|
||||
for regex, failures in list(self.expected_failures.items()):
|
||||
for failure in failures:
|
||||
bugs = failure.get('bug')
|
||||
if not bugs:
|
||||
bugs = failure.get('bugs')
|
||||
if not bugs:
|
||||
printc('+ %s:\n --> no bug reported associated with %s\n' % (
|
||||
regex.pattern, failure), Colors.WARNING)
|
||||
continue
|
||||
|
||||
if not isinstance(bugs, list):
|
||||
bugs = [bugs]
|
||||
cbugs = bugs_definitions.get(regex.pattern, [])
|
||||
bugs.extend([b for b in bugs if b not in cbugs])
|
||||
bugs_definitions[regex.pattern] = bugs
|
||||
|
||||
return check_bugs_resolution(bugs_definitions.items())
|
||||
|
||||
def _check_blacklisted(self, test):
|
||||
for pattern in self.blacklisted_tests_patterns:
|
||||
if pattern.findall(test.classname):
|
||||
|
@ -1399,6 +1425,9 @@ class _TestsLauncher(Loggable):
|
|||
if not tester.set_blacklists():
|
||||
return False
|
||||
|
||||
if not tester.check_expected_failures():
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def _check_tester_has_other_testsuite(self, testsuite, tester):
|
||||
|
|
|
@ -127,15 +127,19 @@ def get_color_for_result(result):
|
|||
return color
|
||||
|
||||
|
||||
def printc(message, color="", title=False):
|
||||
if title:
|
||||
def printc(message, color="", title=False, title_char=''):
|
||||
if title or title_char:
|
||||
length = 0
|
||||
for l in message.split("\n"):
|
||||
if len(l) > length:
|
||||
length = len(l)
|
||||
if length == 0:
|
||||
length = len(message)
|
||||
message = length * '=' + "\n" + str(message) + "\n" + length * '='
|
||||
|
||||
if title is True:
|
||||
message = length * title + "\n" + str(message) + "\n" + length * '='
|
||||
else:
|
||||
message = str(message) + "\n" + length * title_char
|
||||
|
||||
if hasattr(message, "result") and color == '':
|
||||
color = get_color_for_result(message.result)
|
||||
|
@ -367,27 +371,32 @@ class BackTraceGenerator(Loggable):
|
|||
def check_bugs_resolution(bugs_definitions):
|
||||
bugz = {}
|
||||
regexes = {}
|
||||
for regex, bug in bugs_definitions:
|
||||
url = urllib.parse.urlparse(bug)
|
||||
if "bugzilla" not in url.netloc:
|
||||
printc(" + %s \n --> bug: %s\n --> Status: Not a bugzilla report\n" % (regex, bug),
|
||||
Colors.WARNING)
|
||||
continue
|
||||
for regex, bugs in bugs_definitions:
|
||||
if isinstance(bugs, str):
|
||||
bugs = [bugs]
|
||||
|
||||
query = urllib.parse.parse_qs(url.query)
|
||||
_id = query.get('id')
|
||||
if not _id:
|
||||
printc(" + '%s' -- Can't check bug '%s'\n" % (regex, bug), Colors.WARNING)
|
||||
continue
|
||||
for bug in bugs:
|
||||
url = urllib.parse.urlparse(bug)
|
||||
|
||||
if isinstance(_id, list):
|
||||
_id = _id[0]
|
||||
if "bugzilla" not in url.netloc:
|
||||
printc(" + %s \n --> bug: %s\n --> Status: Not a bugzilla report\n" % (regex, bug),
|
||||
Colors.WARNING)
|
||||
continue
|
||||
|
||||
regexes[_id] = (regex, bug)
|
||||
url_parts = tuple(list(url)[:3] + ['', '', ''])
|
||||
ids = bugz.get(url_parts, [])
|
||||
ids.append(_id)
|
||||
bugz[url_parts] = ids
|
||||
query = urllib.parse.parse_qs(url.query)
|
||||
_id = query.get('id')
|
||||
if not _id:
|
||||
printc(" + '%s' -- Can't check bug '%s'\n" % (regex, bug), Colors.WARNING)
|
||||
continue
|
||||
|
||||
if isinstance(_id, list):
|
||||
_id = _id[0]
|
||||
|
||||
regexes[_id] = (regex, bug)
|
||||
url_parts = tuple(list(url)[:3] + ['', '', ''])
|
||||
ids = bugz.get(url_parts, [])
|
||||
ids.append(_id)
|
||||
bugz[url_parts] = ids
|
||||
|
||||
res = True
|
||||
for url_parts, ids in bugz.items():
|
||||
|
|
Loading…
Reference in a new issue