зеркало из https://github.com/mozilla/treeherder.git
Bug 1355940 - Drop process ids like 'GECKO(123)' and 'PID 123' from lines shown in 'Failure Summary' tab. (#6339)
They prevent finding failure suggestions e.g. for assertions and add noise to bugs created with bugfiler.
This commit is contained in:
Родитель
8bf91fea78
Коммит
09ad62821a
|
@ -1,6 +1,36 @@
|
|||
import pytest
|
||||
|
||||
from treeherder.model.error_summary import get_crash_signature, get_error_search_term
|
||||
from treeherder.model.error_summary import (
|
||||
get_cleaned_line,
|
||||
get_crash_signature,
|
||||
get_error_search_term,
|
||||
)
|
||||
|
||||
LINE_CLEANING_TEST_CASES = (
|
||||
(
|
||||
(
|
||||
'00:54:20 INFO - GECKO(1943) | Assertion failure: rc != 0 '
|
||||
'(destroyed timer off its target thread!), at '
|
||||
'/builds/worker/checkouts/gecko/xpcom/threads/TimerThread.cpp:434'
|
||||
),
|
||||
(
|
||||
'Assertion failure: rc != 0 (destroyed timer off its target thread!),'
|
||||
' at '
|
||||
'/builds/worker/checkouts/gecko/xpcom/threads/TimerThread.cpp:434'
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("line_raw", "exp_line_cleaned"), LINE_CLEANING_TEST_CASES)
|
||||
def test_get_cleaned_line(line_raw, exp_line_cleaned):
|
||||
"""
|
||||
Test cleaning from of error line from unnecessary information, e.g.
|
||||
mozharness timestamps and process ids
|
||||
"""
|
||||
actual_line_cleaned = get_cleaned_line(line_raw)
|
||||
assert actual_line_cleaned == exp_line_cleaned
|
||||
|
||||
|
||||
PIPE_DELIMITED_LINE_TEST_CASES = (
|
||||
(
|
||||
|
@ -55,8 +85,7 @@ PIPE_DELIMITED_LINE_TEST_CASES = (
|
|||
),
|
||||
(
|
||||
(
|
||||
"GECKO(1670) "
|
||||
"| TEST-UNEXPECTED-FAIL "
|
||||
"TEST-UNEXPECTED-FAIL "
|
||||
"| /tests/dom/events/test/pointerevents/pointerevent_touch-action-table-test_touch-manual.html "
|
||||
"| touch-action attribute test on the cell: assert_true: scroll received while shouldn't expected true got false"
|
||||
),
|
||||
|
@ -64,8 +93,7 @@ PIPE_DELIMITED_LINE_TEST_CASES = (
|
|||
),
|
||||
(
|
||||
(
|
||||
"PID 1670 "
|
||||
"| TEST-UNEXPECTED-FAIL "
|
||||
"TEST-UNEXPECTED-FAIL "
|
||||
"| /tests/dom/events/test/pointerevents/pointerevent_touch-action-table-test_touch-manual.html "
|
||||
"| touch-action attribute test on the cell: assert_true: scroll received while shouldn't expected true got false"
|
||||
),
|
||||
|
|
|
@ -15,8 +15,8 @@ BUG_SUGGESTION_CACHE_TIMEOUT = 86400
|
|||
LEAK_RE = re.compile(r'\d+ bytes leaked \((.+)\)$|leak at (.+)$')
|
||||
CRASH_RE = re.compile(r'.+ application crashed \[@ (.+)\]$')
|
||||
MOZHARNESS_RE = re.compile(r'^\d+:\d+:\d+[ ]+(?:DEBUG|INFO|WARNING|ERROR|CRITICAL|FATAL) - [ ]?')
|
||||
PROCESS_ID_RE = re.compile(r"(?:PID \d+|GECKO\(\d+\)) \| +")
|
||||
REFTEST_RE = re.compile(r'\s+[=!]=\s+.*')
|
||||
OUTPUT_RE = re.compile(r'^\s*(?:GECKO\(\d+\)|PID \d+)\s*$')
|
||||
|
||||
|
||||
def get_error_summary(job):
|
||||
|
@ -58,7 +58,7 @@ def bug_suggestions_line(err, term_cache=None):
|
|||
term_cache = {}
|
||||
|
||||
# remove the mozharness prefix
|
||||
clean_line = get_mozharness_substring(err.line)
|
||||
clean_line = get_cleaned_line(err.line)
|
||||
|
||||
# get a meaningful search term out of the error line
|
||||
search_term = get_error_search_term(clean_line)
|
||||
|
@ -91,9 +91,10 @@ def bug_suggestions_line(err, term_cache=None):
|
|||
}
|
||||
|
||||
|
||||
def get_mozharness_substring(line):
|
||||
def get_cleaned_line(line):
|
||||
"""Strip possible mozharness bits from the given line."""
|
||||
return MOZHARNESS_RE.sub('', line).strip()
|
||||
line_to_clean = MOZHARNESS_RE.sub('', line).strip()
|
||||
return PROCESS_ID_RE.sub('', line_to_clean)
|
||||
|
||||
|
||||
def get_error_search_term(error_line):
|
||||
|
@ -113,9 +114,6 @@ def get_error_search_term(error_line):
|
|||
search_term = None
|
||||
|
||||
if len(tokens) >= 3:
|
||||
# If this is process output then discard the token with the PID
|
||||
if len(tokens) > 3 and OUTPUT_RE.match(tokens[0]):
|
||||
tokens = tokens[1:]
|
||||
# it's in the "FAILURE-TYPE | testNameOrFilePath | message" type format.
|
||||
test_name_or_path = tokens[1]
|
||||
message = tokens[2]
|
||||
|
|
Загрузка…
Ссылка в новой задаче