本文整理汇总了Python中common_py.system.executor.Executor类的典型用法代码示例。如果您正苦于以下问题:Python Executor类的具体用法?Python Executor怎么用?Python Executor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Executor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_napi_test_module
def build_napi_test_module(is_debug):
node_gyp = fs.join(path.PROJECT_ROOT,
'node_modules',
'.bin',
'node-gyp')
print('==> Build N-API test module with node-gyp\n')
project_root = fs.join(path.PROJECT_ROOT, 'test', 'napi')
debug_cmd = '--debug' if is_debug else '--release'
Executor.check_run_cmd(node_gyp, ['configure', debug_cmd ,'rebuild'],
cwd=project_root)
示例2: __init__
def __init__(self, options):
self._process_pool = multiprocessing.Pool(processes=1)
self.iotjs = fs.abspath(options.iotjs)
self.quiet = options.quiet
self.platform = options.platform
self.timeout = options.timeout
self.valgrind = options.valgrind
self.coverage = options.coverage
self.n_api = options.n_api
self.skip_modules = []
self.results = {}
self._msg_queue = multiprocessing.Queue(1)
if options.skip_modules:
self.skip_modules = options.skip_modules.split(",")
# Process the iotjs build information.
iotjs_output = Executor.check_run_cmd_output(self.iotjs,
[path.BUILD_INFO_PATH])
build_info = json.loads(iotjs_output)
self.builtins = set(build_info["builtins"])
self.features = set(build_info["features"])
self.stability = build_info["stability"]
self.debug = build_info["debug"]
if options.n_api:
build_napi_test_module(self.debug)
示例3: job_host_darwin
def job_host_darwin():
for buildtype in BUILDTYPES:
ex.check_run_cmd('./tools/build.py', [
'--run-test=full',
'--buildtype=' + buildtype,
'--clean',
'--profile=test/profiles/host-darwin.profile'])
示例4: configure_trizenrt
def configure_trizenrt(tizenrt_root, buildtype):
# TODO: handle buildtype (build vs release) for tizenrt build
tizenrt_tools = fs.join(tizenrt_root, 'os/tools')
fs.chdir(tizenrt_tools)
ex.check_run_cmd('./configure.sh', ['artik053/iotjs'])
fs.chdir('..')
ex.check_run_cmd('make', ['context'])
示例5: run_make
def run_make(options, build_home, *args):
make_opt = ['-C', build_home]
make_opt.extend(args)
if not options.no_parallel_build:
make_opt.append('-j')
ex.check_run_cmd('make', make_opt)
示例6: resolve_modules
def resolve_modules(options):
""" Resolve include/exclude module lists based on command line arguments
and build config.
"""
# Load all the supported modules
supported = options.config['module']['supported']
core_modules = set(supported['core'])
basic_modules = set(supported['basic'])
# By default the target included modules are:
# - 'core' module set from the build config
# - modules specified by the command line argument
include_modules = set() | core_modules
include_modules |= options.iotjs_include_module
if not options.iotjs_minimal_profile:
# Add 'basic' module to the target include modules
include_modules |= basic_modules
# Start to check exclude modules
exclude_modules = options.iotjs_exclude_module
# Check if there are any modules which are not allowed to be excluded
impossible_to_exclude = exclude_modules & core_modules
if impossible_to_exclude:
ex.fail('Can not exclude modules which are in `core` modules: %s' %
', '.join(impossible_to_exclude))
# Finally remove the excluded modules from the included modules set
include_modules -= exclude_modules
return include_modules, exclude_modules
示例7: resolve_modules
def resolve_modules(options):
""" Resolve include/exclude module lists based on command line arguments
and build config.
"""
# Load the modules which are always enabled and the include/exclude sets
build_modules_always = set(options.config['module']['always'])
build_modules_includes = set(options.config['module']['include'])
build_modules_excludes = set(options.config['module']['exclude']['all'])
if options.target_os:
system_os = options.target_os
if system_os == 'tizen':
system_os = 'linux'
build_modules_excludes |= set(
options.config['module']['exclude'][system_os])
# By default the target included modules are:
# - always module set from the build config
# - modules specified by the command line argument
include_modules = set()
include_modules |= build_modules_always
include_modules |= options.iotjs_include_module
if not options.iotjs_minimal_profile:
# In case of normal build (not minimal profile):
# Check if there is any overlap between the included and excluded
# module sets which are from the build config
problem_modules = build_modules_includes & build_modules_excludes
if problem_modules:
print('Detected module(s) both in include and exclude list.',
end=' ')
print('Module name(s): %s' % ', '.join(problem_modules))
ex.fail('Inconsistency in build config file!')
# Add the include set from the build config to
# the target include modules set
include_modules |= build_modules_includes
# Check if there is any modules which are not allowed to be excluded
impossible_to_exclude = options.iotjs_exclude_module & build_modules_always
if impossible_to_exclude:
ex.fail('Cannot exclude modules which are always enabled: %s' %
', '.join(impossible_to_exclude))
# Remove any excluded modules (defined by the command line argument) from
# the target include set
include_modules -= options.iotjs_exclude_module
# Finally build up the excluded module set:
# - use the command line exclude set
# - use the exclude set from the build config
exclude_modules = options.iotjs_exclude_module | build_modules_excludes
# Remove the included modules set from the excluded modules
exclude_modules -= include_modules
assert len(include_modules & exclude_modules) == 0, \
'Module can NOT be both in include and exclude list'
return include_modules, exclude_modules
示例8: build_nuttx
def build_nuttx(nuttx_root, buildtype, maketarget):
fs.chdir(fs.join(nuttx_root, 'nuttx'))
if buildtype == "release":
rflag = 'R=1'
else:
rflag = 'R=0'
ex.check_run_cmd('make',
[maketarget, 'IOTJS_ROOT_DIR=' + path.PROJECT_ROOT, rflag])
示例9: setup_tizen_root
def setup_tizen_root(tizen_root):
if fs.exists(tizen_root):
fs.chdir(tizen_root)
ex.check_run_cmd('git', ['pull'])
fs.chdir(path.PROJECT_ROOT)
else:
ex.check_run_cmd('git', ['clone',
'https://github.com/pmarcinkiew/tizen3.0_rootstrap.git',
tizen_root])
示例10: run_docker
def run_docker():
ex.check_run_cmd('docker', ['pull', DOCKER_TAG])
ex.check_run_cmd('docker', ['run', '-dit', '--privileged',
'--name', DOCKER_NAME, '-v',
'%s:%s' % (TRAVIS_BUILD_PATH, DOCKER_IOTJS_PATH),
'--add-host', 'test.mosquitto.org:127.0.0.1',
'--add-host', 'echo.websocket.org:127.0.0.1',
'--add-host', 'httpbin.org:127.0.0.1',
DOCKER_TAG])
示例11: adjust_options
def adjust_options(options):
# First fix some option inconsistencies
if options.target_os in ['nuttx', 'tizenrt']:
options.buildlib = True
if not options.sysroot:
ex.fail('--sysroot needed for nuttx target')
options.sysroot = fs.abspath(options.sysroot)
if not fs.exists(options.sysroot):
ex.fail('Nuttx sysroot %s does not exist' % options.sysroot)
if options.target_arch == 'x86':
options.target_arch = 'i686'
if options.target_arch == 'x64':
options.target_arch = 'x86_64'
if options.target_os == 'darwin':
options.no_check_valgrind = True
if options.target_board in ['rpi2', 'artik10', 'artik05x']:
options.no_check_valgrind = True
elif options.target_board == 'none':
options.target_board = None
if options.iotjs_minimal_profile:
options.no_check_test = True
# Then add calculated options
options.host_tuple = '%s-%s' % (platform.arch(), platform.os())
options.target_tuple = '%s-%s' % (options.target_arch, options.target_os)
options.host_build_root = fs.join(path.PROJECT_ROOT,
options.builddir,
'host',
options.host_tuple,
options.buildtype)
options.host_build_bins = fs.join(options.host_build_root, 'bin')
options.build_root = fs.join(path.PROJECT_ROOT,
options.builddir,
options.target_tuple,
options.buildtype)
options.build_bins = fs.join(options.build_root, 'bin')
options.build_libs = fs.join(options.build_root, 'lib')
cmake_path = fs.join(path.PROJECT_ROOT, 'cmake', 'config', '%s.cmake')
options.cmake_toolchain_file = cmake_path % options.target_tuple
options.host_cmake_toolchain_file = cmake_path % options.host_tuple
# Specify the file of JerryScript profile
options.jerry_profile = fs.join(path.JERRY_PROFILE_ROOT,
options.jerry_profile + '.profile')
示例12: copy_tiznert_stuff
def copy_tiznert_stuff(tizenrt_root, iotjs_dir):
tizenrt_iotjsapp_dir = fs.join(tizenrt_root, 'apps/system/iotjs')
tizenrt_config_dir = fs.join(tizenrt_root, 'build/configs/artik053/iotjs')
iotjs_tizenrt_appdir = fs.join(iotjs_dir,
'config/tizenrt/artik05x/app')
iotjs_config_dir = \
fs.join(iotjs_dir, 'config/tizenrt/artik05x/configs')
ex.check_run_cmd('cp',
['-rfu', iotjs_tizenrt_appdir, tizenrt_iotjsapp_dir])
ex.check_run_cmd('cp',
['-rfu', iotjs_config_dir, tizenrt_config_dir])
示例13: exec_docker
def exec_docker(cwd, cmd, env=[], is_background=False):
exec_cmd = 'cd %s && ' % cwd + ' '.join(cmd)
if is_background:
docker_args = ['exec', '-dit']
else:
docker_args = ['exec', '-it']
for e in env:
docker_args.append('-e')
docker_args.append(e)
docker_args += [DOCKER_NAME, 'bash', '-c', exec_cmd]
ex.check_run_cmd('docker', docker_args)
示例14: run_checktest
def run_checktest(option):
checktest_quiet = 'yes'
if os.getenv('TRAVIS') == "true":
checktest_quiet = 'no'
# iot.js executable
iotjs = fs.join(build_root, 'iotjs', 'iotjs')
fs.chdir(path.PROJECT_ROOT)
code = ex.run_cmd(iotjs, [path.CHECKTEST_PATH,
'--',
'quiet='+checktest_quiet])
if code != 0:
ex.fail('Failed to pass unit tests')
if not option.no_check_valgrind:
code = ex.run_cmd('valgrind', ['--leak-check=full',
'--error-exitcode=5',
'--undef-value-errors=no',
iotjs,
path.CHECKTEST_PATH,
'--',
'quiet='+checktest_quiet])
if code == 5:
ex.fail('Failed to pass valgrind test')
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
return True
示例15: test_cpp
def test_cpp():
test_dir = fs.join(os.path.dirname(__file__), 'test_cpp')
test_cpp = fs.join(test_dir, 'test.cpp')
# Compile test.c and make a static library
print_blue('Compile C++ test module.')
ex.check_run_cmd_output('c++', ['-c', test_cpp, '-o', test_dir + '/test.o'])
ex.check_run_cmd_output('ar', ['-cr', test_dir + '/libtest.a',
test_dir + '/test.o'])
# Generate test_module
print_blue('Generate binding for C++ test module.')
ex.check_run_cmd_output(generator_script, [test_dir, 'c++'])
# Build iotjs
print_blue('Build IoT.js.')
module_dir = fs.join(module_generator_dir, 'output', 'test_cpp_module')
args = [
'--external-module=' + module_dir,
'--cmake-param=-DENABLE_MODULE_TEST_CPP_MODULE=ON',
'--jerry-profile=es2015-subset',
'--clean'
]
ex.check_run_cmd_output(build_script, args)
run_test_js(test_dir)
print_green('C++ test succeeded.')