Skip to content

Commit

Permalink
Add target_build_type flag to bisect-perf-regression tool to enable b…
Browse files Browse the repository at this point in the history
…isecting of a Debug build with run-bisect-manual-test.py tool.

The run-bisect-manual-test.py uses bisect-perf-regression.py under the hood, and currently it
is not possible to bisect a Debug build this way.  This CL addresses this.

Also fixes browser.Start() / browser.Close() in manual-test.py.

BUG=370373
NOTRY=true

Review URL: https://codereview.chromium.org/277993002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269815 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rmcilroy@chromium.org committed May 12, 2014
1 parent 37f0b7f commit 807c1c3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
5 changes: 0 additions & 5 deletions tools/bisect-manual-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def _StartManualTest(options):
browser_to_create = browser_finder.FindBrowser(options)
print 'Starting browser: %s.' % options.browser_type
with browser_to_create.Create() as browser:
browser.Start();

# Loop until we get a response that we can parse.
while True:
sys.stderr.write('Revision is [(g)ood/(b)ad]: ')
Expand All @@ -34,9 +32,6 @@ def _StartManualTest(options):
print "RESULT manual_test: manual_test= 0"
break

browser.Close()


def main():
usage = ('%prog [options]\n'
'Starts browser with an optional url and asks user whether '
Expand Down
37 changes: 22 additions & 15 deletions tools/bisect-perf-regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,8 @@ def SetBuildSystemDefault(build_system):
raise RuntimeError('%s build not supported.' % build_system)


def BuildWithMake(threads, targets):
cmd = ['make', 'BUILDTYPE=Release']
def BuildWithMake(threads, targets, build_type):
cmd = ['make', 'BUILDTYPE=%s' % build_type]

if threads:
cmd.append('-j%d' % threads)
Expand All @@ -667,8 +667,8 @@ def BuildWithMake(threads, targets):
return not return_code


def BuildWithNinja(threads, targets):
cmd = ['ninja', '-C', os.path.join('out', 'Release')]
def BuildWithNinja(threads, targets, build_type):
cmd = ['ninja', '-C', os.path.join('out', build_type)]

if threads:
cmd.append('-j%d' % threads)
Expand All @@ -680,11 +680,11 @@ def BuildWithNinja(threads, targets):
return not return_code


def BuildWithVisualStudio(targets):
def BuildWithVisualStudio(targets, build_type):
path_to_devenv = os.path.abspath(
os.path.join(os.environ['VS100COMNTOOLS'], '..', 'IDE', 'devenv.com'))
path_to_sln = os.path.join(os.getcwd(), 'chrome', 'chrome.sln')
cmd = [path_to_devenv, '/build', 'Release', path_to_sln]
cmd = [path_to_devenv, '/build', build_type, path_to_sln]

for t in targets:
cmd.extend(['/Project', t])
Expand Down Expand Up @@ -797,12 +797,12 @@ def Build(self, depot, opts):

build_success = False
if opts.build_preference == 'make':
build_success = BuildWithMake(threads, targets)
build_success = BuildWithMake(threads, targets, opts.target_build_type)
elif opts.build_preference == 'ninja':
build_success = BuildWithNinja(threads, targets)
build_success = BuildWithNinja(threads, targets, opts.target_build_type)
elif opts.build_preference == 'msvs':
assert IsWindows(), 'msvs is only supported on Windows.'
build_success = BuildWithVisualStudio(targets)
build_success = BuildWithVisualStudio(targets, opts.target_build_type)
else:
assert False, 'No build system defined.'
return build_success
Expand Down Expand Up @@ -912,7 +912,7 @@ def BuildPackages(self, opts, depot):
if depot != 'cros':
cmd += ['CHROME_ORIGIN=LOCAL_SOURCE']

cmd += ['BUILDTYPE=Release', './build_packages',
cmd += ['BUILDTYPE=%s' % opts.target_build_type, './build_packages',
'--board=%s' % opts.cros_board]
return_code = RunProcess(cmd)

Expand All @@ -939,7 +939,7 @@ def BuildImage(self, opts, depot):
if depot != 'cros':
cmd += ['CHROME_ORIGIN=LOCAL_SOURCE']

cmd += ['BUILDTYPE=Release', '--', './build_image',
cmd += ['BUILDTYPE=%s' % opts.target_build_type, '--', './build_image',
'--board=%s' % opts.cros_board, 'test']

return_code = RunProcess(cmd)
Expand Down Expand Up @@ -3553,10 +3553,10 @@ def RmTreeAndMkDir(path_to_dir, skip_makedir=False):
return True


def RemoveBuildFiles():
def RemoveBuildFiles(build_type):
"""Removes build files from previous runs."""
if RmTreeAndMkDir(os.path.join('out', 'Release')):
if RmTreeAndMkDir(os.path.join('build', 'Release')):
if RmTreeAndMkDir(os.path.join('out', build_type)):
if RmTreeAndMkDir(os.path.join('build', build_type)):
return True
return False

Expand Down Expand Up @@ -3587,6 +3587,7 @@ def __init__(self):
self.debug_ignore_perf_test = None
self.gs_bucket = None
self.target_arch = 'ia32'
self.target_build_type = 'Release'
self.builder_host = None
self.builder_port = None
self.bisect_mode = BISECT_MODE_MEAN
Expand Down Expand Up @@ -3710,6 +3711,12 @@ def _CreateCommandLineParser(self):
dest='target_arch',
help=('The target build architecture. Choices are "ia32" '
'(default), "x64" or "arm".'))
group.add_option('--target_build_type',
type='choice',
choices=['Release', 'Debug'],
default='Release',
help='The target build type. Choices are "Release" '
'(default), or "Debug".')
group.add_option('--builder_host',
dest='builder_host',
type='str',
Expand Down Expand Up @@ -3848,7 +3855,7 @@ def main():

os.chdir(os.path.join(os.getcwd(), 'src'))

if not RemoveBuildFiles():
if not RemoveBuildFiles(opts.target_build_type):
raise RuntimeError('Something went wrong removing the build files.')

if not IsPlatformSupported(opts):
Expand Down
1 change: 1 addition & 0 deletions tools/run-bisect-manual-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _RunBisectionScript(options):
'-m', 'manual_test/manual_test',
'-r', '1',
'--working_directory', options.working_directory,
'--target_build_type', options.browser_type.title(),
'--build_preference', 'ninja',
'--use_goma',
'--no_custom_deps']
Expand Down

0 comments on commit 807c1c3

Please sign in to comment.