Skip to content

Commit

Permalink
[build.webkit.org] layout-tests step should fail builds that exceed a…
Browse files Browse the repository at this point in the history
… predefined threshold of log lines

https://bugs.webkit.org/show_bug.cgi?id=261836

Reviewed by Jonathan Bedard.

* Tools/CISupport/build-webkit-org/steps.py:
(CompileWebKit.handleExcessiveLogging):
(CompileWebKit.getResultSummary):
(RunWebKitTests):
(RunWebKitTests.parseOutputLine):
(RunWebKitTests.getResultSummary):
(RunWebKitTests.handleExcessiveLogging):
(RunWebDriverTests.getResultSummary):
(RunWebDriverTests.handleExcessiveLogging):

Canonical link: https://commits.webkit.org/268247@main
  • Loading branch information
aj062 committed Sep 21, 2023
1 parent fad6397 commit 0e414dd
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions Tools/CISupport/build-webkit-org/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
WithProperties = properties.WithProperties
Interpolate = properties.Interpolate
THRESHOLD_FOR_EXCESSIVE_LOGS = 1000000
MSG_FOR_EXCESSIVE_LOGS = f'Stopped due to excessive logging, limit: {THRESHOLD_FOR_EXCESSIVE_LOGS}'


class CustomFlagsMixin(object):
Expand Down Expand Up @@ -388,9 +389,10 @@ def parseOutputLine(self, line):

def handleExcessiveLogging(self):
build_url = f'{self.master.config.buildbotURL}#/builders/{self.build._builderid}/builds/{self.build.number}'
print(f'Stopping build due to excessive logging: {build_url}\n\n')
print(f'\n{MSG_FOR_EXCESSIVE_LOGS}, {build_url}\n')
self.cancelled_due_to_huge_logs = True
self.build.stopBuild(reason=f'Stopped due to excessive logging. Log limit: {THRESHOLD_FOR_EXCESSIVE_LOGS}', results=FAILURE)
self.build.stopBuild(reason=MSG_FOR_EXCESSIVE_LOGS, results=FAILURE)
self.build.buildFinished([MSG_FOR_EXCESSIVE_LOGS], FAILURE)

@defer.inlineCallbacks
def _addToLog(self, logName, message):
Expand All @@ -407,10 +409,10 @@ def evaluateCommand(self, cmd):
return rc

def getResultSummary(self):
if self.cancelled_due_to_huge_logs:
return {'step': MSG_FOR_EXCESSIVE_LOGS, 'build': MSG_FOR_EXCESSIVE_LOGS}
if self.results == FAILURE:
return {'step': f'Failed {self.name}'}
if self.results == CANCELLED and self.cancelled_due_to_huge_logs:
return {'step': 'Cancelled step due to huge logs', 'build': 'Cancelled build due to huge logs'}
return shell.Compile.getResultSummary(self)


Expand Down Expand Up @@ -725,6 +727,8 @@ class RunWebKitTests(shell.Test, CustomFlagsMixin):
('missing results', re.compile(r'Regressions: Unexpected missing results\s+\((\d+)\)')),
('failures', re.compile(r'Regressions: Unexpected.+\((\d+)\)')),
]
cancelled_due_to_huge_logs = False
line_count = 0

def __init__(self, *args, **kwargs):
kwargs['logEnviron'] = False
Expand Down Expand Up @@ -761,6 +765,11 @@ def _strip_python_logging_prefix(self, line):
return line

def parseOutputLine(self, line):
self.line_count += 1
if self.line_count == THRESHOLD_FOR_EXCESSIVE_LOGS:
self.handleExcessiveLogging()
return

if r'Exiting early' in line or r'leaks found' in line:
self.incorrectLayoutLines.append(self._strip_python_logging_prefix(line))
return
Expand Down Expand Up @@ -801,12 +810,18 @@ def evaluateCommand(self, cmd):
return result

def getResultSummary(self):
status = self.name

if self.cancelled_due_to_huge_logs:
return {'step': MSG_FOR_EXCESSIVE_LOGS, 'build': MSG_FOR_EXCESSIVE_LOGS}
if self.results != SUCCESS and self.incorrectLayoutLines:
status = ' '.join(self.incorrectLayoutLines)
return {'step': status}
return super(RunWebKitTests, self).getResultSummary()
return {'step': ' '.join(self.incorrectLayoutLines)}
return super().getResultSummary()

def handleExcessiveLogging(self):
build_url = f'{self.master.config.buildbotURL}#/builders/{self.build._builderid}/builds/{self.build.number}'
print(f'\n{MSG_FOR_EXCESSIVE_LOGS}, {build_url}\n')
self.cancelled_due_to_huge_logs = True
self.build.stopBuild(reason=MSG_FOR_EXCESSIVE_LOGS, results=FAILURE)
self.build.buildFinished([MSG_FOR_EXCESSIVE_LOGS], FAILURE)


class RunDashboardTests(RunWebKitTests):
Expand Down Expand Up @@ -1150,10 +1165,10 @@ def start(self):

def getResultSummary(self):
# TODO: Parse logs to count number of failures and unexpected passes. https://webkit.org/b/261698
if self.cancelled_due_to_huge_logs:
return {'step': MSG_FOR_EXCESSIVE_LOGS, 'build': MSG_FOR_EXCESSIVE_LOGS}
if self.results == FAILURE:
return {'step': f'Failed {self.name}'}
if self.results == CANCELLED and self.cancelled_due_to_huge_logs:
return {'step': 'Cancelled step due to huge logs', 'build': 'Cancelled build due to huge logs'}
return super().getResultSummary()

def parseOutputLine(self, line):
Expand All @@ -1164,9 +1179,10 @@ def parseOutputLine(self, line):

def handleExcessiveLogging(self):
build_url = f'{self.master.config.buildbotURL}#/builders/{self.build._builderid}/builds/{self.build.number}'
print(f'Stopping build due to excessive logging: {build_url}\n\n')
print(f'\n{MSG_FOR_EXCESSIVE_LOGS}, {build_url}\n')
self.cancelled_due_to_huge_logs = True
self.build.stopBuild(reason=f'Stopped due to excessive logging. Log limit: {THRESHOLD_FOR_EXCESSIVE_LOGS}', results=FAILURE)
self.build.stopBuild(reason=MSG_FOR_EXCESSIVE_LOGS, results=FAILURE)
self.build.buildFinished([MSG_FOR_EXCESSIVE_LOGS], FAILURE)


class RunWebKit1Tests(RunWebKitTests):
Expand Down

0 comments on commit 0e414dd

Please sign in to comment.