本文整理汇总了Python中build_options.OPTIONS类的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS类的具体用法?Python OPTIONS怎么用?Python OPTIONS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OPTIONS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _filter
def _filter(vars):
if vars.is_shared():
return False
make_to_ninja.Filters.convert_to_shared_lib(vars)
_add_bare_metal_flags_to_make_to_ninja_vars(vars)
# Builtin rint and rintf call lrint and lrintf,
# respectively. However, Bionic calls rint and rintf to implement
# lrint and lrintf and this causes an infinite recurision.
# TODO(crbug.com/357564): Change this to -fno-builtin.
vars.get_cflags().append('-fno-builtin-rint')
vars.get_cflags().append('-fno-builtin-rintf')
sources = vars.get_sources()
_remove_assembly_source(sources)
if OPTIONS.is_arm():
vars.get_includes().append('android/bionic/libc/arch-arm/include')
else:
# TODO(crbug.com/414583): "L" has arch-x86_64 directory so we
# should have this include path only for i686 targets.
vars.get_includes().append('android/bionic/libc/arch-x86/include')
if OPTIONS.is_x86_64():
vars.get_includes().insert(0, 'android/bionic/libc/arch-amd64/include')
sources.remove(
'android/bionic/libm/upstream-freebsd/lib/msun/src/e_sqrtf.c')
sources.remove('android/bionic/libm/i387/fenv.c')
sources.extend(['android/bionic/libm/amd64/e_sqrtf.S',
'android/bionic/libm/amd64/fenv.c'])
if OPTIONS.is_bare_metal_i686():
# long double is double on other architectures. For them,
# s_nextafter.c defines nextafterl.
sources.append(
'android/bionic/libm/upstream-freebsd/lib/msun/src/s_nextafterl.c')
vars.get_generator_args()['is_system_library'] = True
vars.get_shared_deps().append('libc')
return True
示例2: main
def main():
OPTIONS.parse_configure_file()
args = _parse_args()
if args.mode == 'stackwalk':
_stackwalk(args.minidump)
elif args.mode == 'dump':
_dump(args.minidump)
示例3: main
def main():
# We reuse scripts for integration tests in opaque and vm, and they expect
# that out/integration_tests exists. It is true if integration tests ran
# before calling perf_test.py, but not true for perf builders.
# Let's create it if it does not exist.
build_common.makedirs_safely(SuiteRunnerBase.get_output_directory())
OPTIONS.parse_configure_file()
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('mode', choices=_TEST_CLASS_MAP.keys())
parser.add_argument('--iterations', default=20, type=int,
help=('Number of iterations to run after warmup phase. '
'The default is 20.'))
parser.add_argument('--test-mode', action='store_true',
help='Test mode. Parse %s and exit.' % _OUTPUT_LOG_FILE)
parser.add_argument('--verbose', '-v', action='store_true',
help='Verbose mode')
remote_executor.add_remote_arguments(parser)
args = parser.parse_args()
_set_logging_level(args)
clazz = create_test_class(args.mode)
clazz(args).main()
示例4: _stub_parse_configure_file
def _stub_parse_configure_file():
"""A helper function for trapping calls to read the build options file.
Populate them with the default build configuration instead, so this test
behaves the same regardless of the actual configuration.
"""
OPTIONS.parse([])
示例5: main
def main():
OPTIONS.parse_configure_file()
libs = []
for lib in android_static_libraries.get_android_static_library_deps():
assert lib.endswith('.a')
lib = os.path.splitext(lib)[0]
# Strip unnecessary suffixes (e.g., libjpeg_static).
for unnecessary_suffix in ['_static', '_fake']:
if lib.endswith(unnecessary_suffix):
lib = lib[:-len(unnecessary_suffix)]
libs.append(lib)
# We are not building android/frameworks/native/opengl/libs/GLES2.
# As libGLESv2.so is just a wrapper of real GL implementations, GL
# related symbols linked in the main nexe work as symbols in
# libGLESv2.so.
libs.append('libGLESv2')
# Graphics translation builds all EGL/GLES libraries as static libraries
# so we need to register them here so that they can still be dlopen'ed.
if not OPTIONS.enable_emugl():
libs.append('libEGL')
libs.append('libEGL_emulation')
libs.append('libGLESv1_CM')
libs.append('libGLESv2_emulation')
libs_string_literals = [' "%s",' % lib for lib in libs]
sys.stdout.write(_ANDROID_STATIC_LIBRARIES_TEMPLATE.substitute({
'ANDROID_STATIC_LIBRARIES': '\n'.join(libs_string_literals)
}))
示例6: _compute_chrome_diagnostic_params
def _compute_chrome_diagnostic_params(parsed_args):
if OPTIONS.is_nacl_build():
opt = '--nacl-loader-cmd-prefix'
else:
opt = '--ppapi-plugin-launcher'
params = []
# Loading NaCl module gets stuck if --enable-logging=stderr is specified
# together with --perfstartup.
# TODO(crbug.com/276891): Investigate the root cause of the issue and fix it.
if OPTIONS.is_nacl_build() and parsed_args.perfstartup:
params.append('--enable-logging')
else:
params.append('--enable-logging=stderr')
params.append('--log-level=0')
if parsed_args.tracestartup > 0:
params.append('--trace-startup')
params.append('--trace-startup-duration=%d' % parsed_args.tracestartup)
if parsed_args.perfstartup:
params.append('%s=timeout -s INT %s %s record -gf -o out/perf.data' %
(opt, parsed_args.perfstartup, _PERF_TOOL))
return params
示例7: _run_gdb_for_nacl
def _run_gdb_for_nacl(args, test_args):
runnable_ld = args[-1]
assert 'runnable-ld.so' in runnable_ld
# Insert -g flag before -a to let sel_ldr wait for GDB.
a_index = args.index('-a')
assert 'sel_ldr' in args[a_index - 1]
args.insert(a_index, '-g')
args.extend(test_args)
# The child process call setsid(2) to create a new session so that
# sel_ldr will not die by Ctrl-C either. Note that ignoring SIGINT
# does not work for sel_ldr, because sel_ldr will override the
# setting.
sel_ldr_proc = subprocess.Popen(args, stderr=subprocess.STDOUT,
preexec_fn=os.setsid)
gdb = toolchain.get_tool(OPTIONS.target(), 'gdb')
irt = toolchain.get_tool(OPTIONS.target(), 'irt')
subprocess.call([
gdb,
'-ex', 'target remote :4014',
'-ex', 'nacl-irt %s' % irt,
# The Bionic does not pass a fullpath of a shared object to the
# debugger. Fixing this issue by modifying the Bionic loader
# will need a bunch of ARC MOD. We work-around the issue by
# passing the path of shared objects here.
#
# GDB uses NaCl Manifest file for arc.nexe so we do not need
# this for launch_chrome.
'-ex', 'set solib-search-path %s' %
build_common.get_load_library_path(),
'-ex',
'echo \n*** Type \'continue\' or \'c\' to start debugging ***\n\n',
runnable_ld])
sel_ldr_proc.kill()
示例8: _process_args
def _process_args(raw_args):
args = parse_args(raw_args)
logging.basicConfig(
level=logging.DEBUG if args.output == 'verbose' else logging.WARNING)
OPTIONS.parse_configure_file()
# Limit to one job at a time when running a suite multiple times. Otherwise
# suites start interfering with each others operations and bad things happen.
if args.repeat_runs > 1:
args.jobs = 1
if args.buildbot and OPTIONS.weird():
args.exclude_patterns.append('cts.*')
# Fixup all patterns to at least be a prefix match for all tests.
# This allows options like "-t cts.CtsHardwareTestCases" to work to select all
# the tests in the suite.
args.include_patterns = [(pattern if '*' in pattern else (pattern + '*'))
for pattern in args.include_patterns]
args.exclude_patterns = [(pattern if '*' in pattern else (pattern + '*'))
for pattern in args.exclude_patterns]
set_test_options(args)
set_test_config_flags(args)
set_test_global_state(args)
if (not args.remote and args.buildbot and
not platform_util.is_running_on_cygwin()):
print_chrome_version()
if platform_util.is_running_on_remote_host():
args.run_ninja = False
return args
示例9: main
def main():
OPTIONS.parse_configure_file()
args = _parse_args()
for arg in args.target_files:
with open(arg) as f:
analyzer = CrashAnalyzer(is_annotating=args.annotate)
for line in f:
if analyzer.handle_line(line):
print analyzer.get_crash_report()
示例10: _generate_runnable_ld_ninja
def _generate_runnable_ld_ninja():
linker_script = _generate_linker_script_for_runnable_ld()
# Not surprisingly, bionic's loader is built with a special hack to
# Android's build system so we cannot use MakefileNinjaTranslator.
n = ninja_generator.ExecNinjaGenerator('runnable-ld.so',
base_path='android/bionic/linker',
install_path='/lib',
is_system_library=True)
_add_runnable_ld_cflags(n)
n.add_library_deps('libc_bionic_linker.a') # logging functions
n.add_library_deps('libc_common_linker.a')
n.add_library_deps('libc_freebsd_linker.a') # __swsetup etc.
sources = n.find_all_sources()
sources.extend(['android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c',
'android/bionic/libc/bionic/__errno.c',
'android/bionic/libc/bionic/pthread.c',
'android/bionic/libc/bionic/pthread_create.cpp',
'android/bionic/libc/bionic/pthread_internals.cpp',
'android/bionic/libc/bionic/pthread_key.cpp'])
if OPTIONS.is_bare_metal_build():
# Remove SFI NaCl specific dynamic code allocation.
sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_alloc.c')
sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_map.c')
_remove_assembly_source(sources)
# NaCl has no signals so debugger support cannot be implemented.
sources.remove('android/bionic/linker/debugger.cpp')
# n.find_all_sources() picks up this upstream file regardless of the
# current target. For ARM, the file is obviously irrelevant. For i686
# and x86_64, we use our own begin.c.
sources.remove('android/bionic/linker/arch/x86/begin.c')
ldflags = n.get_ldflags()
if OPTIONS.is_nacl_build():
ldflags += (' -T ' + linker_script +
' -Wl,-Ttext,' + _LOADER_TEXT_SECTION_START_ADDRESS)
else:
# We need to use recent linkers for __ehdr_start.
ldflags += ' -pie'
# See the comment in linker/arch/nacl/begin.c.
ldflags += ' -Wl,--defsym=__linker_base=0'
# --gc-sections triggers an assertion failure in GNU ld for ARM for
# --opt build. The error message is very similar to the message in
# https://sourceware.org/bugzilla/show_bug.cgi?id=13990
# Once NaCl team updates the version of their binutils, we might be
# able to remove this.
if not OPTIONS.is_arm():
ldflags += ' -Wl,--gc-sections'
if not OPTIONS.is_debug_info_enabled():
ldflags += ' -Wl,--strip-all'
n.add_library_deps(*ninja_generator.get_libgcc_for_bionic())
n.add_library_deps('libbionic_ssp.a')
n.build_default(sources, base_path=None)
n.link(variables={'ldflags': ldflags}, implicit=linker_script)
示例11: main
def main():
OPTIONS.parse_configure_file()
functions = []
for function in wrapped_functions.get_wrapped_functions():
functions.append(' { "%s", reinterpret_cast<void*>(%s) },' %
(function, function))
sys.stdout.write(_WRAPPED_FUNCTIONS_CC_TEMPLATE.substitute({
'WRAPPED_FUNCTIONS': '\n'.join(functions)
}))
示例12: main
def main():
description = 'Tool to manipulate symbol list files.'
parser = argparse.ArgumentParser(description=description)
parser.add_argument(
'--dump-defined', action='store_true',
help='Dump defined symbols from the given shared object.')
parser.add_argument(
'--dump-undefined', action='store_true',
help='Dump defined symbols from the given shared object.')
parser.add_argument(
'--clean', action='store_true',
help='Copy symbols file with comments stripped.')
parser.add_argument(
'--verify', action='store_true',
help='Verify that file 1 does not contain symbols listed in file 2.')
parser.add_argument('args', nargs=argparse.REMAINDER)
args = parser.parse_args()
OPTIONS.parse_configure_file()
nm = toolchain.get_tool(OPTIONS.target(), 'nm')
if args.dump_defined:
command = (nm + ' --defined-only --extern-only --format=posix %s | '
'sed -n \'s/^\(.*\) [A-Za-z].*$/\\1/p\' | '
'LC_ALL=C sort -u' % args.args[0])
return subprocess.check_call(command, shell=True)
elif args.dump_undefined:
command = (nm + ' --undefined-only --format=posix %s | '
'sed -n \'s/^\(.*\) U.*$/\\1/p\' | '
'LC_ALL=C sort -u' % args.args[0])
return subprocess.check_call(command, shell=True)
elif args.clean:
command = ('egrep -ve "^#" %s | LC_ALL=C sort' % args.args[0])
return subprocess.check_call(command, shell=True)
elif args.verify:
command = ('LC_ALL=C comm -12 %s %s' % (args.args[0], args.args[1]))
try:
diff = subprocess.check_output(command, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
# This can happen if files are not sorted
print e.output.rstrip()
return 1
if diff:
print '%s has disallowed symbols: ' % (args.args[0])
print diff.rstrip()
return 1
return 0
print 'No command specified.'
return 1
示例13: __init__
def __init__(self, test_binary_name, inputs, output, build_commands):
self._test_binary_name = test_binary_name
self._build_commands = build_commands
out = os.path.join(BionicFundamentalTest._get_out_dir(), test_binary_name)
asmflags = ninja_generator.CNinjaGenerator.get_archasmflags()
if OPTIONS.is_bare_metal_build():
asmflags += ' -DBARE_METAL_BIONIC '
cflags = ninja_generator.CNinjaGenerator.get_archcflags()
cxxflags = ninja_generator.CNinjaGenerator.get_cxxflags()
cflags = asmflags + cflags + ' $commonflags -g -fPIC -Wall -W -Werror '
cxxflags = cflags + cxxflags
ldflags = ('-Wl,-rpath-link=' + build_common.get_load_library_path() +
' -Wl,--hash-style=sysv')
# Use -Bsymbolic to have similar configuration as other NaCl
# executables in ARC.
soflags = '-shared -Wl,-Bsymbolic'
if OPTIONS.is_arm():
# For ARM, we need to link libgcc.a into shared objects. See the comment
# in SharedObjectNinjaGenerator.
# TODO(crbug.com/283798): Build libgcc by ourselves and remove this.
soflags += ' ' + ' '.join(
ninja_generator.get_libgcc_for_bionic())
text_segment_address = (ninja_generator.ExecNinjaGenerator.
get_nacl_text_segment_address())
if OPTIONS.is_bare_metal_build():
execflags = '-pie'
# Goobuntu's linker emits RWX pages for small PIEs. Use gold
# instead. We cannot specify -fuse-ld=gold. As we are building
# executables directly from .c files, the -fuse-ld flag will be
# passed to cc1 and it does not recognize this flag.
ldflags += ' -Bthird_party/gold'
else:
# This is mainly for ARM. See src/build/ninja_generator.py for detail.
execflags = '-Wl,-Ttext-segment=' + text_segment_address
self._variables = {
'name': self._test_binary_name,
'cc': toolchain.get_tool(OPTIONS.target(), 'cc'),
'cxx': toolchain.get_tool(OPTIONS.target(), 'cxx'),
'lib_dir': build_common.get_load_library_path(),
'in_dir': BionicFundamentalTest._get_src_dir(),
'out_dir': BionicFundamentalTest._get_out_dir(),
'out': out,
'crtbegin_exe': build_common.get_bionic_crtbegin_o(),
'crtbegin_so': build_common.get_bionic_crtbegin_so_o(),
'crtend_exe': build_common.get_bionic_crtend_o(),
'crtend_so': build_common.get_bionic_crtend_so_o(),
'cflags': cflags,
'cxxflags': cxxflags,
'ldflags': ldflags,
'soflags': soflags,
'execflags': execflags
}
self._inputs = map(self._expand_vars, inputs)
self._output = self._expand_vars(output)
示例14: _get_nacl_irt_path
def _get_nacl_irt_path(parsed_args):
if not OPTIONS.is_nacl_build():
return None
chrome_path = _get_chrome_path(parsed_args)
irt = toolchain.get_tool(OPTIONS.target(), 'irt')
nacl_irt_path = os.path.join(os.path.dirname(chrome_path), irt)
nacl_irt_debug_path = nacl_irt_path + '.debug'
# Use debug version nacl_irt if it exists.
if os.path.exists(nacl_irt_debug_path):
return nacl_irt_debug_path
else:
return nacl_irt_path
示例15: main
def main():
description = ('Runs multiple APKs and indicates how many succeed or '
'fail and with what failure modes.')
parser = argparse.ArgumentParser(description=description)
parser.add_argument('-j', '--jobs', metavar='N', default=1, type=int,
help='Run N tests at once.')
parser.add_argument('--launch-chrome-opt', action='append', default=[],
dest='launch_chrome_opts', metavar='OPTIONS',
help=('An Option to pass on to launch_chrome. Repeat as '
'needed for any options to pass on.'))
parser.add_argument('--minimum-lifetime', type=int, default=0,
metavar='<T>', help='This flag will be passed to '
'launch_chrome to control the behavior after onResume. '
'This requires the application to continue running T '
'seconds.')
parser.add_argument('--minimum-steady', type=int, default=0,
metavar='<T>', help='This flag will be passed to '
'launch_chrome to control the behavior after onResume. '
'This requires the application to continue running T '
'seconds with no output.')
parser.add_argument('--noninja', action='store_false',
default=True, dest='run_ninja',
help='Do not run ninja before running any tests.')
parser.add_argument('--timeout', metavar='T', default=60, type=int,
help='Timeout value for onResume. Once onResume '
'fires, --minimum-lifetime and --minimum-steady '
'determine when the application is considered '
'successfully running.')
parser.add_argument('--show-known-java-exceptions', action='store_true',
help='Show the known Java exceptions if this flag '
'is specified.')
parser.add_argument('--tsv', metavar='TSV', help='Output results in TSV to '
'the file specified by this argument.')
parser.add_argument('apks', metavar='apk', nargs='*',
help='Filenames of APKs.')
remote_executor.add_remote_arguments(parser)
args = parser.parse_args()
OPTIONS.parse_configure_file()
if args.run_ninja:
build_common.run_ninja()
if not os.path.exists(_OUT_DIR):
os.mkdir(_OUT_DIR)
sys.stdout.write('=== Results ===\n')
results = _test_apks_boot(args)
sys.stdout.write('\n')
_show_stats(results)
if args.tsv:
_output_tsv(results, args.tsv)