WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch for review
174596.patch (text/plain), 11.90 KB, created by
Lucas Forschler
on 2017-07-25 14:14:58 PDT
(
hide
)
Description:
patch for review
Filename:
MIME Type:
Creator:
Lucas Forschler
Created:
2017-07-25 14:14:58 PDT
Size:
11.90 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 219885) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,31 @@ >+2017-07-25 Lucas Forschler <lforschler@apple.com> >+ >+ Write a tool to bisect WebKit builds >+ https://bugs.webkit.org/show_bug.cgi?id=174596 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/bisect-webkit-builds: Added. >+ (find_le): Find rightmost value less than or equal to x >+ (find_ge): Find leftmost item greater than or equal to x >+ (parseCommandLine): parse command line options >+ (getSortedRevisions): retrieve sorted revision list >+ (getS3Location): calculate the S3 archive storage location >+ (downloadArchive):download an archive from S3 using existing tools >+ (extractArchive): extract an archive using existing tools >+ (promptUser): prompt user for direction for bisection >+ (testArchive): Platform specific logic to test downloaded archive >+ (pickNextBuild): compute the next build to bisect >+ (bisectBuilds): main bisection algorithm >+ (getIndexesFromRevisions): convert revisions to list indexes for bisection >+ (getRestApiUrl): generate url for the rest api/database >+ (getSupportedFullPlatforms): return a list of full platforms in the database >+ (getSupportedMinifiedPlatforms): return a list of minified platforms in the database >+ (isSupportedPlatform): check if platform is supported >+ (validateOptions): validate command line options >+ (main): do magic >+ (setWebKitOutputDir): set the folder for bisected builds to avoid overwriting engineering build output >+ > 2017-07-25 Matthew Stewart <matthew_r_stewart@apple.com> > > Fix autoinstaller failing on autoinstall_everything >Index: Tools/Scripts/bisect-webkit-builds >=================================================================== >--- Tools/Scripts/bisect-webkit-builds (nonexistent) >+++ Tools/Scripts/bisect-webkit-builds (working copy) >@@ -0,0 +1,261 @@ >+#!/usr/bin/env python >+ >+# Copyright (C) 2017 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# 3. Neither the name of Apple Inc. ("Apple") nor the names of >+# its contributors may be used to endorse or promote products derived >+# from this software without specific prior written permission. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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. >+ >+import argparse >+import bisect >+import json >+import math >+import os >+import re >+import requests >+import subprocess >+import sys >+ >+# FIXME: This is the /test/ REST API, it is not yet published to production >+REST_API_URL = 'https://q1tzqfy48e.execute-api.us-west-2.amazonaws.com/test/' >+REST_API_ENDPOINT = 'archives/' >+REST_API_MINIFIED_ENDPOINT = 'minified-archives/' >+DEBUG = False >+ >+# ---- bisect helpers from https://docs.python.org/2/library/bisect.html ---- >+def find_le(a, x): >+ 'Find rightmost value less than or equal to x' >+ i = bisect.bisect_right(a, x) >+ if i: >+ return i-1 >+ raise ValueError >+ >+ >+def find_ge(a, x): >+ 'Find leftmost item greater than or equal to x' >+ i = bisect.bisect_left(a, x) >+ if i != len(a): >+ return i >+ raise ValueError >+# ---- end bisect helpers ---- >+ >+ >+def parseCommandLine(args): >+ parser = argparse.ArgumentParser(description='Get a list of WebKit archives.') >+ parser.add_argument('-c', '--configuration', default='release', help='The configuration to query [release | debug]') >+ parser.add_argument('-a', '--architecture', default='x86_64', help='The architecture to query [x86_64 | i386]') >+ parser.add_argument('-p', '--platform', default='None', help='The platform to query [mac-sierra | gtk | ios-simulator | win]') >+ parser.add_argument('-f', '--full', action='store_true', help='Use full archives containing debug symbols. These are significantly larger files!') >+ parser.add_argument('-s', '--start', default=None, type=int, help='The starting revision to bisect.') >+ parser.add_argument('-e', '--end', default=None, type=int, help='The ending revision to bisect') >+ if not len(sys.argv) > 1: >+ parser.print_help() >+ exit(-1) >+ return parser.parse_args(args) >+ >+ >+def getSortedRevisions(revisionsJSON): >+ revisions = [] >+ for revision in revisionsJSON['revisions']: >+ revisions.append(int(revision['revision'])) >+ revisions.sort() >+ return revisions >+ >+ >+def getS3Location(url, revisionToDownload): >+ url = '/'.join([url, str(revisionToDownload)]) >+ r = requests.get(url) >+ for archive in r.json()['archive']: >+ #identifier = archive['identifier'] >+ #revision = archive['revision'] >+ s3_url = archive['s3_url'] >+ return s3_url >+ >+ >+def downloadArchive(options, revisionToDownload): >+ base_url = getRestApiUrl(options) >+ s3_url = getS3Location(base_url, revisionToDownload) >+ command = ['python', '../BuildSlaveSupport/download-built-product', '--%s' % options.configuration, '--platform', options.platform, s3_url] >+ print('Downloading revision: {}'.format(revisionToDownload)) >+ subprocess.check_call(command) >+ >+ >+def extractArchive(options): >+ command = ['python', '../BuildSlaveSupport/built-product-archive', '--platform', options.platform, '--%s' % options.configuration, 'extract'] >+ print('Extracting archive: {}'.format(command)) >+ subprocess.check_call(command) >+ >+ >+def promptUser(): >+ var = raw_input('Did the error reproduce? [y/n]: ') >+ print('You entered: {}'.format(var)) >+ var.lower() >+ if 'y' in var: >+ return 'yes' >+ if 'n' in var: >+ return 'no' >+ else: >+ promptUser >+ >+ >+def testArchive(options, revisionToTest): >+ print('Testing revision {}...'.format(revisionToTest)) >+ command = [] >+ >+ if 'mac' in options.platform: >+ command = ['./run-safari'] >+ elif 'ios' in options.platform: >+ command = ['./run-safari', '--simulator'] >+ else: >+ # FIXME: Add other platform logic here >+ print('Default test behavior for this platform is not implemented...'.format(options.platform)) >+ >+ if command: >+ subprocess.call(command) >+ >+ return promptUser() >+ >+ >+def pickNextBuild(revisionList, startIndex, endIndex): >+ revisionsRemaining = (endIndex-startIndex)+1 >+ print('Found {} revisions in this range to test...'.format(revisionsRemaining)) >+ >+ if startIndex >= endIndex: >+ print('No archives available between {} and {}'.format(revisionList[endIndex], revisionList[startIndex])) >+ return None >+ >+ middleIndex = (startIndex + endIndex)/2 >+ middleRevision = revisionList[middleIndex] >+ >+ startRevision = revisionList[startIndex] >+ endRevision = revisionList[endIndex] >+ >+ return int(math.ceil(middleIndex)) >+ >+ >+def bisectBuilds(revisionList, startIndex, endIndex, options): >+ while True: >+ indexToTest = pickNextBuild(revisionList, startIndex, endIndex) >+ if indexToTest == None: >+ print('No more builds to test...') >+ exit(1) >+ downloadArchive(options, revisionList[indexToTest]) >+ extractArchive(options) >+ reproduces = testArchive(options, revisionList[indexToTest]) >+ >+ if reproduces == 'yes': # bisect left >+ indexToTest -= 1 # We can remove this from the end of the list of builds to test >+ bisectBuilds(revisionList, startIndex, indexToTest, options) >+ if reproduces == 'no': # bisect right >+ indexToTest += 1 # We can remove this from the start of the list of builds to test >+ bisectBuilds(revisionList, indexToTest, endIndex, options) >+ >+ >+def getIndexesFromRevisions(revisionList, startRevision, endRevision): >+ if startRevision == None: >+ print('WARNING: No starting revision was given, defaulting to first available for this configuration') >+ startIndex = 0 >+ else: >+ startIndex = find_ge(revisionList, startRevision) >+ >+ if endRevision == None: >+ print('WARNING: No ending revision was given, defaulting to last avialable for this configuration') >+ endIndex = len(revisionList)-1 >+ else: >+ endIndex = find_le(revisionList, endRevision) >+ >+ print('Bisecting between {} and {}'.format(revisionList[startIndex], revisionList[endIndex])) >+ return startIndex, endIndex >+ >+ >+def getRestApiUrl(options): >+ if options.full: >+ url = REST_API_URL + REST_API_ENDPOINT >+ else: >+ url = REST_API_URL + REST_API_MINIFIED_ENDPOINT >+ url = url + '-'.join([options.platform, options.architecture, options.configuration]) >+ return url >+ >+ >+def getSupportedFullPlatforms(): >+ # FIXME: query this dynamically from API >+ fullPlatforms = ['gtk', 'ios-simulator-10', 'mac-elcapitan', 'mac-sierra', 'win', 'wpe'] >+ return fullPlatforms >+ >+ >+def getSupportedMinifiedPlatforms(): >+ # FIXME: query this dynamically from API >+ minifiedPlatforms = ['mac-elcapitan', 'mac-sierra'] >+ return minifiedPlatforms >+ >+ >+def isSupportedPlatform(options): >+ if options.full: >+ return options.platform in getSupportedFullPlatforms() >+ else: >+ return options.platform in getSupportedMinifiedPlatforms() >+ >+ >+def validateOptions(options): >+ if options.platform == 'None': >+ print('ERROR: -p/--platform must be specified') >+ exit(-1) >+ if not isSupportedPlatform(options): >+ print('Unsupported platform: [{}], exiting...'.format(options.platform)) >+ if options.full: >+ print('Available Full platforms: {}'.format(getSupportedFullPlatforms())) >+ else: >+ print('Available Minified platforms: {}'.format(getSupportedMinifiedPlatforms())) >+ print('INFO: pass --full to try against full archives') >+ exit(-1) >+ >+ >+def main(options): >+ validateOptions(options) >+ >+ url = getRestApiUrl(options) >+ r = requests.get(url) >+ revisionList = getSortedRevisions(r.json()) >+ >+ startIndex, endIndex = getIndexesFromRevisions(revisionList, options.start, options.end) >+ # from here forward, use indexes instead of revisions >+ bisectBuilds(revisionList, startIndex, endIndex, options) >+ >+ >+def setWebKitOutputDir(basedir): >+ outputDir = os.path.abspath('/'.join([basedir, '../../WebKitBisect'])) >+ print('Setting WEBKIT_OUTPUTDIR to {}'.format(outputDir)) >+ os.environ["WEBKIT_OUTPUTDIR"] = outputDir >+ >+ >+if __name__ == '__main__': >+ options = parseCommandLine(sys.argv[1:]) >+ abspath = os.path.abspath(__file__) >+ dname = os.path.dirname(abspath) >+ os.chdir(dname) >+ setWebKitOutputDir(dname) >+ try: >+ result = main(options) >+ exit(result) >+ except KeyboardInterrupt: >+ exit("Aborting.") > >Property changes on: Tools/Scripts/bisect-webkit-builds >___________________________________________________________________ >Added: svn:executable >## -0,0 +1 ## >+* >\ No newline at end of property
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
Flags:
lforschler
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 174596
:
315733
|
315822
|
316072
|
316101
|
316392
|
316463
|
316895
|
317000
|
317026