Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
b6e8562d
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,发现更多精彩内容 >>
提交
b6e8562d
编写于
4月 02, 2014
作者:
L
Lucas Meneghel Rodrigues
提交者:
Lucas Meneghel Rodrigues
4月 02, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10 from lmr/fix-setup-errors
Fix setup errors
上级
dea8984c
22737e27
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
37 deletion
+42
-37
avocado/core/exceptions.py
avocado/core/exceptions.py
+8
-0
avocado/job.py
avocado/job.py
+33
-8
avocado/result.py
avocado/result.py
+1
-0
avocado/test.py
avocado/test.py
+0
-29
未找到文件。
avocado/core/exceptions.py
浏览文件 @
b6e8562d
...
...
@@ -11,6 +11,14 @@ class TestBaseException(Exception):
status
=
"NEVER_RAISE_THIS"
class
TestSetupFail
(
TestBaseException
):
"""
Indicates an error during a setup procedure.
"""
status
=
"FAIL"
class
TestError
(
TestBaseException
):
"""
...
...
avocado/job.py
浏览文件 @
b6e8562d
...
...
@@ -4,10 +4,13 @@ Class that describes a sequence of automated operations.
import
imp
import
logging
import
os
import
sys
import
time
import
traceback
from
avocado.core
import
data_dir
from
avocado.core
import
output
from
avocado.core
import
exceptions
from
avocado
import
test
from
avocado
import
sysinfo
from
avocado
import
result
...
...
@@ -84,14 +87,36 @@ class Job(object):
:params test_instance: avocado.test.Test derived class instance.
"""
sysinfo_logger
=
sysinfo
.
SysInfo
(
basedir
=
test_instance
.
sysinfodir
)
test_instance
.
start_logging
()
test_instance
.
setup
()
sysinfo_logger
.
start_job_hook
()
test_instance
.
run
()
test_instance
.
cleanup
()
test_instance
.
report
()
test_instance
.
stop_logging
()
start_time
=
time
.
time
()
try
:
sysinfo_logger
=
sysinfo
.
SysInfo
(
basedir
=
test_instance
.
sysinfodir
)
test_instance
.
start_logging
()
sysinfo_logger
.
start_job_hook
()
try
:
test_instance
.
setup
()
except
Exception
,
details
:
raise
exceptions
.
TestSetupFail
(
details
)
test_instance
.
action
()
test_instance
.
cleanup
()
test_instance
.
status
=
'PASS'
except
exceptions
.
TestBaseException
,
detail
:
test_instance
.
status
=
detail
.
status
test_instance
.
fail_reason
=
detail
except
Exception
,
detail
:
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
tb_info
=
traceback
.
format_exception
(
exc_type
,
exc_value
,
exc_traceback
.
tb_next
)
tb_info
=
""
.
join
(
tb_info
)
for
e_line
in
tb_info
.
splitlines
():
test_instance
.
log
.
error
(
e_line
)
test_instance
.
status
=
'FAIL'
test_instance
.
fail_reason
=
detail
finally
:
end_time
=
time
.
time
()
test_instance
.
time_elapsed
=
end_time
-
start_time
test_instance
.
report
()
test_instance
.
stop_logging
()
return
test_instance
def
run_test
(
self
,
url
):
...
...
avocado/result.py
浏览文件 @
b6e8562d
...
...
@@ -70,6 +70,7 @@ class TestResult(object):
'Called once for a test to check status and report.'
self
.
start_test
(
test
)
status_map
=
{
'PASS'
:
self
.
add_pass
,
'ERROR'
:
self
.
add_fail
,
'FAIL'
:
self
.
add_fail
,
'TEST_NA'
:
self
.
add_skip
,
'WARN'
:
self
.
add_warn
}
...
...
avocado/test.py
浏览文件 @
b6e8562d
...
...
@@ -120,35 +120,6 @@ class Test(object):
raise
NotImplementedError
(
'Test subclasses must implement an action '
'method'
)
def
run
(
self
):
"""
Main test execution entry point.
It'll run the action payload, taking into consideration profiling
requirements. After the test is done, it reports time and status.
"""
start_time
=
time
.
time
()
try
:
self
.
action
()
self
.
status
=
'PASS'
except
exceptions
.
TestBaseException
,
detail
:
self
.
status
=
detail
.
status
self
.
fail_reason
=
detail
except
Exception
,
detail
:
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
tb_info
=
traceback
.
format_exception
(
exc_type
,
exc_value
,
exc_traceback
.
tb_next
)
tb_info
=
""
.
join
(
tb_info
)
for
e_line
in
tb_info
.
splitlines
():
self
.
log
.
error
(
e_line
)
self
.
status
=
'FAIL'
self
.
fail_reason
=
detail
finally
:
end_time
=
time
.
time
()
self
.
time_elapsed
=
end_time
-
start_time
return
self
.
status
==
'PASS'
def
cleanup
(
self
):
"""
Cleanup stage after the action is done.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录