Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
a03e97d7
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看板
未验证
提交
a03e97d7
编写于
8月 03, 2016
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'apahim/replay_failfast_v2'
上级
b8e27b59
f2595633
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
85 addition
and
10 deletion
+85
-10
avocado/core/runner.py
avocado/core/runner.py
+1
-1
avocado/plugins/replay.py
avocado/plugins/replay.py
+3
-2
avocado/plugins/run.py
avocado/plugins/run.py
+3
-2
docs/source/GetStartedGuide.rst
docs/source/GetStartedGuide.rst
+7
-3
docs/source/Replay.rst
docs/source/Replay.rst
+3
-0
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+2
-1
selftests/functional/test_replay_external_runner.py
selftests/functional/test_replay_external_runner.py
+1
-1
selftests/functional/test_replay_failfast.py
selftests/functional/test_replay_failfast.py
+65
-0
未找到文件。
avocado/core/runner.py
浏览文件 @
a03e97d7
...
...
@@ -445,7 +445,7 @@ class TestRunner(object):
elif
not
mapping
[
test_state
[
'status'
]]:
summary
.
add
(
"FAIL"
)
if
getattr
(
self
.
job
.
args
,
'failfast'
,
False
)
:
if
getattr
(
self
.
job
.
args
,
'failfast'
,
'off'
)
==
'on'
:
summary
.
add
(
"INTERRUPTED"
)
self
.
job
.
log
.
debug
(
"Interrupting job (failfast)."
)
return
False
...
...
avocado/plugins/replay.py
浏览文件 @
a03e97d7
...
...
@@ -136,14 +136,15 @@ class Replay(CLI):
whitelist
=
[
'loaders'
,
'external_runner'
,
'external_runner_testdir'
,
'external_runner_chdir'
]
'external_runner_chdir'
,
'failfast'
]
if
replay_args
is
None
:
log
.
warn
(
'Source job args data not found. These options will not '
'be loaded in this replay job: %s'
,
', '
.
join
(
whitelist
))
else
:
for
option
in
whitelist
:
optvalue
=
getattr
(
args
,
option
,
None
)
if
optvalue
:
if
optvalue
is
not
None
:
log
.
warn
(
"Overriding the replay %s with the --%s value "
"given on the command line."
,
option
.
replace
(
'_'
,
'-'
),
...
...
avocado/plugins/run.py
浏览文件 @
a03e97d7
...
...
@@ -77,8 +77,9 @@ class Run(CLICmd):
'You can also use suffixes, like: '
' s (seconds), m (minutes), h (hours). '
))
parser
.
add_argument
(
'--failfast'
,
action
=
'store_true'
,
help
=
'Interrupt job on first failed test.'
)
parser
.
add_argument
(
'--failfast'
,
choices
=
(
'on'
,
'off'
),
help
=
'Enable or disable the job interruption on '
'first failed test.'
)
sysinfo_default
=
settings
.
get_value
(
'sysinfo.collect'
,
'enabled'
,
...
...
docs/source/GetStartedGuide.rst
浏览文件 @
a03e97d7
...
...
@@ -219,10 +219,10 @@ instrumented and simple tests::
Interrupting The Job On First Failed Test (failfast)
====================================================
The Avocado ``run`` command has the option ``--failfast
`` to exit the job on
first failed test::
The Avocado ``run`` command has the option ``--failfast
on`` to exit the job
on
first failed test::
$ avocado run --failfast /bin/true /bin/false /bin/true /bin/true
$ avocado run --failfast
on
/bin/true /bin/false /bin/true /bin/true
JOB ID : eaf51b8c7d6be966bdf5562c9611b1ec2db3f68a
JOB LOG : $HOME/avocado/job-results/job-2016-07-19T09.43-eaf51b8/job.log
TESTS : 4
...
...
@@ -233,6 +233,10 @@ first failed test::
JOB HTML : /home/apahim/avocado/job-results/job-2016-07-19T09.43-eaf51b8/html/results.html
TESTS TIME : 0.02 s
The ``--failfast`` option accepts the argument ``off``. Since it's disabled
by default, the ``off`` argument only makes sense in replay jobs, when the
original job was executed with ``--failfast on``.
.. _running-external-runner:
Running Tests With An External Runner
...
...
docs/source/Replay.rst
浏览文件 @
a03e97d7
...
...
@@ -171,6 +171,9 @@ result, using the option ``--replay-test-status``. See the example below::
JOB HTML : $HOME/avocado/job-results/job-2016-01-12T00.38-2e1dc41/html/results.html
TESTS TIME : 0.19 s
When replaying jobs that were executed with the ``--failfast on`` option, you
can disable the ``failfast`` option using ``--failfast off`` in the replay job.
To be able to replay a job, avocado records the job data in the same
job results directory, inside a subdirectory named ``replay``. If a
given job has a non-default path to record the logs, when the replay
...
...
selftests/functional/test_basic.py
浏览文件 @
a03e97d7
...
...
@@ -151,7 +151,8 @@ class RunnerOperationTest(unittest.TestCase):
def
test_runner_failfast
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
(
'./scripts/avocado run --sysinfo=off --job-results-dir %s '
'passtest.py failtest.py passtest.py --failfast'
%
self
.
tmpdir
)
'passtest.py failtest.py passtest.py --failfast on'
%
self
.
tmpdir
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertIn
(
'Interrupting job (failfast).'
,
result
.
stdout
)
self
.
assertIn
(
'PASS 1 | ERROR 0 | FAIL 1 | SKIP 1'
,
result
.
stdout
)
...
...
selftests/functional/test_replay_external_runner.py
浏览文件 @
a03e97d7
...
...
@@ -20,7 +20,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
basedir
=
os
.
path
.
abspath
(
basedir
)
class
ReplayTests
(
unittest
.
TestCase
):
class
Replay
ExtRunner
Tests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
...
...
selftests/functional/test_replay_failfast.py
0 → 100644
浏览文件 @
a03e97d7
#!/usr/bin/env python
import
glob
import
os
import
sys
import
tempfile
import
shutil
if
sys
.
version_info
[:
2
]
==
(
2
,
6
):
import
unittest2
as
unittest
else
:
import
unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
class
ReplayFailfastTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
cmd_line
=
(
'./scripts/avocado run passtest.py failtest.py passtest.py '
'--failfast on --job-results-dir %s --sysinfo=off --json -'
%
self
.
tmpdir
)
expected_rc
=
exit_codes
.
AVOCADO_TESTS_FAIL
|
exit_codes
.
AVOCADO_JOB_INTERRUPTED
self
.
run_and_check
(
cmd_line
,
expected_rc
)
self
.
jobdir
=
''
.
join
(
glob
.
glob
(
os
.
path
.
join
(
self
.
tmpdir
,
'job-*'
)))
idfile
=
''
.
join
(
os
.
path
.
join
(
self
.
jobdir
,
'id'
))
with
open
(
idfile
,
'r'
)
as
f
:
self
.
jobid
=
f
.
read
().
strip
(
'
\n
'
)
def
run_and_check
(
self
,
cmd_line
,
expected_rc
):
os
.
chdir
(
basedir
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
"%d:
\n
%s"
%
(
cmd_line
,
expected_rc
,
result
))
return
result
def
test_run_replay_failfast
(
self
):
cmd_line
=
(
'./scripts/avocado run --replay %s '
'--job-results-dir %s --replay-data-dir %s --sysinfo=off'
%
(
self
.
jobid
,
self
.
tmpdir
,
self
.
jobdir
))
expected_rc
=
exit_codes
.
AVOCADO_TESTS_FAIL
|
exit_codes
.
AVOCADO_JOB_INTERRUPTED
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
)
def
test_run_replay_disable_failfast
(
self
):
cmd_line
=
(
'./scripts/avocado run --replay %s --failfast off '
'--job-results-dir %s --replay-data-dir %s --sysinfo=off'
%
(
self
.
jobid
,
self
.
tmpdir
,
self
.
jobdir
))
expected_rc
=
exit_codes
.
AVOCADO_TESTS_FAIL
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
)
msg
=
'Overriding the replay failfast with the --failfast value given on the command line.'
self
.
assertIn
(
msg
,
result
.
stderr
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
tmpdir
)
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录