Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: trunk/src/tools/bisect-builds.py

Issue 299273003: Revert 272587 "Remove kEnablePrintPreview now that the pdf plugi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/chrome/test/data/webui/print_preview.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Snapshot Build Bisect Tool 6 """Snapshot Build Bisect Tool
7 7
8 This script bisects a snapshot archive using binary search. It starts at 8 This script bisects a snapshot archive using binary search. It starts at
9 a bad revision (it will try to guess HEAD) and asks for a last known-good 9 a bad revision (it will try to guess HEAD) and asks for a last known-good
10 revision. It will then binary search across this revision range by downloading, 10 revision. It will then binary search across this revision range by downloading,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 import urllib 55 import urllib
56 from distutils.version import LooseVersion 56 from distutils.version import LooseVersion
57 from xml.etree import ElementTree 57 from xml.etree import ElementTree
58 import zipfile 58 import zipfile
59 59
60 60
61 class PathContext(object): 61 class PathContext(object):
62 """A PathContext is used to carry the information used to construct URLs and 62 """A PathContext is used to carry the information used to construct URLs and
63 paths when dealing with the storage server and archives.""" 63 paths when dealing with the storage server and archives."""
64 def __init__(self, base_url, platform, good_revision, bad_revision, 64 def __init__(self, base_url, platform, good_revision, bad_revision,
65 is_official, is_aura, flash_path = None): 65 is_official, is_aura, flash_path = None, pdf_path = None):
66 super(PathContext, self).__init__() 66 super(PathContext, self).__init__()
67 # Store off the input parameters. 67 # Store off the input parameters.
68 self.base_url = base_url 68 self.base_url = base_url
69 self.platform = platform # What's passed in to the '-a/--archive' option. 69 self.platform = platform # What's passed in to the '-a/--archive' option.
70 self.good_revision = good_revision 70 self.good_revision = good_revision
71 self.bad_revision = bad_revision 71 self.bad_revision = bad_revision
72 self.is_official = is_official 72 self.is_official = is_official
73 self.is_aura = is_aura 73 self.is_aura = is_aura
74 self.flash_path = flash_path 74 self.flash_path = flash_path
75 self.pdf_path = pdf_path
75 76
76 # The name of the ZIP file in a revision directory on the server. 77 # The name of the ZIP file in a revision directory on the server.
77 self.archive_name = None 78 self.archive_name = None
78 79
79 # Set some internal members: 80 # Set some internal members:
80 # _listing_platform_dir = Directory that holds revisions. Ends with a '/'. 81 # _listing_platform_dir = Directory that holds revisions. Ends with a '/'.
81 # _archive_extract_dir = Uncompressed directory in the archive_name file. 82 # _archive_extract_dir = Uncompressed directory in the archive_name file.
82 # _binary_name = The name of the executable to run. 83 # _binary_name = The name of the executable to run.
83 if self.platform in ('linux', 'linux64', 'linux-arm'): 84 if self.platform in ('linux', 'linux64', 'linux-arm'):
84 self._binary_name = 'chrome' 85 self._binary_name = 'chrome'
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 # Create a temp directory and unzip the revision into it. 357 # Create a temp directory and unzip the revision into it.
357 cwd = os.getcwd() 358 cwd = os.getcwd()
358 tempdir = tempfile.mkdtemp(prefix='bisect_tmp') 359 tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
359 UnzipFilenameToDir(zipfile, tempdir) 360 UnzipFilenameToDir(zipfile, tempdir)
360 os.chdir(tempdir) 361 os.chdir(tempdir)
361 362
362 # Run the build as many times as specified. 363 # Run the build as many times as specified.
363 testargs = ['--user-data-dir=%s' % profile] + args 364 testargs = ['--user-data-dir=%s' % profile] + args
364 # The sandbox must be run as root on Official Chrome, so bypass it. 365 # The sandbox must be run as root on Official Chrome, so bypass it.
365 if ((context.is_official or context.flash_path) and 366 if ((context.is_official or context.flash_path or context.pdf_path) and
366 context.platform.startswith('linux')): 367 context.platform.startswith('linux')):
367 testargs.append('--no-sandbox') 368 testargs.append('--no-sandbox')
368 if context.flash_path: 369 if context.flash_path:
369 testargs.append('--ppapi-flash-path=%s' % context.flash_path) 370 testargs.append('--ppapi-flash-path=%s' % context.flash_path)
370 # We have to pass a large enough Flash version, which currently needs not 371 # We have to pass a large enough Flash version, which currently needs not
371 # be correct. Instead of requiring the user of the script to figure out and 372 # be correct. Instead of requiring the user of the script to figure out and
372 # pass the correct version we just spoof it. 373 # pass the correct version we just spoof it.
373 testargs.append('--ppapi-flash-version=99.9.999.999') 374 testargs.append('--ppapi-flash-version=99.9.999.999')
374 375
376 if context.pdf_path:
377 shutil.copy(context.pdf_path, os.path.dirname(context.GetLaunchPath()))
378 testargs.append('--enable-print-preview')
379
375 runcommand = [] 380 runcommand = []
376 for token in shlex.split(command): 381 for token in shlex.split(command):
377 if token == "%a": 382 if token == "%a":
378 runcommand.extend(testargs) 383 runcommand.extend(testargs)
379 else: 384 else:
380 runcommand.append( \ 385 runcommand.append( \
381 token.replace('%p', os.path.abspath(context.GetLaunchPath())) \ 386 token.replace('%p', os.path.abspath(context.GetLaunchPath())) \
382 .replace('%s', ' '.join(testargs))) 387 .replace('%s', ' '.join(testargs)))
383 388
384 results = [] 389 results = []
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 platform, 462 platform,
458 official_builds, 463 official_builds,
459 is_aura, 464 is_aura,
460 good_rev=0, 465 good_rev=0,
461 bad_rev=0, 466 bad_rev=0,
462 num_runs=1, 467 num_runs=1,
463 command="%p %a", 468 command="%p %a",
464 try_args=(), 469 try_args=(),
465 profile=None, 470 profile=None,
466 flash_path=None, 471 flash_path=None,
472 pdf_path=None,
467 interactive=True, 473 interactive=True,
468 evaluate=AskIsGoodBuild): 474 evaluate=AskIsGoodBuild):
469 """Given known good and known bad revisions, run a binary search on all 475 """Given known good and known bad revisions, run a binary search on all
470 archived revisions to determine the last known good revision. 476 archived revisions to determine the last known good revision.
471 477
472 @param platform Which build to download/run ('mac', 'win', 'linux64', etc.). 478 @param platform Which build to download/run ('mac', 'win', 'linux64', etc.).
473 @param official_builds Specify build type (Chromium or Official build). 479 @param official_builds Specify build type (Chromium or Official build).
474 @param good_rev Number/tag of the known good revision. 480 @param good_rev Number/tag of the known good revision.
475 @param bad_rev Number/tag of the known bad revision. 481 @param bad_rev Number/tag of the known bad revision.
476 @param num_runs Number of times to run each build for asking good/bad. 482 @param num_runs Number of times to run each build for asking good/bad.
(...skipping 16 matching lines...) Expand all
493 is run on rev 75. 499 is run on rev 75.
494 500
495 - If rev 50 is bad, the download of rev 75 is cancelled, and the next test 501 - If rev 50 is bad, the download of rev 75 is cancelled, and the next test
496 is run on rev 25. 502 is run on rev 25.
497 """ 503 """
498 504
499 if not profile: 505 if not profile:
500 profile = 'profile' 506 profile = 'profile'
501 507
502 context = PathContext(base_url, platform, good_rev, bad_rev, 508 context = PathContext(base_url, platform, good_rev, bad_rev,
503 official_builds, is_aura, flash_path) 509 official_builds, is_aura, flash_path, pdf_path)
504 cwd = os.getcwd() 510 cwd = os.getcwd()
505 511
506 print "Downloading list of known revisions..." 512 print "Downloading list of known revisions..."
507 _GetDownloadPath = lambda rev: os.path.join(cwd, 513 _GetDownloadPath = lambda rev: os.path.join(cwd,
508 '%s-%s' % (str(rev), context.archive_name)) 514 '%s-%s' % (str(rev), context.archive_name))
509 if official_builds: 515 if official_builds:
510 revlist = context.GetOfficialBuildsList() 516 revlist = context.GetOfficialBuildsList()
511 else: 517 else:
512 revlist = context.GetRevList() 518 revlist = context.GetRevList()
513 519
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 'Chromium archives.') 748 'Chromium archives.')
743 parser.add_option('-b', '--bad', type = 'str', 749 parser.add_option('-b', '--bad', type = 'str',
744 help = 'A bad revision to start bisection. ' + 750 help = 'A bad revision to start bisection. ' +
745 'May be earlier or later than the good revision. ' + 751 'May be earlier or later than the good revision. ' +
746 'Default is HEAD.') 752 'Default is HEAD.')
747 parser.add_option('-f', '--flash_path', type = 'str', 753 parser.add_option('-f', '--flash_path', type = 'str',
748 help = 'Absolute path to a recent Adobe Pepper Flash ' + 754 help = 'Absolute path to a recent Adobe Pepper Flash ' +
749 'binary to be used in this bisection (e.g. ' + 755 'binary to be used in this bisection (e.g. ' +
750 'on Windows C:\...\pepflashplayer.dll and on Linux ' + 756 'on Windows C:\...\pepflashplayer.dll and on Linux ' +
751 '/opt/google/chrome/PepperFlash/libpepflashplayer.so).') 757 '/opt/google/chrome/PepperFlash/libpepflashplayer.so).')
758 parser.add_option('-d', '--pdf_path', type = 'str',
759 help = 'Absolute path to a recent PDF pluggin ' +
760 'binary to be used in this bisection (e.g. ' +
761 'on Windows C:\...\pdf.dll and on Linux ' +
762 '/opt/google/chrome/libpdf.so). Option also enables ' +
763 'print preview.')
752 parser.add_option('-g', '--good', type = 'str', 764 parser.add_option('-g', '--good', type = 'str',
753 help = 'A good revision to start bisection. ' + 765 help = 'A good revision to start bisection. ' +
754 'May be earlier or later than the bad revision. ' + 766 'May be earlier or later than the bad revision. ' +
755 'Default is 0.') 767 'Default is 0.')
756 parser.add_option('-p', '--profile', '--user-data-dir', type = 'str', 768 parser.add_option('-p', '--profile', '--user-data-dir', type = 'str',
757 help = 'Profile to use; this will not reset every run. ' + 769 help = 'Profile to use; this will not reset every run. ' +
758 'Defaults to a clean profile.', default = 'profile') 770 'Defaults to a clean profile.', default = 'profile')
759 parser.add_option('-t', '--times', type = 'int', 771 parser.add_option('-t', '--times', type = 'int',
760 help = 'Number of times to run each build before asking ' + 772 help = 'Number of times to run each build before asking ' +
761 'if it\'s good or bad. Temporary profiles are reused.', 773 'if it\'s good or bad. Temporary profiles are reused.',
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if opts.good: 824 if opts.good:
813 good_rev = opts.good 825 good_rev = opts.good
814 else: 826 else:
815 good_rev = '0.0.0.0' if opts.official_builds else 0 827 good_rev = '0.0.0.0' if opts.official_builds else 0
816 828
817 if opts.flash_path: 829 if opts.flash_path:
818 flash_path = opts.flash_path 830 flash_path = opts.flash_path
819 msg = 'Could not find Flash binary at %s' % flash_path 831 msg = 'Could not find Flash binary at %s' % flash_path
820 assert os.path.exists(flash_path), msg 832 assert os.path.exists(flash_path), msg
821 833
834 if opts.pdf_path:
835 pdf_path = opts.pdf_path
836 msg = 'Could not find PDF binary at %s' % pdf_path
837 assert os.path.exists(pdf_path), msg
838
822 if opts.official_builds: 839 if opts.official_builds:
823 good_rev = LooseVersion(good_rev) 840 good_rev = LooseVersion(good_rev)
824 bad_rev = LooseVersion(bad_rev) 841 bad_rev = LooseVersion(bad_rev)
825 else: 842 else:
826 good_rev = int(good_rev) 843 good_rev = int(good_rev)
827 bad_rev = int(bad_rev) 844 bad_rev = int(bad_rev)
828 845
829 if opts.times < 1: 846 if opts.times < 1:
830 print('Number of times to run (%d) must be greater than or equal to 1.' % 847 print('Number of times to run (%d) must be greater than or equal to 1.' %
831 opts.times) 848 opts.times)
832 parser.print_help() 849 parser.print_help()
833 return 1 850 return 1
834 851
835 (min_chromium_rev, max_chromium_rev) = Bisect( 852 (min_chromium_rev, max_chromium_rev) = Bisect(
836 base_url, opts.archive, opts.official_builds, opts.aura, good_rev, 853 base_url, opts.archive, opts.official_builds, opts.aura, good_rev,
837 bad_rev, opts.times, opts.command, args, opts.profile, opts.flash_path, 854 bad_rev, opts.times, opts.command, args, opts.profile, opts.flash_path,
838 not opts.not_interactive) 855 opts.pdf_path, not opts.not_interactive)
839 856
840 # Get corresponding blink revisions. 857 # Get corresponding blink revisions.
841 try: 858 try:
842 min_blink_rev = GetBlinkRevisionForChromiumRevision(context, 859 min_blink_rev = GetBlinkRevisionForChromiumRevision(context,
843 min_chromium_rev) 860 min_chromium_rev)
844 max_blink_rev = GetBlinkRevisionForChromiumRevision(context, 861 max_blink_rev = GetBlinkRevisionForChromiumRevision(context,
845 max_chromium_rev) 862 max_chromium_rev)
846 except Exception, e: 863 except Exception, e:
847 # Silently ignore the failure. 864 # Silently ignore the failure.
848 min_blink_rev, max_blink_rev = 0, 0 865 min_blink_rev, max_blink_rev = 0, 0
(...skipping 21 matching lines...) Expand all
870 "you might also want to do a Blink bisect.") 887 "you might also want to do a Blink bisect.")
871 888
872 print 'CHANGELOG URL:' 889 print 'CHANGELOG URL:'
873 if opts.official_builds: 890 if opts.official_builds:
874 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) 891 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
875 else: 892 else:
876 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) 893 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
877 894
878 if __name__ == '__main__': 895 if __name__ == '__main__':
879 sys.exit(main()) 896 sys.exit(main())
OLDNEW
« no previous file with comments | « trunk/src/chrome/test/data/webui/print_preview.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698