[ews-build] UploadTestResults and ExtractTestResults clobber results in case of multi...
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 16:17:43 +0000 (16:17 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 16:17:43 +0000 (16:17 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246793 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-build/steps.py
Tools/BuildSlaveSupport/ews-build/steps_unittest.py
Tools/ChangeLog

index abe934b..d01219a 100644 (file)
@@ -1082,12 +1082,13 @@ class UploadTestResults(transfer.FileUpload):
     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 UploadTestResults(transfer.FileUpload):
 
 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, 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]
 
-    def __init__(self):
         super(ExtractTestResults, self).__init__(self.command)
 
     def resultDirectoryURL(self):
index 3448fa2..348d22f 100644 (file)
@@ -1469,6 +1469,28 @@ class TestUploadTestResults(BuildStepMixinAdditions, unittest.TestCase):
         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):
@@ -1496,6 +1518,24 @@ class TestExtractTestResults(BuildStepMixinAdditions, unittest.TestCase):
         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')
index 0d8e02f..8dd1f5f 100644 (file)
@@ -1,3 +1,15 @@
+2019-06-25  Aakash Jain  <aakash_jain@apple.com>
+
+        [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  <mcatanzaro@igalia.com>
 
         Add user agent quirk for bankofamerica.com