未验证 提交 65a04caf 编写于 作者: L Lukáš Doktor

Merging pull request 1463

* https://github.com/avocado-framework/avocado:
  rename make to run_make which using process.run
  fix style compatible to pep8 standard
...@@ -18,7 +18,8 @@ import os ...@@ -18,7 +18,8 @@ import os
from . import process from . import process
def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_output_check='none'): def run_make(path, make='make', env=None, extra_args='', ignore_status=False,
allow_output_check='none'):
""" """
Run make, adding MAKEOPTS to the list of options. Run make, adding MAKEOPTS to the list of options.
...@@ -38,6 +39,7 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_ ...@@ -38,6 +39,7 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_
to use the compilation output as a reference to use the compilation output as a reference
in tests. in tests.
:type allow_output_check: str :type allow_output_check: str
:returns: the make command result object
""" """
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(path) os.chdir(path)
...@@ -56,9 +58,39 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_ ...@@ -56,9 +58,39 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_
cmd += ' %s' % makeopts cmd += ' %s' % makeopts
if extra_args: if extra_args:
cmd += ' %s' % extra_args cmd += ' %s' % extra_args
make_process = process.system(cmd, make_process = process.run(cmd,
env=env, env=env,
ignore_status=ignore_status, ignore_status=ignore_status,
allow_output_check=allow_output_check) allow_output_check=allow_output_check)
os.chdir(cwd) os.chdir(cwd)
return make_process return make_process
def make(path, make='make', env=None, extra_args='', ignore_status=False,
allow_output_check='none'):
"""
Run make, adding MAKEOPTS to the list of options.
:param make: what make command name to use.
:param env: dictionary with environment variables to be set before
calling make (e.g.: CFLAGS).
:param extra: extra command line arguments to pass to make.
:param allow_output_check: Whether to log the command stream outputs
(stdout and stderr) of the make process in
the test stream files. Valid values: 'stdout',
for allowing only standard output, 'stderr',
to allow only standard error, 'all',
to allow both standard output and error,
and 'none', to allow none to be
recorded (default). The default here is
'none', because usually we don't want
to use the compilation output as a reference
in tests.
:type allow_output_check: str
:returns: exit status of the make process
"""
result = run_make(path, make, env, extra_args, ignore_status,
allow_output_check)
return result.exit_status
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册