Change log:95336cb92b..191d55580eFull diff:95336cb92b..191d55580eRoll chromium third_party 4e16929f46..3a8f2a9e1e Change log:4e16929f46..3a8f2a9e1eChanged dependencies: * src/tools:c44a3f5eca..f524a53b81DEPS diff:95336cb92b..191d55580e/DEPS No update to Clang. TBR=titovartem@google.com, BUG=None CQ_INCLUDE_TRYBOTS=master.internal.tryserver.corp.webrtc:linux_internal Change-Id: Ic9c4a62b050383646e9fcf5cc07a5653c14ac06e Reviewed-on: https://webrtc-review.googlesource.com/76120 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23205}
129 lines
4.0 KiB
Python
Executable File
129 lines
4.0 KiB
Python
Executable File
#!/usr/bin/python
|
|
# Copyright 2016 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
"""Builds and packages instrumented libraries for dynamic tools."""
|
|
|
|
import argparse
|
|
import contextlib
|
|
import multiprocessing
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import tarfile
|
|
|
|
BUILD_TYPES = {
|
|
'msan-no-origins': [
|
|
'is_msan = true',
|
|
'msan_track_origins = 0',
|
|
],
|
|
'msan-chained-origins': [
|
|
'is_msan = true',
|
|
'msan_track_origins = 2',
|
|
],
|
|
'tsan': ['is_tsan = true'],
|
|
'asan': ['is_asan = true']
|
|
}
|
|
SUPPORTED_RELEASES = frozenset(['trusty'])
|
|
|
|
|
|
class Error(Exception):
|
|
pass
|
|
|
|
|
|
class UnsupportedReleaseError(Error):
|
|
pass
|
|
|
|
|
|
def _get_release():
|
|
return subprocess.check_output(['lsb_release', '-cs']).strip()
|
|
|
|
|
|
def _tar_filter(tar_info):
|
|
if tar_info.name.endswith('.txt'):
|
|
return None
|
|
return tar_info
|
|
|
|
|
|
def build_libraries(build_type, ubuntu_release, jobs, use_goma):
|
|
archive_name = '%s-%s' % (build_type, ubuntu_release)
|
|
build_dir = 'out/Instrumented-%s' % archive_name
|
|
if not os.path.exists(build_dir):
|
|
os.makedirs(build_dir)
|
|
|
|
gn_args = [
|
|
'is_debug = false',
|
|
'use_goma = %s' % str(use_goma).lower(),
|
|
'use_locally_built_instrumented_libraries = true',
|
|
] + BUILD_TYPES[build_type]
|
|
with open(os.path.join(build_dir, 'args.gn'), 'w') as f:
|
|
f.write('\n'.join(gn_args) + '\n')
|
|
subprocess.check_call(['gn', 'gen', build_dir, '--check'])
|
|
subprocess.check_call(['ninja', '-j%d' % jobs, '-C', build_dir,
|
|
'third_party/instrumented_libraries:locally_built'])
|
|
with tarfile.open('%s.tgz' % archive_name, mode='w:gz') as f:
|
|
prefix = build_type.split('-', 1)[0]
|
|
f.add('%s/instrumented_libraries/%s' % (build_dir, prefix),
|
|
arcname=prefix,
|
|
filter=_tar_filter)
|
|
f.add('%s/instrumented_libraries/sources' % build_dir,
|
|
arcname='sources',
|
|
filter=_tar_filter)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
description=__doc__,
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
parser.add_argument(
|
|
'--jobs',
|
|
'-j',
|
|
type=int,
|
|
default=8,
|
|
help='the default number of jobs to use when running ninja')
|
|
parser.add_argument('--parallel',
|
|
action='store_true',
|
|
default=False,
|
|
help='whether to run all instrumented builds in parallel')
|
|
parser.add_argument('--use_goma',
|
|
action='store_true',
|
|
default=False,
|
|
help='whether to use goma to compile')
|
|
parser.add_argument('build_type',
|
|
nargs='*',
|
|
default='all',
|
|
choices=BUILD_TYPES.keys() + ['all'],
|
|
help='the type of instrumented library to build')
|
|
args = parser.parse_args()
|
|
if args.build_type == 'all' or 'all' in args.build_type:
|
|
args.build_type = BUILD_TYPES.keys()
|
|
|
|
ubuntu_release = _get_release()
|
|
if ubuntu_release not in SUPPORTED_RELEASES:
|
|
raise UnsupportedReleaseError('%s is not a supported release' %
|
|
_get_release())
|
|
build_types = sorted(set(args.build_type))
|
|
if args.parallel:
|
|
procs = []
|
|
for build_type in build_types:
|
|
proc = multiprocessing.Process(target=build_libraries,
|
|
args=(build_type, ubuntu_release,
|
|
args.jobs, args.use_goma))
|
|
proc.start()
|
|
procs.append(proc)
|
|
for proc in procs:
|
|
proc.join()
|
|
else:
|
|
for build_type in build_types:
|
|
build_libraries(build_type, ubuntu_release, args.jobs, args.use_goma)
|
|
print 'To upload, run:'
|
|
for build_type in build_types:
|
|
print('upload_to_google_storage.py -b '
|
|
'chromium-instrumented-libraries %s-%s.tgz' %
|
|
(build_type, ubuntu_release))
|
|
print 'You should then commit the resulting .sha1 files.'
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|