Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
d2a41697
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2a41697
编写于
6月 24, 2015
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #704 from clebergnu/usability_fixes
Usability fixes on "$ avocado run --help"
上级
1b219c10
a30e786e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
81 addition
and
79 deletion
+81
-79
avocado/core/plugins/gdb.py
avocado/core/plugins/gdb.py
+12
-10
avocado/core/plugins/htmlresult.py
avocado/core/plugins/htmlresult.py
+2
-2
avocado/core/plugins/jsonresult.py
avocado/core/plugins/jsonresult.py
+2
-2
avocado/core/plugins/remote.py
avocado/core/plugins/remote.py
+1
-1
avocado/core/plugins/runner.py
avocado/core/plugins/runner.py
+6
-5
avocado/core/plugins/vm.py
avocado/core/plugins/vm.py
+2
-3
avocado/core/plugins/wrapper.py
avocado/core/plugins/wrapper.py
+8
-8
avocado/core/plugins/xunit.py
avocado/core/plugins/xunit.py
+2
-2
docs/source/DebuggingWithGDB.rst
docs/source/DebuggingWithGDB.rst
+21
-21
docs/source/WrapProcess.rst
docs/source/WrapProcess.rst
+5
-5
man/avocado.rst
man/avocado.rst
+20
-20
未找到文件。
avocado/core/plugins/gdb.py
浏览文件 @
d2a41697
...
...
@@ -35,19 +35,21 @@ class GDB(plugin.Plugin):
self
.
parser
=
parser
gdb_grp
=
self
.
parser
.
runner
.
add_argument_group
(
'GNU Debugger support'
)
gdb_grp
.
add_argument
(
'--gdb-run-bin'
,
action
=
'append'
,
default
=
[],
metavar
=
'BINARY_PATH'
,
help
=
(
'Set a breakpoint on a given binary to be '
'run inside the GNU debugger. Format should '
'be "<binary>[:breakpoint]". Breakpoint '
'defaults to "main"'
))
default
=
[],
metavar
=
'EXECUTABLE[:BREAKPOINT]'
,
help
=
(
'Run a given executable inside the GNU '
'debugger, pausing at a given breakpoint '
'(defaults to "main")'
))
# Because of a bug in Python's argparse, it's not possible to mark
# this option metavar as [EXECUTABLE:]COMMANDS, signalling that the
# EXECUTABLE is optional. https://bugs.python.org/issue11874
gdb_grp
.
add_argument
(
'--gdb-prerun-commands'
,
action
=
'append'
,
default
=
[],
metavar
=
'
BINARY_PATH:COMMANDS_PATH
'
,
help
=
(
'After loading a
binary in binary
in GDB, '
default
=
[],
metavar
=
'
EXECUTABLE:COMMANDS
'
,
help
=
(
'After loading a
n executable
in GDB, '
'but before actually running it, execute '
'the
given
GDB commands in the given file. '
'
BINARY_PATH is optional and
if omitted '
'
will apply to all binari
es'
))
'the GDB commands in the given file. '
'
EXECUTABLE is optional,
if omitted '
'
COMMANDS will apply to all executabl
es'
))
gdb_grp
.
add_argument
(
'--gdb-coredump'
,
choices
=
(
'on'
,
'off'
),
default
=
'off'
,
...
...
avocado/core/plugins/htmlresult.py
浏览文件 @
d2a41697
...
...
@@ -279,8 +279,8 @@ class HTML(plugin.Plugin):
self
.
parser
=
parser
self
.
parser
.
runner
.
output
.
add_argument
(
'--html'
,
type
=
str
,
dest
=
'html_output'
,
help
=
(
'Enable HTML output to the
file
where the result should be '
dest
=
'html_output'
,
metavar
=
'FILE'
,
help
=
(
'Enable HTML output to the
FILE
where the result should be '
'written. The value - (output to stdout) is not supported '
'since not all HTML resources can be embedded into a '
'single file (page resources will be copied to the '
...
...
avocado/core/plugins/jsonresult.py
浏览文件 @
d2a41697
...
...
@@ -104,8 +104,8 @@ class JSON(plugin.Plugin):
self
.
parser
=
parser
self
.
parser
.
runner
.
output
.
add_argument
(
'--json'
,
type
=
str
,
dest
=
'json_output'
,
help
=
'Enable JSON
output to the file where the result should be written
. '
dest
=
'json_output'
,
metavar
=
'FILE'
,
help
=
'Enable JSON
result format and write it to FILE
. '
"Use '-' to redirect to the standard output."
)
self
.
configured
=
True
...
...
avocado/core/plugins/remote.py
浏览文件 @
d2a41697
...
...
@@ -37,7 +37,7 @@ class RunRemote(plugin.Plugin):
self
.
enabled
=
False
return
username
=
getpass
.
getuser
()
msg
=
'
run on a remote machine arguments
'
msg
=
'
test execution on a remote machine
'
self
.
remote_parser
=
parser
.
runner
.
add_argument_group
(
msg
)
self
.
remote_parser
.
add_argument
(
'--remote-hostname'
,
dest
=
'remote_hostname'
,
default
=
None
,
...
...
avocado/core/plugins/runner.py
浏览文件 @
d2a41697
...
...
@@ -82,7 +82,7 @@ class TestRunner(plugin.Plugin):
'(hardware details, profilers, etc.). '
'Current: %(default)s'
))
self
.
parser
.
output
=
self
.
parser
.
add_argument_group
(
'output
related arguments
'
)
self
.
parser
.
output
=
self
.
parser
.
add_argument_group
(
'output
and result format
'
)
self
.
parser
.
output
.
add_argument
(
'-s'
,
'--silent'
,
action
=
'store_true'
,
default
=
False
,
...
...
@@ -116,10 +116,11 @@ class TestRunner(plugin.Plugin):
'Current: on (output check enabled)'
))
if
multiplexer
.
MULTIPLEX_CAPABLE
:
mux
=
self
.
parser
.
add_argument_group
(
'multiplex arguments'
)
mux
.
add_argument
(
'-m'
,
'--multiplex-files'
,
nargs
=
'*'
,
default
=
None
,
help
=
'Path(s) to a avocado multiplex (.yaml) '
'file(s) (order dependent)'
)
mux
=
self
.
parser
.
add_argument_group
(
'multiplexer use on test execution'
)
mux
.
add_argument
(
'-m'
,
'--multiplex-files'
,
nargs
=
'*'
,
default
=
None
,
metavar
=
'FILE'
,
help
=
'Location of one or more Avocado multiplex (.yaml) '
'FILE(s) (order dependent)'
)
mux
.
add_argument
(
'--filter-only'
,
nargs
=
'*'
,
default
=
[],
help
=
'Filter only path(s) from multiplexing'
)
mux
.
add_argument
(
'--filter-out'
,
nargs
=
'*'
,
default
=
[],
...
...
avocado/core/plugins/vm.py
浏览文件 @
d2a41697
...
...
@@ -38,9 +38,8 @@ class RunVM(plugin.Plugin):
return
username
=
getpass
.
getuser
()
default_hypervisor_uri
=
'qemu:///system'
self
.
vm_parser
=
parser
.
runner
.
add_argument_group
(
'run on a libvirt '
'domain arguments'
)
msg
=
'test execution on a Virtual Machine'
self
.
vm_parser
=
parser
.
runner
.
add_argument_group
(
msg
)
self
.
vm_parser
.
add_argument
(
'--vm-domain'
,
dest
=
'vm_domain'
,
help
=
(
'Specify Libvirt Domain Name'
))
self
.
vm_parser
.
add_argument
(
'--vm-hypervisor-uri'
,
...
...
avocado/core/plugins/wrapper.py
浏览文件 @
d2a41697
...
...
@@ -33,16 +33,16 @@ class Wrapper(plugin.Plugin):
def
configure
(
self
,
parser
):
self
.
parser
=
parser
wrap_group
=
self
.
parser
.
runner
.
add_argument_group
(
'
Wrap avocado.utils.process module
'
)
'
wrapper support
'
)
wrap_group
.
add_argument
(
'--wrapper'
,
action
=
'append'
,
default
=
[],
metavar
=
'SCRIPT[:
PROCESS
]'
,
help
=
'Use a script to wrap
the execution of
'
'
process created by the test. The wrapper is
'
'
either a path to a script (aka global wrap
) or '
metavar
=
'SCRIPT[:
EXECUTABLE
]'
,
help
=
'Use a script to wrap
executables run by
'
'
a test. The wrapper is either a path to a
'
'
script (AKA a global wrapper
) or '
'a path to a script followed by colon symbol (:), '
'plus a shell like glob to the target
process
. '
'Multiple wrap
lines are allowed, but only one global
'
'
wrap
can be defined.'
)
'plus a shell like glob to the target
EXECUTABLE
. '
'Multiple wrap
per options are allowed, but
'
'
only one global wrapper
can be defined.'
)
self
.
configured
=
True
def
activate
(
self
,
app_args
):
...
...
avocado/core/plugins/xunit.py
浏览文件 @
d2a41697
...
...
@@ -228,8 +228,8 @@ class XUnit(plugin.Plugin):
def
configure
(
self
,
parser
):
self
.
parser
=
parser
self
.
parser
.
runner
.
output
.
add_argument
(
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
help
=
(
'Enable xUnit
output to the file where the result should be written
. '
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
metavar
=
'FILE'
,
help
=
(
'Enable xUnit
result format and write it to FILE
. '
"Use '-' to redirect to the standard output."
))
self
.
configured
=
True
...
...
docs/source/DebuggingWithGDB.rst
浏览文件 @
d2a41697
...
...
@@ -4,20 +4,20 @@ Debugging with GDB
Avocado has two different types of GDB support that complement each
other:
* Transparent execution of
binari
es inside the GNU Debugger. This
* Transparent execution of
executabl
es inside the GNU Debugger. This
takes standard and possibly unmodified tests that uses the
:mod:`avocado.utils.process` APIs for running processes. By using a
command line option, the
binary
is run on GDB. This allows the user
command line option, the
executable
is run on GDB. This allows the user
to interact with GDB, but to the test itself, things are pretty much
transparent.
* The :mod:`avocado.gdb` APIs that allows a test to interact with GDB,
including setting a
binary
to be run, setting breakpoints or any
including setting a
executable
to be run, setting breakpoints or any
other types of commands. This requires a test written with that
approach and API in mind.
Transparent Execution of
Binari
es
---------------------------------
Transparent Execution of
Executabl
es
---------------------------------
---
This feature adds a few command line options to the Avocado ``run``
command::
...
...
@@ -25,19 +25,19 @@ command::
$ avocado run --help
...
GNU Debugger support:
--gdb-run-bin BINARY_PATH
Set a breakpoint on a given binary to be run inside
the GNU debugger. Format should be
"<binary>[:breakpoint]". Breakpoint defaults to "main"
--gdb-prerun-commands BINARY_PATH:COMMANDS_PATH
After loading a binary in binary
in GDB, but before
actually running it, execute the given GDB commands in
the given file. BINARY_PATH is optional and
if omitted
will apply to all binari
es
--gdb-coredump {on,off}
Automatically generate a core dump when the inferior
process received a fatal signal such as SIGSEGV or
SIGABRT
--gdb-run-bin EXECUTABLE[:BREAKPOINT]
Run a given executable inside the GNU debugger,
pausing at a given breakpoint (defaults to "main")
--gdb-prerun-commands EXECUTABLE:COMMANDS
After loading an executable
in GDB, but before
actually running it, execute the GDB commands in the
given file. EXECUTABLE is optional,
if omitted
COMMANDS will apply to all executabl
es
--gdb-coredump {on,off}
Automatically generate a core dump when the inferior
process received a fatal signal such as SIGSEGV or
SIGABRT
...
To get started you want to use ``--gdb-run-bin``, as shown in the example bellow.
...
...
@@ -47,8 +47,8 @@ Example
The simplest way is to just run
``avocado run --gdb-run-bin=doublefree examples/tests/doublefree.py``, which
wraps each executed
binary
with name ``doublefree`` inside GDB server and
stops at the
binary
entry point.
wraps each executed
executable
with name ``doublefree`` inside GDB server and
stops at the
executable
entry point.
Optionally you can specify single breakpoint using
``--gdb-run-bin=doublefree:$breakpoint`` (eg: ``doublefree:1``) or just
...
...
@@ -171,7 +171,7 @@ Take a look at ``examples/tests/modify_variable.py`` test::
app.exit()
self.assertIn("MY VARIABLE 'A' IS: ff", out)
You can see that instead of running the
binary
using ``process.run`` we invoke
You can see that instead of running the
executable
using ``process.run`` we invoke
``gdb.GDB``. This allows us to automate the interaction with the GDB in means
of setting breakpoints, executing commands and querying for output.
...
...
docs/source/WrapProcess.rst
浏览文件 @
d2a41697
Wrap
process in
tests
=====================
Wrap
executables run by
tests
=====================
========
Avocado allows the instrumentation of
application
s being run by a test
Avocado allows the instrumentation of
executable
s being run by a test
in a transparent way. The user specifies a script ("the wrapper") to be
used to run the actual program called by the test.
If the instrumentation script is implemented correctly, it should not
interfere with the test behavior. That is, the wrapper should avoid
changing the return status, standard output and standard error messages
of the original
process
.
of the original
executable
.
The user can be specific about which program to wrap (with a shell-like glob),
or if that is omitted, a global wrapper that will apply to all
...
...
@@ -45,6 +45,6 @@ Caveats
present in two wrappers, you have to combine those into a single
wrapper script.
* Only
process
es that are run with the :mod:`avocado.utils.process` APIs
* Only
executabl
es that are run with the :mod:`avocado.utils.process` APIs
(and other API modules that make use of it, like mod:`avocado.utils.build`)
are affected by this feature.
man/avocado.rst
浏览文件 @
d2a41697
...
...
@@ -356,11 +356,11 @@ variants. If no matches are found, then it would proceed to ``/qa/*``
Keep in mind that only slices defined in mux-path are taken into account for
relative paths (the ones starting with ``*``).
DEBUGGING
BINARI
ES RUN AS PART OF A TEST
========================================
DEBUGGING
EXECUTABL
ES RUN AS PART OF A TEST
========================================
===
One interesting avocado feature is the ability to automatically and
transparently run
binari
es that are used on a given test inside the
transparently run
executabl
es that are used on a given test inside the
GNU debugger.
Suppose you are running a test that uses an external, compiled, image
...
...
@@ -378,7 +378,7 @@ The job starts running just as usual, and so does your test::
TESTS : 1
(1/1) converttest.py: /
The `convert`
binary
though, automatically runs inside GDB. Avocado will
The `convert`
executable
though, automatically runs inside GDB. Avocado will
stop when the given breakpoint is reached::
TEST PAUSED because of debugger breakpoint. To DEBUG your application run:
...
...
@@ -390,7 +390,7 @@ From this point, you can run the generated script (`convert.gdb.sh`) to
debug you application.
As noted, it is strongly recommended that you *disconnect* from gdb while
your
binary is still running. That is, if the binary
finished running
your
executable is still running. That is, if the executable
finished running
while you are debugging it, avocado has no way to know about its status.
Avocado will automatically send a `continue` command to the debugger
...
...
@@ -421,25 +421,25 @@ In this example, `/tmp/disable-signals` is a simple text file containing two lin
Each line is a GDB command, so you can have from simple to very complex
debugging environments configured like that.
WRAP
PROCESS IN
TESTS
=====================
WRAP
EXECUTABLE RUN BY
TESTS
=====================
=======
Avocado allows the instrumentation of
applications being
run by a test in a transparent way. The user specifies a script
("the wrapper") to be
used to run the actual program called by the test.
Avocado allows the instrumentation of
executables being run by a test
in a transparent way. The user specifies a script ("the wrapper") to be
used to run the actual program called by the test.
If the instrument
is implemented correctly, it should not interfere
with the test behavior. So that, a perfect wrapper shall not
chang
e
the return status, standard output and standard error messages
of the
process being executed
.
If the instrument
ation script is implemented correctly, it should not
interfere with the test behavior. That is, the wrapper should avoid
chang
ing
the return status, standard output and standard error messages
of the
original executable
.
By using an optional parameter to the wrapper, you can specify a pattern
in format of shell glob to select the "target binary" to wrap.
The user can be specific about which program to wrap (with a shell-like glob),
or if that is omitted, a global wrapper that will apply to all
programs called by the test.
In this case, for every program spawned by the test,
the program name will be compared to the pattern to decide
whether to wrap it or not. You can have multiples wrappers and patterns
defined.
So, for every executable run by the test, the program name will be
compared to the pattern to decide whether to wrap it or not. You can
have multiples wrappers and patterns defined.
Examples::
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录