Skip to content

Commit

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

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

Reviewed by Jonathan Bedard.

* Tools/CISupport/build-webkit-org/factories_unittest.py:
(TestExpectedBuildSteps):
* Tools/CISupport/build-webkit-org/steps.py:
(CompileWebKit):
(CompileWebKit.parseOutputLine):
(CompileWebKit.handleExcessiveLogging):
(CompileWebKit.getResultSummary):
(Compile32bitJSC):
(CompileJSCOnly):
* Tools/CISupport/build-webkit-org/steps_unittest.py:
(TestCompileWebKit.test_failure):
(TestCompileJSCOnly.test_failure):

Canonical link: https://commits.webkit.org/268034@main
  • Loading branch information
aj062 committed Sep 15, 2023
1 parent cc47c92 commit e6adefb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Tools/CISupport/build-webkit-org/factories_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ class TestExpectedBuildSteps(unittest.TestCase):
'show-identifier',
'delete-WebKitBuild-directory',
'delete-stale-build-files',
'compile-webkit',
'compile-jsc',
'jscore-test'
],
'JSCOnly-Linux-ARMv7-Thumb2-Release': [
Expand All @@ -1356,7 +1356,7 @@ class TestExpectedBuildSteps(unittest.TestCase):
'show-identifier',
'delete-WebKitBuild-directory',
'delete-stale-build-files',
'compile-webkit',
'compile-jsc',
'jscore-test'
],
'JSCOnly-Linux-MIPS32el-Release': [
Expand All @@ -1367,7 +1367,7 @@ class TestExpectedBuildSteps(unittest.TestCase):
'show-identifier',
'delete-WebKitBuild-directory',
'delete-stale-build-files',
'compile-webkit',
'compile-jsc',
'jscore-test'
],
'WPE-Linux-64-bit-Release-Build': [
Expand Down
25 changes: 24 additions & 1 deletion Tools/CISupport/build-webkit-org/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from buildbot.plugins import steps, util
from buildbot.process import buildstep, logobserver, properties
from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY
from buildbot.process.results import Results, SUCCESS, FAILURE, CANCELLED, WARNINGS, SKIPPED, EXCEPTION, RETRY
from buildbot.steps import master, shell, transfer, trigger
from buildbot.steps.source import git
from twisted.internet import defer
Expand All @@ -45,6 +45,7 @@
S3URL = 'https://s3-us-west-2.amazonaws.com/'
WithProperties = properties.WithProperties
Interpolate = properties.Interpolate
THRESHOLD_FOR_EXCESSIVE_LOGS = 1000000


class CustomFlagsMixin(object):
Expand Down Expand Up @@ -330,6 +331,8 @@ class CompileWebKit(shell.Compile, CustomFlagsMixin):
description = ["compiling"]
descriptionDone = ["compiled"]
warningPattern = ".*arning: .*"
cancelled_due_to_huge_logs = False
line_count = 0

def start(self):
platform = self.getProperty('platform')
Expand Down Expand Up @@ -373,11 +376,22 @@ def buildCommandKwargs(self, warnings):
return kwargs

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

if "arning:" in line:
self._addToLog('warnings', line + '\n')
if "rror:" in line:
self._addToLog('errors', line + '\n')

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')
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)

@defer.inlineCallbacks
def _addToLog(self, logName, message):
try:
Expand All @@ -392,16 +406,25 @@ def evaluateCommand(self, cmd):
self.build.addStepsAfterCurrentStep([ArchiveMinifiedBuiltProduct(), UploadMinifiedBuiltProduct(), TransferToS3(terminate_build=True)])
return rc

def getResultSummary(self):
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)


class CompileLLINTCLoop(CompileWebKit):
command = ["perl", "Tools/Scripts/build-jsc", "--cloop", WithProperties("--%(configuration)s")]


class Compile32bitJSC(CompileWebKit):
name = 'compile-jsc-32bit'
command = ["perl", "Tools/Scripts/build-jsc", "--32-bit", WithProperties("--%(configuration)s")]


class CompileJSCOnly(CompileWebKit):
name = 'compile-jsc'
command = ["perl", "Tools/Scripts/build-jsc", WithProperties("--%(configuration)s")]


Expand Down
4 changes: 2 additions & 2 deletions Tools/CISupport/build-webkit-org/steps_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def test_failure(self):
) + 2
+ ExpectShell.log('stdio', stdout='1 error generated.'),
)
self.expectOutcome(result=FAILURE, state_string='compiled (failure)')
self.expectOutcome(result=FAILURE, state_string='Failed compile-webkit')
return self.runStep()


Expand Down Expand Up @@ -511,7 +511,7 @@ def test_failure(self):
) + 2
+ ExpectShell.log('stdio', stdout='1 error generated.'),
)
self.expectOutcome(result=FAILURE, state_string='compiled (failure)')
self.expectOutcome(result=FAILURE, state_string='Failed compile-jsc')
return self.runStep()


Expand Down

0 comments on commit e6adefb

Please sign in to comment.