Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
7bbe6c06
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,发现更多精彩内容 >>
提交
7bbe6c06
编写于
12月 04, 2014
作者:
R
Rudá Moura
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #291 from lmr/plugin-tweaks
Plugin tweaks
上级
f63ba038
cdd94dc4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
134 addition
and
94 deletion
+134
-94
avocado/plugins/datadir.py
avocado/plugins/datadir.py
+8
-5
avocado/plugins/htmlresult.py
avocado/plugins/htmlresult.py
+0
-1
avocado/plugins/plugin.py
avocado/plugins/plugin.py
+1
-0
avocado/plugins/plugins_list.py
avocado/plugins/plugins_list.py
+1
-1
avocado/plugins/runner.py
avocado/plugins/runner.py
+6
-85
avocado/plugins/sysinfo.py
avocado/plugins/sysinfo.py
+46
-0
avocado/plugins/test_lister.py
avocado/plugins/test_lister.py
+71
-0
selftests/all/functional/avocado/basic_tests.py
selftests/all/functional/avocado/basic_tests.py
+1
-2
未找到文件。
avocado/plugins/datadir.py
浏览文件 @
7bbe6c06
...
...
@@ -15,6 +15,7 @@
from
avocado.plugins
import
plugin
from
avocado.core
import
output
from
avocado.core
import
data_dir
from
avocado.settings
import
settings
class
DataDirList
(
plugin
.
Plugin
):
...
...
@@ -34,9 +35,11 @@ class DataDirList(plugin.Plugin):
def
run
(
self
,
args
):
view
=
output
.
View
()
view
.
notify
(
event
=
"message"
,
msg
=
'Config file path: %s'
%
settings
.
config_path
)
view
.
notify
(
event
=
"message"
,
msg
=
''
)
view
.
notify
(
event
=
"message"
,
msg
=
'Avocado Data Directories:'
)
view
.
notify
(
event
=
"m
essage"
,
msg
=
' base dir
'
+
data_dir
.
get_base_dir
())
view
.
notify
(
event
=
"m
essage"
,
msg
=
' tests dir
'
+
data_dir
.
get_test_dir
())
view
.
notify
(
event
=
"m
essage"
,
msg
=
' data dir
'
+
data_dir
.
get_data_dir
())
view
.
notify
(
event
=
"m
essage"
,
msg
=
' logs dir
'
+
data_dir
.
get_logs_dir
())
view
.
notify
(
event
=
"m
essage"
,
msg
=
' tmp dir
'
+
data_dir
.
get_tmp_dir
())
view
.
notify
(
event
=
"m
inor"
,
msg
=
' base dir
'
+
data_dir
.
get_base_dir
())
view
.
notify
(
event
=
"m
inor"
,
msg
=
' tests dir
'
+
data_dir
.
get_test_dir
())
view
.
notify
(
event
=
"m
inor"
,
msg
=
' data dir
'
+
data_dir
.
get_data_dir
())
view
.
notify
(
event
=
"m
inor"
,
msg
=
' logs dir
'
+
data_dir
.
get_logs_dir
())
view
.
notify
(
event
=
"m
inor"
,
msg
=
' tmp dir
'
+
data_dir
.
get_tmp_dir
())
avocado/plugins/htmlresult.py
浏览文件 @
7bbe6c06
...
...
@@ -241,7 +241,6 @@ class HTML(plugin.Plugin):
name
=
'htmlresult'
enabled
=
True
parser
=
None
def
configure
(
self
,
parser
):
self
.
parser
=
parser
...
...
avocado/plugins/plugin.py
浏览文件 @
7bbe6c06
...
...
@@ -29,6 +29,7 @@ class Plugin(object):
name
=
'noname'
enabled
=
False
priority
=
3
parser
=
None
def
__init__
(
self
,
name
=
None
,
enabled
=
None
):
"""Creates a new plugin instance.
...
...
avocado/plugins/
lister
.py
→
avocado/plugins/
plugins_list
.py
浏览文件 @
7bbe6c06
...
...
@@ -42,7 +42,7 @@ class PluginsList(plugin.Plugin):
if
clength
>
blength
:
blength
=
clength
format_str
=
" %-"
+
str
(
blength
)
+
"s
-
%s %s"
format_str
=
" %-"
+
str
(
blength
)
+
"s %s %s"
for
plug
in
sorted
(
pm
.
plugins
):
if
plug
.
enabled
:
status
=
"(Enabled)"
...
...
avocado/plugins/runner.py
浏览文件 @
7bbe6c06
...
...
@@ -16,65 +16,14 @@
Base Test Runner Plugins.
"""
import
os
import
sys
from
avocado.core
import
error_codes
from
avocado.plugins
import
plugin
from
avocado.core
import
data_dir
from
avocado.core
import
output
from
avocado.utils
import
path
from
avocado
import
sysinfo
from
avocado
import
job
class
TestLister
(
plugin
.
Plugin
):
"""
Implements the avocado 'list' subcommand
"""
name
=
'test_lister'
enabled
=
True
def
configure
(
self
,
parser
):
"""
Add the subparser for the list action.
:param parser: Main test runner parser.
"""
self
.
parser
=
parser
.
subcommands
.
add_parser
(
'list'
,
help
=
'List available test modules'
)
super
(
TestLister
,
self
).
configure
(
self
.
parser
)
def
run
(
self
,
args
):
"""
List available test modules.
:param args: Command line args received from the list subparser.
"""
view
=
output
.
View
(
app_args
=
args
,
use_paginator
=
True
)
base_test_dir
=
data_dir
.
get_test_dir
()
test_files
=
os
.
listdir
(
base_test_dir
)
test_dirs
=
[]
blength
=
0
for
t
in
test_files
:
inspector
=
path
.
PathInspector
(
path
=
t
)
if
inspector
.
is_python
():
clength
=
len
((
t
.
split
(
'.'
)[
0
]))
if
clength
>
blength
:
blength
=
clength
test_dirs
.
append
((
t
.
split
(
'.'
)[
0
],
os
.
path
.
join
(
base_test_dir
,
t
)))
format_string
=
" %-"
+
str
(
blength
)
+
"s %s"
view
.
notify
(
event
=
'message'
,
msg
=
'Tests dir: %s'
%
base_test_dir
)
if
len
(
test_dirs
)
>
0
:
view
.
notify
(
event
=
'message'
,
msg
=
format_string
%
(
'Alias'
,
'Path'
))
for
test_dir
in
test_dirs
:
view
.
notify
(
event
=
'minor'
,
msg
=
format_string
%
test_dir
)
else
:
view
.
notify
(
event
=
'error'
,
msg
=
'No tests were found on current tests dir'
)
class
TestRunner
(
plugin
.
Plugin
):
"""
...
...
@@ -165,16 +114,15 @@ class TestRunner(plugin.Plugin):
:param args: Command line args received from the run subparser.
"""
view
=
output
.
View
(
app_args
=
args
,
use_paginator
=
True
)
if
args
.
unique_job_id
is
not
None
:
try
:
int
(
args
.
unique_job_id
,
16
)
if
len
(
args
.
unique_job_id
)
!=
40
:
raise
Exception
except
:
print
>>
sys
.
stderr
,
\
'Error: Unique Job ID needs to be a 40 digit hex number'
return
-
1
raise
ValueError
except
ValueError
:
view
.
notify
(
event
=
'error'
,
msg
=
'Unique Job ID needs to be a 40 digit hex number'
)
return
sys
.
exit
(
error_codes
.
numeric_status
[
'AVOCADO_CRASH'
])
job_instance
=
job
.
Job
(
args
)
rc
=
job_instance
.
run
()
...
...
@@ -182,30 +130,3 @@ class TestRunner(plugin.Plugin):
self
.
parser
.
print_help
()
return
rc
class
SystemInformation
(
plugin
.
Plugin
):
"""
Collect system information
"""
name
=
'sysinfo'
enabled
=
True
def
configure
(
self
,
parser
):
"""
Add the subparser for the run action.
:param parser: Main test runner parser.
"""
self
.
parser
=
parser
.
subcommands
.
add_parser
(
'sysinfo'
,
help
=
'Collect system information'
)
self
.
parser
.
add_argument
(
'sysinfodir'
,
type
=
str
,
help
=
'Dir where to dump sysinfo'
,
nargs
=
'?'
,
default
=
''
)
super
(
SystemInformation
,
self
).
configure
(
self
.
parser
)
def
run
(
self
,
args
):
sysinfo
.
collect_sysinfo
(
args
)
avocado/plugins/sysinfo.py
0 → 100644
浏览文件 @
7bbe6c06
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Red Hat Inc. 2013-2014
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
"""
System information plugin
"""
from
avocado.plugins
import
plugin
from
avocado
import
sysinfo
class
SystemInformation
(
plugin
.
Plugin
):
"""
Collect system information
"""
name
=
'sysinfo'
enabled
=
True
def
configure
(
self
,
parser
):
"""
Add the subparser for the run action.
:param parser: Main test runner parser.
"""
self
.
parser
=
parser
.
subcommands
.
add_parser
(
'sysinfo'
,
help
=
'Collect system information'
)
self
.
parser
.
add_argument
(
'sysinfodir'
,
type
=
str
,
help
=
'Dir where to dump sysinfo'
,
nargs
=
'?'
,
default
=
''
)
super
(
SystemInformation
,
self
).
configure
(
self
.
parser
)
def
run
(
self
,
args
):
sysinfo
.
collect_sysinfo
(
args
)
avocado/plugins/test_lister.py
0 → 100644
浏览文件 @
7bbe6c06
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Red Hat Inc. 2013-2014
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
import
os
from
avocado.core
import
data_dir
from
avocado.core
import
output
from
avocado.settings
import
settings
from
avocado.utils
import
path
from
avocado.plugins
import
plugin
class
TestLister
(
plugin
.
Plugin
):
"""
Implements the avocado 'list' subcommand
"""
name
=
'test_lister'
enabled
=
True
def
configure
(
self
,
parser
):
"""
Add the subparser for the list action.
:param parser: Main test runner parser.
"""
self
.
parser
=
parser
.
subcommands
.
add_parser
(
'list'
,
help
=
'List available test modules'
)
super
(
TestLister
,
self
).
configure
(
self
.
parser
)
def
run
(
self
,
args
):
"""
List available test modules.
:param args: Command line args received from the list subparser.
"""
view
=
output
.
View
(
app_args
=
args
,
use_paginator
=
True
)
base_test_dir
=
data_dir
.
get_test_dir
()
test_files
=
os
.
listdir
(
base_test_dir
)
test_dirs
=
[]
blength
=
0
for
t
in
test_files
:
inspector
=
path
.
PathInspector
(
path
=
t
)
if
inspector
.
is_python
():
clength
=
len
((
t
.
split
(
'.'
)[
0
]))
if
clength
>
blength
:
blength
=
clength
test_dirs
.
append
((
t
.
split
(
'.'
)[
0
],
os
.
path
.
join
(
base_test_dir
,
t
)))
format_string
=
" %-"
+
str
(
blength
)
+
"s %s"
view
.
notify
(
event
=
"message"
,
msg
=
'Config file path: %s'
%
settings
.
config_path
)
view
.
notify
(
event
=
"minor"
,
msg
=
''
)
view
.
notify
(
event
=
"message"
,
msg
=
'Tests dir: %s'
%
base_test_dir
)
if
len
(
test_dirs
)
>
0
:
view
.
notify
(
event
=
"minor"
,
msg
=
format_string
%
(
'Alias'
,
'Path'
))
for
test_dir
in
test_dirs
:
view
.
notify
(
event
=
"minor"
,
msg
=
format_string
%
test_dir
)
else
:
view
.
notify
(
event
=
"error"
,
msg
=
'No tests were found on current tests dir'
)
selftests/all/functional/avocado/basic_tests.py
浏览文件 @
7bbe6c06
...
...
@@ -180,8 +180,7 @@ class RunnerOperationTest(unittest.TestCase):
cmd_line
=
'./scripts/avocado run --force-job-id foobar skiptest'
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertNotEqual
(
0
,
result
.
exit_status
)
self
.
assertIn
(
'Error'
,
result
.
stderr
)
self
.
assertIn
(
'needs to be a 40 digit hex'
,
result
.
stderr
)
self
.
assertIn
(
'needs to be a 40 digit hex'
,
result
.
stdout
)
def
test_valid_unique_id
(
self
):
cmd_line
=
'./scripts/avocado run --force-job-id 975de258ac05ce5e490648dec4753657b7ccc7d1 skiptest'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录