mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2025-10-22 14:52:21 +02:00
steps: observer: Add links to ptest logs
Finding the ptest logs corresponding to a build can be a bit tricky: it requires to find the correct yocto.io link, then the correct subfolder corresponding to the builder and the correct ptest image. Generate this link in the log parser and add it in the links log section, so users don't have to do all of this by hand. Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
0b67c49848
commit
8e15e7ce60
|
@ -29,15 +29,19 @@ class SimpleLogObserver(ShellCommand):
|
|||
|
||||
def __init__(self, maxsteps=10, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.builder = None
|
||||
self.warningLines = []
|
||||
self.errorLines = []
|
||||
self.links = []
|
||||
self.failed_ptests = []
|
||||
self.testResultsLink = None
|
||||
if "description" in kwargs:
|
||||
self.description = kwargs["description"]
|
||||
else:
|
||||
self.description = "run-config"
|
||||
self.addLogObserver('stdio', logobserver.LineConsumerLogObserver(partial(self.logConsumer, 'stdio')))
|
||||
self.yocto_io_re = re.compile(".*/([^/]*yocto.io/pub/(non-release|repro-fail[^/]*/)([^ ']|$)+).*")
|
||||
self.ptest_fails_re = re.compile(r"WARNING: (\S*)-[0-9.]*-r[0-9]* do_testimage:")
|
||||
|
||||
def describe(self, done=False):
|
||||
return self.description
|
||||
|
@ -48,12 +52,19 @@ class SimpleLogObserver(ShellCommand):
|
|||
if line.startswith("WARNING:"):
|
||||
self.warnCount += 1
|
||||
self.warningLines.append(logname + ": " + line)
|
||||
match = self.ptest_fails_re.match(line)
|
||||
if match:
|
||||
self.failed_ptests.append(match.group(1))
|
||||
if line.startswith("ERROR:"):
|
||||
self.errorCount += 1
|
||||
self.errorLines.append(logname + ": " + line)
|
||||
if line.startswith("Builder:"):
|
||||
self.builder = line.split(':')[1].strip()
|
||||
url, matched = self.yocto_io_re.subn('https://\\1', line)
|
||||
if matched:
|
||||
self.links.append(url)
|
||||
if not self.testResultsLink and url.endswith("/testresults"):
|
||||
self.testResultsLink = url
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def finish_logs(self):
|
||||
|
@ -71,6 +82,12 @@ class SimpleLogObserver(ShellCommand):
|
|||
links = list(dict.fromkeys(self.links))
|
||||
htmlLinks = ['Found links:<ul>']
|
||||
htmlLinks.extend([f'<li><a href="{link}">{link}</a></li>' for link in links])
|
||||
|
||||
if self.testResultsLink and self.builder:
|
||||
htmlLinks.extend(['</ul>ptest logs:<ul>'])
|
||||
ptestLinks = [f"{self.testResultsLink}/{self.builder}/{ptest}"
|
||||
for ptest in self.failed_ptests]
|
||||
htmlLinks.extend([f'<li><a href="{link}">{link}</a></li>' for link in ptestLinks])
|
||||
htmlLinks.append('</ul>')
|
||||
yield self.addHTMLLog('links', '\n'.join(htmlLinks))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user