Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
c493d216
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c493d216
编写于
4月 08, 2016
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: Enable failure testing with CompareDomXML2XML
This allows tests to check for specific failure scenarios
上级
d0cc8b10
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
57 addition
and
20 deletion
+57
-20
tests/bhyvexml2xmltest.c
tests/bhyvexml2xmltest.c
+2
-2
tests/genericxml2xmltest.c
tests/genericxml2xmltest.c
+2
-2
tests/lxcxml2xmltest.c
tests/lxcxml2xmltest.c
+2
-1
tests/qemuxml2xmltest.c
tests/qemuxml2xmltest.c
+4
-2
tests/testutils.c
tests/testutils.c
+36
-12
tests/testutils.h
tests/testutils.h
+11
-1
未找到文件。
tests/bhyvexml2xmltest.c
浏览文件 @
c493d216
...
...
@@ -32,8 +32,8 @@ testCompareXMLToXMLHelper(const void *data)
ret
=
testCompareDomXML2XMLFiles
(
driver
.
caps
,
driver
.
xmlopt
,
xml_in
,
info
->
different
?
xml_out
:
xml_in
,
false
,
NULL
,
NULL
,
0
);
false
,
NULL
,
NULL
,
0
,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
);
cleanup:
VIR_FREE
(
xml_in
);
...
...
tests/genericxml2xmltest.c
浏览文件 @
c493d216
...
...
@@ -39,8 +39,8 @@ testCompareXMLToXMLHelper(const void *data)
ret
=
testCompareDomXML2XMLFiles
(
caps
,
xmlopt
,
xml_in
,
info
->
different
?
xml_out
:
xml_in
,
!
info
->
inactive_only
,
NULL
,
NULL
,
0
);
!
info
->
inactive_only
,
NULL
,
NULL
,
0
,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
);
cleanup:
VIR_FREE
(
xml_in
);
VIR_FREE
(
xml_out
);
...
...
tests/lxcxml2xmltest.c
浏览文件 @
c493d216
...
...
@@ -46,7 +46,8 @@ testCompareXMLToXMLHelper(const void *data)
ret
=
testCompareDomXML2XMLFiles
(
caps
,
xmlopt
,
xml_in
,
info
->
different
?
xml_out
:
xml_in
,
!
info
->
inactive_only
,
NULL
,
NULL
,
info
->
parse_flags
);
NULL
,
NULL
,
info
->
parse_flags
,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
);
cleanup:
VIR_FREE
(
xml_in
);
VIR_FREE
(
xml_out
);
...
...
tests/qemuxml2xmltest.c
浏览文件 @
c493d216
...
...
@@ -54,7 +54,8 @@ testXML2XMLActive(const void *opaque)
return
testCompareDomXML2XMLFiles
(
driver
.
caps
,
driver
.
xmlopt
,
info
->
inName
,
info
->
outActiveName
,
true
,
qemuXML2XMLPreFormatCallback
,
opaque
,
0
);
qemuXML2XMLPreFormatCallback
,
opaque
,
0
,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
);
}
...
...
@@ -65,7 +66,8 @@ testXML2XMLInactive(const void *opaque)
return
testCompareDomXML2XMLFiles
(
driver
.
caps
,
driver
.
xmlopt
,
info
->
inName
,
info
->
outInactiveName
,
false
,
qemuXML2XMLPreFormatCallback
,
opaque
,
0
);
qemuXML2XMLPreFormatCallback
,
opaque
,
0
,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
);
}
...
...
tests/testutils.c
浏览文件 @
c493d216
...
...
@@ -1079,10 +1079,12 @@ int
testCompareDomXML2XMLFiles
(
virCapsPtr
caps
,
virDomainXMLOptionPtr
xmlopt
,
const
char
*
infile
,
const
char
*
outfile
,
bool
live
,
testCompareDomXML2XMLPreFormatCallback
cb
,
const
void
*
opaque
,
unsigned
int
parseFlags
)
const
void
*
opaque
,
unsigned
int
parseFlags
,
testCompareDomXML2XMLResult
expectResult
)
{
char
*
actual
=
NULL
;
int
ret
=
-
1
;
testCompareDomXML2XMLResult
result
;
virDomainDefPtr
def
=
NULL
;
unsigned
int
parse_flags
=
live
?
0
:
VIR_DOMAIN_DEF_PARSE_INACTIVE
;
unsigned
int
format_flags
=
VIR_DOMAIN_DEF_FORMAT_SECURE
;
...
...
@@ -1092,25 +1094,47 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
if
(
!
live
)
format_flags
|=
VIR_DOMAIN_DEF_FORMAT_INACTIVE
;
if
(
!
(
def
=
virDomainDefParseFile
(
infile
,
caps
,
xmlopt
,
parse_flags
)))
goto
fail
;
if
(
!
(
def
=
virDomainDefParseFile
(
infile
,
caps
,
xmlopt
,
parse_flags
)))
{
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
;
goto
out
;
}
if
(
!
virDomainDefCheckABIStability
(
def
,
def
))
{
VIR_TEST_DEBUG
(
"ABI stability check failed on %s"
,
infile
);
goto
fail
;
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_STABILITY
;
goto
out
;
}
if
(
cb
&&
cb
(
def
,
opaque
)
<
0
)
goto
fail
;
if
(
cb
&&
cb
(
def
,
opaque
)
<
0
)
{
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_CB
;
goto
out
;
}
if
(
!
(
actual
=
virDomainDefFormat
(
def
,
caps
,
format_flags
)))
goto
fail
;
if
(
!
(
actual
=
virDomainDefFormat
(
def
,
caps
,
format_flags
)))
{
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_FORMAT
;
goto
out
;
}
if
(
virtTestCompareToFile
(
actual
,
outfile
)
<
0
)
{
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_COMPARE
;
goto
out
;
}
if
(
virtTestCompareToFile
(
actual
,
outfile
)
<
0
)
goto
fail
;
result
=
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
;
out:
if
(
result
==
expectResult
)
{
ret
=
0
;
fail:
if
(
expectResult
!=
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
)
{
VIR_TEST_DEBUG
(
"Got expected failure code=%d msg=%s"
,
result
,
virGetLastErrorMessage
());
}
}
else
{
ret
=
-
1
;
VIR_TEST_DEBUG
(
"Expected result code=%d but received code=%d"
,
expectResult
,
result
);
}
VIR_FREE
(
actual
);
virDomainDefFree
(
def
);
return
ret
;
...
...
tests/testutils.h
浏览文件 @
c493d216
...
...
@@ -134,6 +134,15 @@ int virtTestMain(int argc,
virCapsPtr
virTestGenericCapsInit
(
void
);
virDomainXMLOptionPtr
virTestGenericDomainXMLConfInit
(
void
);
typedef
enum
{
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS
,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_STABILITY
,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_CB
,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_FORMAT
,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_COMPARE
,
}
testCompareDomXML2XMLResult
;
typedef
int
(
*
testCompareDomXML2XMLPreFormatCallback
)(
virDomainDefPtr
def
,
const
void
*
opaque
);
int
testCompareDomXML2XMLFiles
(
virCapsPtr
caps
,
...
...
@@ -143,6 +152,7 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
bool
live
,
testCompareDomXML2XMLPreFormatCallback
cb
,
const
void
*
opaque
,
unsigned
int
parseFlags
);
unsigned
int
parseFlags
,
testCompareDomXML2XMLResult
expectResult
);
#endif
/* __VIR_TEST_UTILS_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录