WebKit Bugzilla
Attachment 347280 Details for
Bug 188666
: [ews-build] Add build steps ArchiveTestResults, UploadTestResults and ExtractTestResults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
ews_upload_test_results.patch (text/plain), 10.75 KB, created by
Aakash Jain
on 2018-08-16 11:49:40 PDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Aakash Jain
Created:
2018-08-16 11:49:40 PDT
Size:
10.75 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 234945) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2018-08-16 Aakash Jain <aakash_jain@apple.com> >+ >+ [ews-build] Add build steps ArchiveTestResults, UploadTestResults and ExtractTestResults >+ https://bugs.webkit.org/show_bug.cgi?id=188666 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * BuildSlaveSupport/ews-build/steps.py: >+ (ArchiveTestResults): Build step to Archive the test results. >+ (UploadTestResults): Build step to upload the archive. >+ (ExtractTestResults): Build step to unzip the archive on server and generate a link. >+ * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests. >+ (ExpectMasterShellCommand): Copied from other similar internal code. >+ > 2018-08-16 Alex Christensen <achristensen@webkit.org> > > Re-introduce assertion removed in r234890 >Index: Tools/BuildSlaveSupport/ews-build/steps.py >=================================================================== >--- Tools/BuildSlaveSupport/ews-build/steps.py (revision 234945) >+++ Tools/BuildSlaveSupport/ews-build/steps.py (working copy) >@@ -22,7 +22,7 @@ > > from buildbot.process import buildstep, logobserver, properties > from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY >-from buildbot.steps import shell, transfer >+from buildbot.steps import master, shell, transfer > from buildbot.steps.source import svn > from twisted.internet import defer > >@@ -30,6 +30,7 @@ import re > > EWS_URL = 'http://ews-build.webkit-uat.org/' > WithProperties = properties.WithProperties >+Interpolate = properties.Interpolate > > > class ConfigureBuild(buildstep.BuildStep): >@@ -492,3 +493,49 @@ class RunAPITests(TestWithFailureCount): > if not match: > return 0 > return int(match.group('ran')) - int(match.group('passed')) >+ >+ >+class ArchiveTestResults(shell.ShellCommand): >+ command = ['python', 'Tools/BuildSlaveSupport/test-result-archive', >+ Interpolate('--platform=%(prop:platform)s'), Interpolate('--%(prop:configuration)s'), 'archive'] >+ name = 'archive-test-results' >+ description = ['archiving test results'] >+ descriptionDone = ['archived test results'] >+ haltOnFailure = True >+ >+ >+class UploadTestResults(transfer.FileUpload): >+ name = 'upload-test-results' >+ workersrc = 'layout-test-results.zip' >+ masterdest = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:ewspatchid)s-%(prop:buildnumber)s.zip') >+ haltOnFailure = True >+ >+ def __init__(self, **kwargs): >+ kwargs['workersrc'] = self.workersrc >+ kwargs['masterdest'] = self.masterdest >+ kwargs['mode'] = 0644 >+ kwargs['blocksize'] = 1024 * 256 >+ transfer.FileUpload.__init__(self, **kwargs) >+ >+ >+class ExtractTestResults(master.MasterShellCommand): >+ name = 'extract-test-results' >+ zipFile = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:ewspatchid)s-%(prop:buildnumber)s.zip') >+ resultDirectory = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:ewspatchid)s-%(prop:buildnumber)s') >+ >+ descriptionDone = ['uploaded results'] >+ command = ['unzip', zipFile, '-d', resultDirectory] >+ renderables = ['resultDirectory'] >+ >+ def __init__(self): >+ super(ExtractTestResults, self).__init__(self.command) >+ >+ def resultDirectoryURL(self): >+ return self.resultDirectory.replace('public_html/', '/') + '/' >+ >+ def addCustomURLs(self): >+ self.addURL('view layout test results', self.resultDirectoryURL() + 'results.html') >+ >+ def finished(self, result): >+ self.addCustomURLs() >+ return master.MasterShellCommand.finished(self, result) >Index: Tools/BuildSlaveSupport/ews-build/steps_unittest.py >=================================================================== >--- Tools/BuildSlaveSupport/ews-build/steps_unittest.py (revision 234945) >+++ Tools/BuildSlaveSupport/ews-build/steps_unittest.py (working copy) >@@ -29,6 +29,7 @@ from buildbot.process import remotetrans > from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY > from buildbot.test.fake.remotecommand import Expect, ExpectRemoteRef, ExpectShell > from buildbot.test.util.steps import BuildStepMixin >+from mock import call > from twisted.internet import error, reactor > from twisted.python import failure, log > from twisted.trial import unittest >@@ -36,6 +37,36 @@ from twisted.trial import unittest > from steps import * > > >+class ExpectMasterShellCommand(object): >+ def __init__(self, command, workdir=None, env=None, usePTY=0): >+ self.args = command >+ self.usePTY = usePTY >+ self.rc = None >+ self.path = None >+ self.logs = [] >+ >+ if env is not None: >+ self.env = env >+ else: >+ self.env = os.environ >+ if workdir: >+ self.path = os.path.join(os.getcwd(), workdir) >+ >+ @classmethod >+ def log(self, name, value): >+ return ('log', name, value) >+ >+ def __add__(self, other): >+ if isinstance(other, int): >+ self.rc = other >+ elif isinstance(other, tuple) and other[0] == 'log': >+ self.logs.append((other[1], other[2])) >+ return self >+ >+ def __repr__(self): >+ return 'ExpectMasterShellCommand({0})'.format(repr(self.args)) >+ >+ > class BuildStepMixinAdditions(BuildStepMixin): > def setUpBuildStep(self): > self.patch(reactor, 'spawnProcess', lambda *args, **kwargs: self._checkSpawnProcess(*args, **kwargs)) >@@ -1092,5 +1123,119 @@ All tests successfully passed! > return self.runStep() > > >+class TestArchiveTestResults(BuildStepMixinAdditions, unittest.TestCase): >+ def setUp(self): >+ self.longMessage = True >+ return self.setUpBuildStep() >+ >+ def tearDown(self): >+ return self.tearDownBuildStep() >+ >+ def test_success(self): >+ self.setupStep(ArchiveTestResults()) >+ self.setProperty('fullPlatform', 'ios-simulator') >+ self.setProperty('platform', 'ios-simulator') >+ self.setProperty('configuration', 'release') >+ self.expectRemoteCommands( >+ ExpectShell(workdir='wkdir', >+ command=['python', 'Tools/BuildSlaveSupport/test-result-archive', '--platform=ios-simulator', '--release', 'archive'], >+ ) >+ + 0, >+ ) >+ self.expectOutcome(result=SUCCESS, state_string='archived test results') >+ return self.runStep() >+ >+ def test_failure(self): >+ self.setupStep(ArchiveTestResults()) >+ self.setProperty('fullPlatform', 'mac-mojave') >+ self.setProperty('platform', 'mac') >+ self.setProperty('configuration', 'debug') >+ self.expectRemoteCommands( >+ ExpectShell(workdir='wkdir', >+ command=['python', 'Tools/BuildSlaveSupport/test-result-archive', '--platform=mac', '--debug', 'archive'], >+ ) >+ + ExpectShell.log('stdio', stdout='Unexpected failure.') >+ + 2, >+ ) >+ self.expectOutcome(result=FAILURE, state_string='archived test results (failure)') >+ return self.runStep() >+ >+ >+class TestUploadTestResults(BuildStepMixinAdditions, unittest.TestCase): >+ def setUp(self): >+ self.longMessage = True >+ return self.setUpBuildStep() >+ >+ def tearDown(self): >+ return self.tearDownBuildStep() >+ >+ def test_success(self): >+ self.setupStep(UploadTestResults()) >+ self.setProperty('configuration', 'release') >+ self.setProperty('architecture', 'x86_64') >+ self.setProperty('ewspatchid', '1234') >+ self.setProperty('buildername', 'macOS-Sierra-Release-WK2-Tests-EWS') >+ self.setProperty('buildnumber', '12') >+ self.expectHidden(False) >+ self.expectRemoteCommands( >+ Expect('uploadFile', dict( >+ workersrc='layout-test-results.zip', workdir='wkdir', >+ blocksize=1024 * 256, maxsize=None, keepstamp=False, >+ writer=ExpectRemoteRef(remotetransfer.FileWriter), >+ )) >+ + Expect.behavior(uploadFileWithContentsOfString('Dummy zip file content.')) >+ + 0, >+ ) >+ self.expectUploadedFile('public_html/results/macOS-Sierra-Release-WK2-Tests-EWS/r1234-12.zip') >+ >+ self.expectOutcome(result=SUCCESS, state_string='uploading layout-test-results.zip') >+ return self.runStep() >+ >+ >+class TestExtractTestResults(BuildStepMixinAdditions, unittest.TestCase): >+ def setUp(self): >+ self.longMessage = True >+ return self.setUpBuildStep() >+ >+ def tearDown(self): >+ return self.tearDownBuildStep() >+ >+ def test_success(self): >+ self.setupStep(ExtractTestResults()) >+ self.setProperty('configuration', 'release') >+ self.setProperty('ewspatchid', '1234') >+ self.setProperty('buildername', 'macOS-Sierra-Release-WK2-Tests-EWS') >+ self.setProperty('buildnumber', '12') >+ self.expectLocalCommands( >+ ExpectMasterShellCommand(command=['unzip', >+ 'public_html/results/macOS-Sierra-Release-WK2-Tests-EWS/r1234-12.zip', >+ '-d', >+ 'public_html/results/macOS-Sierra-Release-WK2-Tests-EWS/r1234-12', >+ ]) >+ + 0, >+ ) >+ self.expectOutcome(result=SUCCESS, state_string='uploaded results') >+ self.expectAddedURLs([call('view layout test results', '/results/test/r2468_ab1a28b4feee0d42973c7c05335b35bca927e974 (1)/results.html')]) >+ return self.runStep() >+ >+ def test_failure(self): >+ self.setupStep(ExtractTestResults()) >+ self.setProperty('configuration', 'debug') >+ self.setProperty('ewspatchid', '1234') >+ self.setProperty('buildername', 'macOS-Sierra-Release-WK2-Tests-EWS') >+ self.setProperty('buildnumber', '12') >+ self.expectLocalCommands( >+ ExpectMasterShellCommand(command=['unzip', >+ 'public_html/results/macOS-Sierra-Release-WK2-Tests-EWS/r1234-12.zip', >+ '-d', >+ 'public_html/results/macOS-Sierra-Release-WK2-Tests-EWS/r1234-12', >+ ]) >+ + 2, >+ ) >+ self.expectOutcome(result=FAILURE, state_string='failed (2) (failure)') >+ self.expectAddedURLs([call('view layout test results', '/results/test/r2468_ab1a28b4feee0d42973c7c05335b35bca927e974 (1)/results.html')]) >+ return self.runStep() >+ >+ > if __name__ == '__main__': > unittest.main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188666
: 347280