⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278310 in webkit


Ignore:
Timestamp:
Jun 1, 2021, 9:28:23 AM (5 years ago)
Author:
aakash_jain@apple.com
Message:

Print bot configuration in build.webkit.org builds
https://bugs.webkit.org/show_bug.cgi?id=226353

Reviewed by Jonathan Bedard.

  • CISupport/build-webkit-org/factories.py:

(Factory.init): Added PrintConfiguration step.

  • CISupport/build-webkit-org/steps.py:

(PrintConfiguration): Copied from ews code, step to print configuration.
(PrintConfiguration.init):
(PrintConfiguration.run):
(PrintConfiguration.convert_build_to_os_name):
(PrintConfiguration.getResultSummary):

  • CISupport/build-webkit-org/steps_unittest.py: Added unit-tests.
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/CISupport/build-webkit-org/factories.py

    r277043 r278310  
    3131        factory.BuildFactory.__init__(self)
    3232        self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architecture=" ".join(architectures), buildOnly=buildOnly, additionalArguments=additionalArguments, device_model=device_model))
     33        self.addStep(PrintConfiguration())
    3334        self.addStep(CheckOutSource())
    3435        self.addStep(ShowIdentifier())
  • trunk/Tools/CISupport/build-webkit-org/steps.py

    r277853 r278310  
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
     23from buildbot.plugins import steps, util
    2324from buildbot.process import buildstep, factory, logobserver, properties
    2425from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY
    2526from buildbot.steps import master, shell, transfer, trigger
    2627from buildbot.steps.source.svn import SVN
    27 
    2828from twisted.internet import defer
    2929
     30import json
    3031import os
    3132import re
    3233import socket
    3334import sys
    34 import json
    3535import urllib
    3636
     
    11561156
    11571157
     1158class PrintConfiguration(steps.ShellSequence):
     1159    name = 'configuration'
     1160    description = ['configuration']
     1161    haltOnFailure = False
     1162    flunkOnFailure = False
     1163    warnOnFailure = False
     1164    logEnviron = False
     1165    command_list_generic = [['hostname']]
     1166    command_list_apple = [['df', '-hl'], ['date'], ['sw_vers'], ['xcodebuild', '-sdk', '-version'], ['uptime']]
     1167    command_list_linux = [['df', '-hl'], ['date'], ['uname', '-a'], ['uptime']]
     1168    command_list_win = [['df', '-hl']]
     1169
     1170    def __init__(self, **kwargs):
     1171        super(PrintConfiguration, self).__init__(timeout=60, **kwargs)
     1172        self.commands = []
     1173        self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
     1174        self.addLogObserver('stdio', self.log_observer)
     1175
     1176    def run(self):
     1177        command_list = list(self.command_list_generic)
     1178        platform = self.getProperty('platform', '*')
     1179        if platform != 'jsc-only':
     1180            platform = platform.split('-')[0]
     1181        if platform in ('mac', 'ios', 'tvos', 'watchos', '*'):
     1182            command_list.extend(self.command_list_apple)
     1183        elif platform in ('gtk', 'wpe', 'jsc-only'):
     1184            command_list.extend(self.command_list_linux)
     1185        elif platform in ('win'):
     1186            command_list.extend(self.command_list_win)
     1187
     1188        for command in command_list:
     1189            self.commands.append(util.ShellArg(command=command, logname='stdio'))
     1190        return super(PrintConfiguration, self).run()
     1191
     1192    def convert_build_to_os_name(self, build):
     1193        if not build:
     1194            return 'Unknown'
     1195
     1196        build_to_name_mapping = {
     1197            '11': 'Big Sur',
     1198            '10.15': 'Catalina',
     1199            '10.14': 'Mojave',
     1200            '10.13': 'High Sierra',
     1201            '10.12': 'Sierra',
     1202            '10.11': 'El Capitan',
     1203            '10.10': 'Yosemite',
     1204            '10.9': 'Maverick',
     1205            '10.8': 'Mountain Lion',
     1206            '10.7': 'Lion',
     1207            '10.6': 'Snow Leopard',
     1208            '10.5': 'Leopard',
     1209        }
     1210
     1211        for key, value in build_to_name_mapping.items():
     1212            if build.startswith(key):
     1213                return value
     1214        return 'Unknown'
     1215
     1216    def getResultSummary(self):
     1217        if self.results != SUCCESS:
     1218            return {'step': 'Failed to print configuration'}
     1219        logText = self.log_observer.getStdout() + self.log_observer.getStderr()
     1220        configuration = 'Printed configuration'
     1221        match = re.search('ProductVersion:[ \t]*(.+?)\n', logText)
     1222        if match:
     1223            os_version = match.group(1).strip()
     1224            os_name = self.convert_build_to_os_name(os_version)
     1225            configuration = 'OS: {} ({})'.format(os_name, os_version)
     1226
     1227        xcode_re = sdk_re = 'Xcode[ \t]+?([0-9.]+?)\n'
     1228        match = re.search(xcode_re, logText)
     1229        if match:
     1230            xcode_version = match.group(1).strip()
     1231            configuration += ', Xcode: {}'.format(xcode_version)
     1232        return {'step': configuration}
     1233
     1234
     1235
    11581236class SetPermissions(master.MasterShellCommand):
    11591237    name = 'set-permissions'
  • trunk/Tools/CISupport/build-webkit-org/steps_unittest.py

    r277742 r278310  
    10281028        self.expectOutcome(result=FAILURE, state_string='Run svn cleanup (failure)')
    10291029        return self.runStep()
     1030
     1031
     1032class TestPrintConfiguration(BuildStepMixinAdditions, unittest.TestCase):
     1033    def setUp(self):
     1034        self.longMessage = True
     1035        return self.setUpBuildStep()
     1036
     1037    def tearDown(self):
     1038        return self.tearDownBuildStep()
     1039
     1040    def test_success_mac(self):
     1041        self.setupStep(PrintConfiguration())
     1042        self.setProperty('buildername', 'macOS-High-Sierra-Release-WK2-Tests-EWS')
     1043        self.setProperty('platform', 'mac-highsierra')
     1044
     1045        self.expectRemoteCommands(
     1046            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1047            + ExpectShell.log('stdio', stdout='ews150.apple.com'),
     1048            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1049            + ExpectShell.log('stdio', stdout='''Filesystem     Size   Used  Avail Capacity iused  ifree %iused  Mounted on
     1050/dev/disk1s1  119Gi   95Gi   23Gi    81%  937959 9223372036853837848    0%   /
     1051/dev/disk1s4  119Gi   20Ki   23Gi     1%       0 9223372036854775807    0%   /private/var/vm
     1052/dev/disk0s3  119Gi   22Gi   97Gi    19%  337595          4294629684    0%   /Volumes/Data'''),
     1053            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1054            + ExpectShell.log('stdio', stdout='Tue Apr  9 15:30:52 PDT 2019'),
     1055            ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1056            + ExpectShell.log('stdio', stdout='''ProductName:   Mac OS X
     1057ProductVersion: 10.13.4
     1058BuildVersion:   17E199'''),
     1059            ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
     1060            + ExpectShell.log('stdio', stdout='''MacOSX10.13.sdk - macOS 10.13 (macosx10.13)
     1061SDKVersion: 10.13
     1062Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
     1063PlatformVersion: 1.1
     1064PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
     1065ProductBuildVersion: 17E189
     1066ProductCopyright: 1983-2018 Apple Inc.
     1067ProductName: Mac OS X
     1068ProductUserVisibleVersion: 10.13.4
     1069ProductVersion: 10.13.4
     1070
     1071Xcode 9.4.1
     1072Build version 9F2000''')
     1073            + 0,
     1074            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1075            + ExpectShell.log('stdio', stdout=' 6:31  up 1 day, 19:05, 24 users, load averages: 4.17 7.23 5.45'),
     1076        )
     1077        self.expectOutcome(result=SUCCESS, state_string='OS: High Sierra (10.13.4), Xcode: 9.4.1')
     1078        return self.runStep()
     1079
     1080    def test_success_ios_simulator(self):
     1081        self.setupStep(PrintConfiguration())
     1082        self.setProperty('buildername', 'macOS-Sierra-Release-WK2-Tests-EWS')
     1083        self.setProperty('platform', 'ios-simulator-12')
     1084
     1085        self.expectRemoteCommands(
     1086            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1087            + ExpectShell.log('stdio', stdout='ews152.apple.com'),
     1088            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1089            + ExpectShell.log('stdio', stdout='''Filesystem     Size   Used  Avail Capacity iused  ifree %iused  Mounted on
     1090/dev/disk1s1  119Gi   95Gi   23Gi    81%  937959 9223372036853837848    0%   /
     1091/dev/disk1s4  119Gi   20Ki   23Gi     1%       0 9223372036854775807    0%   /private/var/vm
     1092/dev/disk0s3  119Gi   22Gi   97Gi    19%  337595          4294629684    0%   /Volumes/Data'''),
     1093            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1094            + ExpectShell.log('stdio', stdout='Tue Apr  9 15:30:52 PDT 2019'),
     1095            ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1096            + ExpectShell.log('stdio', stdout='''ProductName:   Mac OS X
     1097ProductVersion: 10.15.6
     1098BuildVersion:   19H2'''),
     1099            ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
     1100            + ExpectShell.log('stdio', stdout='''iPhoneSimulator13.4.sdk - Simulator - iOS 13.4 (iphonesimulator13.4)
     1101SDKVersion: 13.4
     1102Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk
     1103PlatformVersion: 13.4
     1104PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform
     1105BuildID: BB4C82AE-5F8A-11EA-A1A5-838AD03DDE06
     1106ProductBuildVersion: 17E255
     1107ProductCopyright: 1983-2020 Apple Inc.
     1108ProductName: iPhone OS
     1109ProductVersion: 13.4
     1110
     1111Xcode 11.7
     1112Build version 10E125''')
     1113            + 0,
     1114            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1115            + ExpectShell.log('stdio', stdout=' 6:31  up 1 day, 19:05, 24 users, load averages: 4.17 7.23 5.45'),
     1116        )
     1117        self.expectOutcome(result=SUCCESS, state_string='OS: Catalina (10.15.6), Xcode: 11.7')
     1118        return self.runStep()
     1119
     1120    def test_success_webkitpy(self):
     1121        self.setupStep(PrintConfiguration())
     1122        self.setProperty('platform', '*')
     1123
     1124        self.expectRemoteCommands(
     1125            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1126            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1127            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1128            ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1129            + ExpectShell.log('stdio', stdout='''ProductName:   Mac OS X
     1130ProductVersion: 10.13.6
     1131BuildVersion:   17G7024'''),
     1132            ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1133            + ExpectShell.log('stdio', stdout='''Xcode 10.2\nBuild version 10E125'''),
     1134            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1135            + ExpectShell.log('stdio', stdout=' 6:31  up 22 seconds, 12:05, 2 users, load averages: 3.17 7.23 5.45'),
     1136        )
     1137        self.expectOutcome(result=SUCCESS, state_string='OS: High Sierra (10.13.6), Xcode: 10.2')
     1138        return self.runStep()
     1139
     1140    def test_success_linux_wpe(self):
     1141        self.setupStep(PrintConfiguration())
     1142        self.setProperty('platform', 'wpe')
     1143
     1144        self.expectRemoteCommands(
     1145            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1146            + ExpectShell.log('stdio', stdout='ews190'),
     1147            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1148            + ExpectShell.log('stdio', stdout='''Filesystem     Size   Used  Avail Capacity iused  ifree %iused  Mounted on
     1149/dev/disk0s3  119Gi   22Gi   97Gi    19%  337595          4294629684    0%   /'''),
     1150            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1151            + ExpectShell.log('stdio', stdout='Tue Apr  9 15:30:52 PDT 2019'),
     1152            ExpectShell(command=['uname', '-a'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1153            + 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'''),
     1154            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0
     1155            + ExpectShell.log('stdio', stdout=' 6:31  up 22 seconds, 12:05, 2 users, load averages: 3.17 7.23 5.45'),
     1156        )
     1157        self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
     1158        return self.runStep()
     1159
     1160    def test_success_linux_gtk(self):
     1161        self.setupStep(PrintConfiguration())
     1162        self.setProperty('platform', 'gtk')
     1163
     1164        self.expectRemoteCommands(
     1165            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1166            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1167            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1168            ExpectShell(command=['uname', '-a'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1169            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1170        )
     1171        self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
     1172        return self.runStep()
     1173
     1174    def test_success_win(self):
     1175        self.setupStep(PrintConfiguration())
     1176        self.setProperty('platform', 'win')
     1177
     1178        self.expectRemoteCommands(
     1179            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1180            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1181        )
     1182        self.expectOutcome(result=SUCCESS, state_string='Printed configuration')
     1183        return self.runStep()
     1184
     1185    def test_failure(self):
     1186        self.setupStep(PrintConfiguration())
     1187        self.setProperty('platform', 'ios-12')
     1188        self.expectRemoteCommands(
     1189            ExpectShell(command=['hostname'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1190            ExpectShell(command=['df', '-hl'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1191            ExpectShell(command=['date'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1192            ExpectShell(command=['sw_vers'], workdir='wkdir', timeout=60, logEnviron=False) + 1
     1193            + ExpectShell.log('stdio', stdout='''Upon execvpe sw_vers ['sw_vers'] in environment id 7696545650400
     1194:Traceback (most recent call last):
     1195  File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 445, in _fork
     1196    environment)
     1197  File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 523, in _execChild
     1198    os.execvpe(executable, args, environment)
     1199  File "/usr/lib/python2.7/os.py", line 355, in execvpe
     1200    _execvpe(file, args, env)
     1201  File "/usr/lib/python2.7/os.py", line 382, in _execvpe
     1202    func(fullname, *argrest)
     1203OSError: [Errno 2] No such file or directory'''),
     1204            ExpectShell(command=['xcodebuild', '-sdk', '-version'], workdir='wkdir', timeout=60, logEnviron=False)
     1205            + ExpectShell.log('stdio', stdout='''Upon execvpe xcodebuild ['xcodebuild', '-sdk', '-version'] in environment id 7696545612416
     1206:Traceback (most recent call last):
     1207  File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 445, in _fork
     1208    environment)
     1209  File "/usr/lib/python2.7/site-packages/twisted/internet/process.py", line 523, in _execChild
     1210    os.execvpe(executable, args, environment)
     1211  File "/usr/lib/python2.7/os.py", line 355, in execvpe
     1212    _execvpe(file, args, env)
     1213  File "/usr/lib/python2.7/os.py", line 382, in _execvpe
     1214    func(fullname, *argrest)
     1215OSError: [Errno 2] No such file or directory''')
     1216            + 1,
     1217            ExpectShell(command=['uptime'], workdir='wkdir', timeout=60, logEnviron=False) + 0,
     1218        )
     1219        self.expectOutcome(result=FAILURE, state_string='Failed to print configuration')
     1220        return self.runStep()
  • trunk/Tools/ChangeLog

    r278254 r278310  
     12021-06-01  Aakash Jain  <aakash_jain@apple.com>
     2
     3        Print bot configuration in build.webkit.org builds
     4        https://bugs.webkit.org/show_bug.cgi?id=226353
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        * CISupport/build-webkit-org/factories.py:
     9        (Factory.__init__): Added PrintConfiguration step.
     10        * CISupport/build-webkit-org/steps.py:
     11        (PrintConfiguration): Copied from ews code, step to print configuration.
     12        (PrintConfiguration.__init__):
     13        (PrintConfiguration.run):
     14        (PrintConfiguration.convert_build_to_os_name):
     15        (PrintConfiguration.getResultSummary):
     16        * CISupport/build-webkit-org/steps_unittest.py: Added unit-tests.
     17
    1182021-05-30  Wenson Hsieh  <wenson_hsieh@apple.com>
    219
Note: See TracChangeset for help on using the changeset viewer.