本文整理汇总了Python中src.build.build_options.OPTIONS类的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS类的具体用法?Python OPTIONS怎么用?Python OPTIONS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OPTIONS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main(args):
OPTIONS.parse_configure_file()
# TODO(crbug.com/378196): Make qemu-arm available in open source in order to
# run any unit tests there.
if open_source.is_open_source_repo() and OPTIONS.is_arm():
return 0
for test_name in args[1:]:
pipe = subprocess.Popen(['python', 'src/build/run_unittest.py',
test_name],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out = pipe.communicate()[0]
sys.stdout.write(out)
if pipe.returncode:
sys.stdout.write('FAIL (exit=%d)\n' % pipe.returncode)
sys.stdout.write(out + '\n')
return 1
elif out.find('PASS\n') < 0:
sys.stdout.write('FAIL (no PASS)\n')
sys.stdout.write(out + '\n')
return 1
else:
sys.stdout.write('OK\n')
return 0
示例2: main
def main():
OPTIONS.parse_configure_file()
logging.getLogger().setLevel(logging.INFO)
if len(sys.argv) != 3:
logging.fatal('Usage: %s android-lib.so arc-lib.so' % sys.argv[0])
return 1
android_lib = sys.argv[1]
arc_lib = sys.argv[2]
android_syms = get_defined_symbols(android_lib)
arc_syms = get_defined_symbols(arc_lib)
missing_syms = set(android_syms - arc_syms)
# Ignore symbols starting with two underscores since they are internal ones.
# However, we do not ignore symbols starting with one underscore so that the
# script can check symbols such as _Zxxx (mangled C++ symbols), _setjmp, and
# _longjmp.
important_missing_syms = [
sym for sym in missing_syms if not sym.startswith('__')]
if important_missing_syms:
for sym in sorted(important_missing_syms):
logging.error('Missing symbol: %s' % sym)
return 1
return 0
示例3: _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([])
示例4: _generate_shared_lib_depending_ninjas
def _generate_shared_lib_depending_ninjas(ninja_list):
timer = build_common.SimpleTimer()
timer.start('Generating plugin and packaging ninjas', OPTIONS.verbose())
# We must generate plugin/nexe ninjas after make->ninja lazy generation
# so that we have the full list of production shared libraries to
# pass to the load test.
# These modules depend on shared libraries generated in the previous phase.
production_shared_libs = (
ninja_generator.NinjaGenerator.get_production_shared_libs(ninja_list[:]))
generator_list = list(_list_ninja_generators(
_config_loader, 'generate_shared_lib_depending_ninjas'))
if OPTIONS.run_tests():
generator_list.extend(_list_ninja_generators(
_config_loader, 'generate_shared_lib_depending_test_ninjas'))
result_list = ninja_generator_runner.run_in_parallel(
[ninja_generator_runner.GeneratorTask(
config_context,
(generator, production_shared_libs))
for config_context, generator in generator_list],
OPTIONS.configure_jobs())
ninja_list = []
for config_result in result_list:
ninja_list.extend(config_result.generated_ninjas)
ninja_list.sort(key=lambda ninja: ninja.get_module_name())
timer.done()
return ninja_list
示例5: generate_ninjas
def generate_ninjas():
needs_clobbering, cache_to_save = _set_up_generate_ninja()
ninja_list, independent_ninja_cache = _generate_independent_ninjas(
needs_clobbering)
cache_to_save.extend(independent_ninja_cache)
ninja_list.extend(
_generate_shared_lib_depending_ninjas(ninja_list))
ninja_list.extend(_generate_dependent_ninjas(ninja_list))
top_level_ninja = _generate_top_level_ninja(ninja_list)
ninja_list.append(top_level_ninja)
# Run verification before emitting to files.
_verify_ninja_generator_list(ninja_list)
# Emit each ninja script to a file.
timer = build_common.SimpleTimer()
timer.start('Emitting ninja scripts', OPTIONS.verbose())
for ninja in ninja_list:
ninja.emit()
top_level_ninja.emit_depfile()
top_level_ninja.cleanup_out_directories(ninja_list)
timer.done()
if OPTIONS.enable_config_cache():
for cache_object, cache_path in cache_to_save:
cache_object.save_to_file(cache_path)
示例6: _filter_params_for_v8
def _filter_params_for_v8(vars):
# Switch V8 to always emit ARM code and use simulator to run that on
# x86 NaCl.
# Also disable snapshots as they are not working in ARC yet.
if OPTIONS.is_nacl_build():
if '-DV8_TARGET_ARCH_IA32' in vars.get_cflags():
vars.get_cflags().remove('-DV8_TARGET_ARCH_IA32')
if '-DV8_TARGET_ARCH_X64' in vars.get_cflags():
vars.get_cflags().remove('-DV8_TARGET_ARCH_X64')
vars.get_cflags().append('-DV8_TARGET_ARCH_ARM')
vars.get_cflags().append('-D__ARM_ARCH_7__')
sources = vars.get_sources()
new_sources = []
v8_src = 'android/external/chromium_org/v8/src/'
for path in sources:
if OPTIONS.is_nacl_build():
if path.startswith(v8_src + 'x64/'):
path = v8_src + 'arm/' + os.path.basename(path).replace('x64', 'arm')
if path.startswith(v8_src + 'ia32/'):
path = v8_src + 'arm/' + os.path.basename(path).replace('ia32', 'arm')
if path.endswith('/snapshot.cc'):
path = 'android/external/chromium_org/v8/src/snapshot-empty.cc'
new_sources.append(path)
if not OPTIONS.is_arm() and OPTIONS.is_nacl_build():
new_sources.append(v8_src + 'arm/constants-arm.cc')
new_sources.append(v8_src + 'arm/simulator-arm.cc')
vars.get_sources()[:] = new_sources
示例7: main
def main():
OPTIONS.parse_configure_file()
target = OPTIONS.target()
regular_expectations = _get_expectations()
large_expectations = _get_expectations(["--include-large"])
for botname in os.listdir(_BOTLOGS_DIR):
if not botname.replace("-", "_").startswith(target):
continue
botdir = os.path.join(_BOTLOGS_DIR, botname)
lognames = [os.path.join(botdir, filename) for filename in os.listdir(botdir)]
failures, incompletes = _parse(lognames)
top_flake = sorted([(freq, name) for name, freq in failures.iteritems()], reverse=True)
print "%s:" % botname
if "large_tests" in botname:
expectations = large_expectations
else:
expectations = regular_expectations
for freq, name in top_flake:
assert name in expectations, "%s is not in expectations list" % name
run, flags = expectations[name]
if run == "SKIP":
continue
failrate = 100.0 * freq / float(len(lognames))
print "%5.2f%% fail rate [%-4s %-19s] %s" % (failrate, run, ",".join(flags), name)
print
return 0
示例8: _process_args
def _process_args(raw_args):
args = parse_args(raw_args)
logging_util.setup(
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_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: _get_generate_libvpx_asm_ninja
def _get_generate_libvpx_asm_ninja():
if not OPTIONS.is_arm():
return None
gen_asm_ninja = ninja_generator.NinjaGenerator('libvpx_asm')
# Translate RVCT format assembly code into GNU Assembler format.
gen_asm_ninja.rule(
_GEN_LIBVPX_ASM_RULE,
command=_ADS2GAS + ' < $in > $out.tmp && (mv $out.tmp $out)')
# Translate C source code into assembly code and run grep to
# generate a list of constants. Assembly code generated by this rule
# will be included from other assembly code. See
# third_party/android/external/libvpx/libvpx.mk for corresponding
# rules written in Makefile.
asm_include_paths = [
'-I' + staging.as_staging('android/external/libvpx/armv7a-neon'),
'-I' + staging.as_staging('android/external/libvpx/libvpx')
]
gen_asm_ninja.rule(
_GEN_LIBVPX_OFFSETS_ASM_RULE,
command=('%s -DINLINE_ASM %s -S $in -o $out.s && '
'grep \'^[a-zA-Z0-9_]* EQU\' $out.s | '
'tr -d \'$$\\#\' | '
'%s > $out.tmp && (mv $out.tmp $out)' % (toolchain.get_tool(
OPTIONS.target(), 'cc'), ' '.join(asm_include_paths),
_ADS2GAS)))
return gen_asm_ninja
示例10: _convert_launch_chrome_options_to_external_metadata
def _convert_launch_chrome_options_to_external_metadata(parsed_args):
metadata = parsed_args.additional_metadata
for definition in manager.get_metadata_definitions():
value = getattr(parsed_args, definition.python_name, None)
if value is not None:
metadata[definition.name] = value
if bool(parsed_args.jdb_port or parsed_args.gdb):
metadata['disableChildPluginRetry'] = True
metadata['disableHeartbeat'] = True
metadata['sleepOnBlur'] = False
if (parsed_args.mode == 'atftest' or parsed_args.mode == 'system' or
OPTIONS.get_system_packages()):
# An app may briefly go through empty stack while running
# addAccounts() in account manager service.
# TODO(igorc): Find a more precise detection mechanism to support GSF,
# implement empty stack timeout, or add a flag if this case is more common.
metadata['allowEmptyActivityStack'] = True
command = _generate_shell_command(parsed_args)
if command:
metadata['shell'] = command
metadata['isDebugCodeEnabled'] = OPTIONS.is_debug_code_enabled()
return metadata
示例11: generate_ninjas
def generate_ninjas():
base_path = os.path.join("graphics_translation", "egl")
n = ninja_generator.ArchiveNinjaGenerator("libegl", force_compiler="clang", enable_cxx11=True, base_path=base_path)
n.add_compiler_flags("-Werror")
n.add_notice_sources(["mods/graphics_translation/NOTICE"])
n.add_include_paths(
"mods",
"android/system/core/include",
"android/hardware/libhardware/include",
"android/frameworks/native/include",
"android/frameworks/native/opengl/include",
)
n.emit_gl_common_flags(False)
n.add_ppapi_compile_flags()
if OPTIONS.is_egl_api_tracing():
n.add_defines("ENABLE_API_TRACING")
if OPTIONS.is_egl_api_logging():
n.add_defines("ENABLE_API_LOGGING")
if OPTIONS.is_ansi_fb_logging():
n.add_defines("ANSI_FB_LOGGING")
sources = n.find_all_sources()
n.build_default(sources, base_path="mods")
n.archive()
示例12: _generate_jemalloc_integration_tests
def _generate_jemalloc_integration_tests():
paths = build_common.find_all_files(
'android/external/jemalloc/test/integration', ['.c'], include_tests=True)
# Disable some multi-threaded tests flaky under ARM qemu.
if OPTIONS.is_arm():
paths.remove('android/external/jemalloc/test/integration/MALLOCX_ARENA.c')
paths.remove('android/external/jemalloc/test/integration/thread_arena.c')
for path in paths:
name = os.path.splitext(os.path.basename(path))[0]
n = ninja_generator.TestNinjaGenerator('jemalloc_integartion_test_' + name)
n.add_include_paths(
'android/external/jemalloc/include',
'android/external/jemalloc/test/include')
n.add_c_flags('-Werror')
n.add_c_flags('-DJEMALLOC_INTEGRATION_TEST')
if OPTIONS.enable_jemalloc_debug():
n.add_c_flags('-DJEMALLOC_DEBUG')
# Needs C99 for "restrict" keyword.
n.add_c_flags('-std=gnu99')
n.add_library_deps('libjemalloc.a')
n.add_library_deps('libjemalloc_integrationtest.a')
n.build_default([path])
n.run(n.link(), enable_valgrind=OPTIONS.enable_valgrind(), rule='run_test')
示例13: _generate_jemalloc_unit_tests
def _generate_jemalloc_unit_tests():
paths = build_common.find_all_files(
'android/external/jemalloc/test/unit', ['.c'], include_tests=True)
# These tests need -DJEMALLOC_PROF which we do not enable.
paths.remove('android/external/jemalloc/test/unit/prof_accum.c')
paths.remove('android/external/jemalloc/test/unit/prof_accum_a.c')
paths.remove('android/external/jemalloc/test/unit/prof_accum_b.c')
paths.remove('android/external/jemalloc/test/unit/prof_gdump.c')
paths.remove('android/external/jemalloc/test/unit/prof_idump.c')
# Disable some multi-threaded tests flaky under ARM qemu.
if OPTIONS.is_arm():
paths.remove('android/external/jemalloc/test/unit/mq.c')
paths.remove('android/external/jemalloc/test/unit/mtx.c')
for path in paths:
name = os.path.splitext(os.path.basename(path))[0]
n = ninja_generator.TestNinjaGenerator('jemalloc_unit_test_' + name)
n.add_include_paths(
'android/external/jemalloc/include',
'android/external/jemalloc/test/include')
n.add_c_flags('-Werror')
n.add_c_flags('-DJEMALLOC_UNIT_TEST')
if OPTIONS.enable_jemalloc_debug():
n.add_c_flags('-DJEMALLOC_DEBUG')
# Needs C99 for "restrict" keyword.
n.add_c_flags('-std=gnu99')
n.add_library_deps('libjemalloc_jet.a')
n.add_library_deps('libjemalloc_unittest.a')
n.build_default([path])
n.run(n.link(), enable_valgrind=OPTIONS.enable_valgrind(), rule='run_test')
示例14: run
def run():
OPTIONS.parse_configure_file()
# Check if internal/ exists. Run git-clone if not.
if not os.path.isdir(_ARC_INTERNAL_DIR):
# TODO(tandrii): Move this nacl-x86_64-bionic-internal recipe's botupdate
# step.
url = 'https://chrome-internal.googlesource.com/arc/internal-packages.git'
logging.info('Cloning %s' % url)
subprocess.check_call('git clone %s internal' % url,
cwd=_ARC_ROOT, shell=True)
# On 'internal' mode, sync the HEAD to the DEPS revision.
# On 'internal-dev', just use the current HEAD.
if OPTIONS.internal_apks_source() == 'internal':
# Check if internal/ is clean and on master.
if _git_has_local_modification():
logging.error('%s has local modification' % _ARC_INTERNAL_DIR)
sys.exit(-1)
# Check if internal/ is up to date. Run git-reset if not.
with open(_DEPS_FILE) as f:
target_revision = f.read().rstrip()
logging.info('%s has %s' % (_DEPS_FILE, target_revision))
if target_revision != _get_current_arc_int_revision():
sync_repo(target_revision)
# Run the configuration for the current HEAD revision. This steps includes
# syncing internal/third_party/ repositories when needed.
subprocess.check_call(os.path.join(_ARC_INTERNAL_DIR, 'build/configure.py'))
return 0
示例15: _generate_test_framework_ninjas
def _generate_test_framework_ninjas():
# Build two versions of libgtest and libgmock that are built and linked with
# STLport or libc++. It is used to build tests that depends on each library.
_generate_gtest_ninja('libgtest', enable_libcxx=False)
if not OPTIONS.run_tests():
gtest_libcxx_instances = 0
else:
# libart-gtest.so, libarttest.so, and libnativebridgetest.so uses
# libgtest_libc++.a. But when --disable-debug-code is specified,
# libart-gtest.so is not built.
if OPTIONS.is_debug_code_enabled():
gtest_libcxx_instances = 3
else:
gtest_libcxx_instances = 2
_generate_gtest_ninja('libgtest_libc++',
instances=gtest_libcxx_instances, enable_libcxx=True)
# libartd.so for host uses libgtest_host.a. Although it is built with
# libc++, it is not named libgtest_libc++_host.a by Android.mk.
if OPTIONS.is_debug_code_enabled():
_generate_gtest_ninja('libgtest_host', host=True, enable_libcxx=True)
_generate_gmock_ninja('libgmock', enable_libcxx=False)
_generate_gmock_ninja('libgmock_libc++', enable_libcxx=True)