Title: [246793] trunk/Tools
Revision
246793
Author
[email protected]
Date
2019-06-25 09:17:43 -0700 (Tue, 25 Jun 2019)

Log Message

[ews-build] UploadTestResults and ExtractTestResults clobber results in case of multiple layout test runs in a build
https://bugs.webkit.org/show_bug.cgi?id=199178

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(UploadTestResults.__init__): Add an optional identifier and append the identifier to the file name.
(ExtractTestResults.__init__): Ditto.
* BuildSlaveSupport/ews-build/steps_unittest.py: Added unit tests.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps.py (246792 => 246793)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-06-25 16:08:27 UTC (rev 246792)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-06-25 16:17:43 UTC (rev 246793)
@@ -1082,12 +1082,13 @@
     name = 'upload-test-results'
     descriptionDone = ['Uploaded test results']
     workersrc = 'layout-test-results.zip'
-    masterdest = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s.zip')
     haltOnFailure = True
 
-    def __init__(self, **kwargs):
+    def __init__(self, identifier='', **kwargs):
+        if identifier and not identifier.startswith('-'):
+            identifier = '-{}'.format(identifier)
         kwargs['workersrc'] = self.workersrc
-        kwargs['masterdest'] = self.masterdest
+        kwargs['masterdest'] = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s{}.zip'.format(identifier))
         kwargs['mode'] = 0644
         kwargs['blocksize'] = 1024 * 256
         transfer.FileUpload.__init__(self, **kwargs)
@@ -1095,14 +1096,19 @@
 
 class ExtractTestResults(master.MasterShellCommand):
     name = 'extract-test-results'
-    zipFile = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s.zip')
-    resultDirectory = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s')
-
     descriptionDone = ['Extracted test results']
-    command = ['unzip', zipFile, '-d', resultDirectory]
     renderables = ['resultDirectory', 'zipFile']
+    haltOnFailure = False
+    flunkOnFailure = False
 
-    def __init__(self):
+    def __init__(self, identifier=''):
+        if identifier and not identifier.startswith('-'):
+            identifier = '-{}'.format(identifier)
+
+        self.zipFile = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s{}.zip'.format(identifier))
+        self.resultDirectory = Interpolate('public_html/results/%(prop:buildername)s/r%(prop:patch_id)s-%(prop:buildnumber)s{}'.format(identifier))
+        self.command = ['unzip', self.zipFile, '-d', self.resultDirectory]
+
         super(ExtractTestResults, self).__init__(self.command)
 
     def resultDirectoryURL(self):

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py (246792 => 246793)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-06-25 16:08:27 UTC (rev 246792)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-06-25 16:17:43 UTC (rev 246793)
@@ -1469,7 +1469,29 @@
         self.expectOutcome(result=SUCCESS, state_string='Uploaded test results')
         return self.runStep()
 
+    def test_success_with_identifier(self):
+        self.setupStep(UploadTestResults(identifier='clean-tree'))
+        self.setProperty('configuration', 'release')
+        self.setProperty('architecture', 'x86_64')
+        self.setProperty('patch_id', '271211')
+        self.setProperty('buildername', 'iOS-12-Simulator-WK2-Tests-EWS')
+        self.setProperty('buildnumber', '120')
+        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/iOS-12-Simulator-WK2-Tests-EWS/r271211-120-clean-tree.zip')
 
+        self.expectOutcome(result=SUCCESS, state_string='Uploaded test results')
+        return self.runStep()
+
+
 class TestExtractTestResults(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True
@@ -1496,6 +1518,24 @@
         self.expectAddedURLs([call('view layout test results', '/results/test/r2468_ab1a28b4feee0d42973c7c05335b35bca927e974 (1)/results.html')])
         return self.runStep()
 
+    def test_success_with_identifier(self):
+        self.setupStep(ExtractTestResults(identifier='rerun'))
+        self.setProperty('configuration', 'release')
+        self.setProperty('patch_id', '1234')
+        self.setProperty('buildername', 'iOS-12-Simulator-WK2-Tests-EWS')
+        self.setProperty('buildnumber', '12')
+        self.expectLocalCommands(
+            ExpectMasterShellCommand(command=['unzip',
+                                              'public_html/results/iOS-12-Simulator-WK2-Tests-EWS/r1234-12-rerun.zip',
+                                              '-d',
+                                              'public_html/results/iOS-12-Simulator-WK2-Tests-EWS/r1234-12-rerun',
+                                             ])
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Extracted test 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')

Modified: trunk/Tools/ChangeLog (246792 => 246793)


--- trunk/Tools/ChangeLog	2019-06-25 16:08:27 UTC (rev 246792)
+++ trunk/Tools/ChangeLog	2019-06-25 16:17:43 UTC (rev 246793)
@@ -1,3 +1,15 @@
+2019-06-25  Aakash Jain  <[email protected]>
+
+        [ews-build] UploadTestResults and ExtractTestResults clobber results in case of multiple layout test runs in a build
+        https://bugs.webkit.org/show_bug.cgi?id=199178
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (UploadTestResults.__init__): Add an optional identifier and append the identifier to the file name.
+        (ExtractTestResults.__init__): Ditto.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit tests.
+
 2019-06-25  Michael Catanzaro  <[email protected]>
 
         Add user agent quirk for bankofamerica.com
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to