Modified: trunk/Tools/CISupport/build-webkit-org/steps.py (278309 => 278310)
--- trunk/Tools/CISupport/build-webkit-org/steps.py 2021-06-01 15:34:54 UTC (rev 278309)
+++ trunk/Tools/CISupport/build-webkit-org/steps.py 2021-06-01 16:28:23 UTC (rev 278310)
@@ -20,18 +20,18 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from buildbot.plugins import steps, util
from buildbot.process import buildstep, factory, logobserver, properties
from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY
from buildbot.steps import master, shell, transfer, trigger
from buildbot.steps.source.svn import SVN
-
from twisted.internet import defer
+import json
import os
import re
import socket
import sys
-import json
import urllib
if sys.version_info < (3, 5):
@@ -1155,6 +1155,84 @@
return master.MasterShellCommand.finished(self, result)
+class PrintConfiguration(steps.ShellSequence):
+ name = 'configuration'
+ description = ['configuration']
+ haltOnFailure = False
+ flunkOnFailure = False
+ warnOnFailure = False
+ logEnviron = False
+ command_list_generic = [['hostname']]
+ command_list_apple = [['df', '-hl'], ['date'], ['sw_vers'], ['xcodebuild', '-sdk', '-version'], ['uptime']]
+ command_list_linux = [['df', '-hl'], ['date'], ['uname', '-a'], ['uptime']]
+ command_list_win = [['df', '-hl']]
+
+ def __init__(self, **kwargs):
+ super(PrintConfiguration, self).__init__(timeout=60, **kwargs)
+ self.commands = []
+ self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
+ self.addLogObserver('stdio', self.log_observer)
+
+ def run(self):
+ command_list = list(self.command_list_generic)
+ platform = self.getProperty('platform', '*')
+ if platform != 'jsc-only':
+ platform = platform.split('-')[0]
+ if platform in ('mac', 'ios', 'tvos', 'watchos', '*'):
+ command_list.extend(self.command_list_apple)
+ elif platform in ('gtk', 'wpe', 'jsc-only'):
+ command_list.extend(self.command_list_linux)
+ elif platform in ('win'):
+ command_list.extend(self.command_list_win)
+
+ for command in command_list:
+ self.commands.append(util.ShellArg(command=command, logname='stdio'))
+ return super(PrintConfiguration, self).run()
+
+ def convert_build_to_os_name(self, build):
+ if not build:
+ return 'Unknown'
+
+ build_to_name_mapping = {
+ '11': 'Big Sur',
+ '10.15': 'Catalina',
+ '10.14': 'Mojave',
+ '10.13': 'High Sierra',
+ '10.12': 'Sierra',
+ '10.11': 'El Capitan',
+ '10.10': 'Yosemite',
+ '10.9': 'Maverick',
+ '10.8': 'Mountain Lion',
+ '10.7': 'Lion',
+ '10.6': 'Snow Leopard',
+ '10.5': 'Leopard',
+ }
+
+ for key, value in build_to_name_mapping.items():
+ if build.startswith(key):
+ return value
+ return 'Unknown'
+
+ def getResultSummary(self):
+ if self.results != SUCCESS:
+ return {'step': 'Failed to print configuration'}
+ logText = self.log_observer.getStdout() + self.log_observer.getStderr()
+ configuration = 'Printed configuration'
+ match = re.search('ProductVersion:[ \t]*(.+?)\n', logText)
+ if match:
+ os_version = match.group(1).strip()
+ os_name = self.convert_build_to_os_name(os_version)
+ configuration = 'OS: {} ({})'.format(os_name, os_version)
+
+ xcode_re = sdk_re = 'Xcode[ \t]+?([0-9.]+?)\n'
+ match = re.search(xcode_re, logText)
+ if match:
+ xcode_version = match.group(1).strip()
+ configuration += ', Xcode: {}'.format(xcode_version)
+ return {'step': configuration}
+
+
+
class SetPermissions(master.MasterShellCommand):
name = 'set-permissions'
Modified: trunk/Tools/CISupport/build-webkit-org/steps_unittest.py (278309 => 278310)
--- trunk/Tools/CISupport/build-webkit-org/steps_unittest.py 2021-06-01 15:34:54 UTC (rev 278309)
+++ trunk/Tools/CISupport/build-webkit-org/steps_unittest.py 2021-06-01 16:28:23 UTC (rev 278310)
@@ -1027,3 +1027,194 @@
)
self.expectOutcome(result=FAILURE, state_string='Run svn cleanup (failure)')
return self.runStep()
+
+
+class TestPrintConfiguration(BuildStepMixinAdditions, unittest.TestCase):
+ def setUp(self):
+ self.longMessage = True
+ return self.setUpBuildStep()
+
+ def tearDown(self):
+ return self.tearDownBuildStep()
+
+ def test_success_mac(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('buildername', 'macOS-High-Sierra-Release-WK2-Tests-EWS')
+ self.setProperty('platform', 'mac-highsierra')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='ews150.apple.com'),
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
+/dev/disk1s1 119Gi 95Gi 23Gi 81% 937959 9223372036853837848 0% /
+/dev/disk1s4 119Gi 20Ki 23Gi 1% 0 9223372036854775807 0% /private/var/vm
+/dev/disk0s3 119Gi 22Gi 97Gi 19% 337595 4294629684 0% /Volumes/Data'''),
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Tue Apr 9 15:30:52 PDT 2019'),
+ ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''ProductName: Mac OS X
+ProductVersion: 10.13.4
+BuildVersion: 17E199'''),
+ ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
+ + ExpectShell.log('stdio', stdout='''MacOSX10.13.sdk - macOS 10.13 (macosx10.13)
+SDKVersion: 10.13
+Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
+PlatformVersion: 1.1
+PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
+ProductBuildVersion: 17E189
+ProductCopyright: 1983-2018 Apple Inc.
+ProductName: Mac OS X
+ProductUserVisibleVersion: 10.13.4
+ProductVersion: 10.13.4
+
+Xcode 9.4.1
+Build version 9F2000''')
+ + 0,
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=' 6:31 up 1 day, 19:05, 24 users, load averages: 4.17 7.23 5.45'),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='OS: High Sierra (10.13.4), Xcode: 9.4.1')
+ return self.runStep()
+
+ def test_success_ios_simulator(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('buildername', 'macOS-Sierra-Release-WK2-Tests-EWS')
+ self.setProperty('platform', 'ios-simulator-12')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='ews152.apple.com'),
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
+/dev/disk1s1 119Gi 95Gi 23Gi 81% 937959 9223372036853837848 0% /
+/dev/disk1s4 119Gi 20Ki 23Gi 1% 0 9223372036854775807 0% /private/var/vm
+/dev/disk0s3 119Gi 22Gi 97Gi 19% 337595 4294629684 0% /Volumes/Data'''),
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Tue Apr 9 15:30:52 PDT 2019'),
+ ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''ProductName: Mac OS X
+ProductVersion: 10.15.6
+BuildVersion: 19H2'''),
+ ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
+ + ExpectShell.log('stdio', stdout='''iPhoneSimulator13.4.sdk - Simulator - iOS 13.4 (iphonesimulator13.4)
+SDKVersion: 13.4
+Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk
+PlatformVersion: 13.4
+PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform
+BuildID: BB4C82AE-5F8A-11EA-A1A5-838AD03DDE06
+ProductBuildVersion: 17E255
+ProductCopyright: 1983-2020 Apple Inc.
+ProductName: iPhone OS
+ProductVersion: 13.4
+
+Xcode 11.7
+Build version 10E125''')
+ + 0,
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=' 6:31 up 1 day, 19:05, 24 users, load averages: 4.17 7.23 5.45'),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='OS: Catalina (10.15.6), Xcode: 11.7')
+ return self.runStep()
+
+ def test_success_webkitpy(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('platform', '*')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''ProductName: Mac OS X
+ProductVersion: 10.13.6
+BuildVersion: 17G7024'''),
+ ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''Xcode 10.2\nBuild version 10E125'''),
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=' 6:31 up 22 seconds, 12:05, 2 users, load averages: 3.17 7.23 5.45'),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='OS: High Sierra (10.13.6), Xcode: 10.2')
+ return self.runStep()
+
+ def test_success_linux_wpe(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('platform', 'wpe')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='ews190'),
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
+/dev/disk0s3 119Gi 22Gi 97Gi 19% 337595 4294629684 0% /'''),
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Tue Apr 9 15:30:52 PDT 2019'),
+ ExpectShell(command=['uname', '-a'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='''Linux kodama-ews 5.0.4-arch1-1-ARCH #1 SMP PREEMPT Sat Mar 23 21:00:33 UTC 2019 x86_64 GNU/Linux'''),
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=' 6:31 up 22 seconds, 12:05, 2 users, load averages: 3.17 7.23 5.45'),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
+ return self.runStep()
+
+ def test_success_linux_gtk(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('platform', 'gtk')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['uname', '-a'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
+ return self.runStep()
+
+ def test_success_win(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('platform', 'win')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
+ return self.runStep()
+
+ def test_failure(self):
+ self.setupStep(PrintConfiguration())
+ self.setProperty('platform', 'ios-12')
+ self.expectRemoteCommands(
+ ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 1
+ + ExpectShell.log('stdio', stdout='''Upon execvpe sw_vers ['sw_vers'] in environment id 7696545650400
+:Traceback (most recent call last):
+ File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 445, in _fork
+ environment)
+ File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 523, in _execChild
+ os.execvpe(executable, args, environment)
+ File "/usr/lib/python2.7/os.py", line 355, in execvpe
+ _execvpe(file, args, env)
+ File "/usr/lib/python2.7/os.py", line 382, in _execvpe
+ func(fullname, *argrest)
+OSError: [Errno 2] No such file or directory'''),
+ ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
+ + ExpectShell.log('stdio', stdout='''Upon execvpe xcodebuild ['xcodebuild', '-sdk', '-version'] in environment id 7696545612416
+:Traceback (most recent call last):
+ File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 445, in _fork
+ environment)
+ File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 523, in _execChild
+ os.execvpe(executable, args, environment)
+ File "/usr/lib/python2.7/os.py", line 355, in execvpe
+ _execvpe(file, args, env)
+ File "/usr/lib/python2.7/os.py", line 382, in _execvpe
+ func(fullname, *argrest)
+OSError: [Errno 2] No such file or directory''')
+ + 1,
+ ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
+ )
+ self.expectOutcome(result=FAILURE, state_string='Failed to print configuration')
+ return self.runStep()