Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
a618b064
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看板
提交
a618b064
编写于
9月 13, 2018
作者:
S
Shi Lei
提交者:
Michal Privoznik
9月 17, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: fix incorrect indentation in function body by checking first line
Signed-off-by:
N
Shi Lei
<
shi_lei@massclouds.com
>
上级
ab9a1459
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
114 addition
and
114 deletion
+114
-114
tests/qemuxml2argvmock.c
tests/qemuxml2argvmock.c
+1
-1
tests/sexpr2xmltest.c
tests/sexpr2xmltest.c
+22
-22
tests/virnettlshelpers.c
tests/virnettlshelpers.c
+9
-9
tests/virshtest.c
tests/virshtest.c
+64
-64
tests/xml2sexprtest.c
tests/xml2sexprtest.c
+18
-18
未找到文件。
tests/qemuxml2argvmock.c
浏览文件 @
a618b064
...
...
@@ -66,7 +66,7 @@ virNumaIsAvailable(void)
int
virNumaGetMaxNode
(
void
)
{
return
7
;
return
7
;
}
/* We shouldn't need to mock virNumaNodeIsAvailable() and *definitely* not
...
...
tests/sexpr2xmltest.c
浏览文件 @
a618b064
...
...
@@ -21,37 +21,37 @@ static virDomainXMLOptionPtr xmlopt;
static
int
testCompareFiles
(
const
char
*
xml
,
const
char
*
sexpr
)
{
char
*
sexprData
=
NULL
;
char
*
gotxml
=
NULL
;
int
ret
=
-
1
;
virDomainDefPtr
def
=
NULL
;
char
*
sexprData
=
NULL
;
char
*
gotxml
=
NULL
;
int
ret
=
-
1
;
virDomainDefPtr
def
=
NULL
;
if
(
virTestLoadFile
(
sexpr
,
&
sexprData
)
<
0
)
goto
fail
;
if
(
virTestLoadFile
(
sexpr
,
&
sexprData
)
<
0
)
goto
fail
;
if
(
!
(
def
=
xenParseSxprString
(
sexprData
,
NULL
,
-
1
,
caps
,
xmlopt
)))
goto
fail
;
if
(
!
(
def
=
xenParseSxprString
(
sexprData
,
NULL
,
-
1
,
caps
,
xmlopt
)))
goto
fail
;
if
(
!
virDomainDefCheckABIStability
(
def
,
def
,
xmlopt
))
{
fprintf
(
stderr
,
"ABI stability check failed on %s"
,
xml
);
goto
fail
;
}
if
(
!
virDomainDefCheckABIStability
(
def
,
def
,
xmlopt
))
{
fprintf
(
stderr
,
"ABI stability check failed on %s"
,
xml
);
goto
fail
;
}
if
(
!
(
gotxml
=
virDomainDefFormat
(
def
,
caps
,
0
)))
goto
fail
;
if
(
!
(
gotxml
=
virDomainDefFormat
(
def
,
caps
,
0
)))
goto
fail
;
if
(
virTestCompareToFile
(
gotxml
,
xml
)
<
0
)
goto
fail
;
if
(
virTestCompareToFile
(
gotxml
,
xml
)
<
0
)
goto
fail
;
ret
=
0
;
ret
=
0
;
fail:
VIR_FREE
(
sexprData
);
VIR_FREE
(
gotxml
);
virDomainDefFree
(
def
);
VIR_FREE
(
sexprData
);
VIR_FREE
(
gotxml
);
virDomainDefFree
(
def
);
return
ret
;
return
ret
;
}
struct
testInfo
{
...
...
tests/virnettlshelpers.c
浏览文件 @
a618b064
...
...
@@ -126,19 +126,19 @@ static void testTLSDerEncode(ASN1_TYPE src,
const
char
*
src_name
,
gnutls_datum_t
*
res
)
{
int
size
;
char
*
data
=
NULL
;
int
size
;
char
*
data
=
NULL
;
size
=
0
;
asn1_der_coding
(
src
,
src_name
,
NULL
,
&
size
,
NULL
);
size
=
0
;
asn1_der_coding
(
src
,
src_name
,
NULL
,
&
size
,
NULL
);
if
(
VIR_ALLOC_N
(
data
,
size
)
<
0
)
abort
();
if
(
VIR_ALLOC_N
(
data
,
size
)
<
0
)
abort
();
asn1_der_coding
(
src
,
src_name
,
data
,
&
size
,
NULL
);
asn1_der_coding
(
src
,
src_name
,
data
,
&
size
,
NULL
);
res
->
data
=
(
unsigned
char
*
)
data
;
res
->
size
=
size
;
res
->
data
=
(
unsigned
char
*
)
data
;
res
->
size
=
size
;
}
...
...
tests/virshtest.c
浏览文件 @
a618b064
...
...
@@ -44,18 +44,18 @@ static const char *domstate_fc4 = "running\n\n";
static
int
testFilterLine
(
char
*
buffer
,
const
char
*
toRemove
)
{
char
*
start
;
char
*
end
;
if
(
!
(
start
=
strstr
(
buffer
,
toRemove
)))
return
-
1
;
if
(
!
(
end
=
strstr
(
start
+
1
,
"
\n
"
)))
{
*
start
=
'\0'
;
}
else
{
memmove
(
start
,
end
,
strlen
(
end
)
+
1
);
}
return
0
;
char
*
start
;
char
*
end
;
if
(
!
(
start
=
strstr
(
buffer
,
toRemove
)))
return
-
1
;
if
(
!
(
end
=
strstr
(
start
+
1
,
"
\n
"
)))
{
*
start
=
'\0'
;
}
else
{
memmove
(
start
,
end
,
strlen
(
end
)
+
1
);
}
return
0
;
}
static
int
...
...
@@ -96,31 +96,31 @@ static char *custom_uri;
static
int
testCompareListDefault
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_DEFAULT
,
"list"
,
NULL
};
const
char
*
exp
=
"\
const
char
*
const
argv
[]
=
{
VIRSH_DEFAULT
,
"list"
,
NULL
};
const
char
*
exp
=
"\
Id Name State
\n
\
----------------------
\n
\
1 test running
\n
\
\n
"
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareListCustom
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"list"
,
NULL
};
const
char
*
exp
=
"\
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"list"
,
NULL
};
const
char
*
exp
=
"\
Id Name State
\n
\
----------------------
\n
\
1 fv0 running
\n
\
2 fc4 running
\n
\
\n
"
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareNodeinfoDefault
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_DEFAULT
,
"nodeinfo"
,
NULL
};
const
char
*
exp
=
"\
const
char
*
const
argv
[]
=
{
VIRSH_DEFAULT
,
"nodeinfo"
,
NULL
};
const
char
*
exp
=
"\
CPU model: i686
\n
\
CPU(s): 16
\n
\
CPU frequency: 1400 MHz
\n
\
...
...
@@ -130,17 +130,17 @@ Thread(s) per core: 2\n\
NUMA cell(s): 2
\n
\
Memory size: 3145728 KiB
\n
\
\n
"
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareNodeinfoCustom
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"nodeinfo"
,
NULL
};
const
char
*
exp
=
"\
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"nodeinfo"
,
NULL
};
const
char
*
exp
=
"\
CPU model: i986
\n
\
CPU(s): 50
\n
\
CPU frequency: 6000 MHz
\n
\
...
...
@@ -150,91 +150,91 @@ Thread(s) per core: 2\n\
NUMA cell(s): 4
\n
\
Memory size: 8192000 KiB
\n
\
\n
"
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDominfoByID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
"2"
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
"2"
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
}
static
int
testCompareDominfoByUUID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
}
static
int
testCompareDominfoByName
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
"fc4"
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"dominfo"
,
"fc4"
,
NULL
};
const
char
*
exp
=
dominfo_fc4
;
return
testCompareOutputLit
(
exp
,
"
\n
CPU time:"
,
argv
);
}
static
int
testCompareDomuuidByID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domuuid"
,
"2"
,
NULL
};
const
char
*
exp
=
domuuid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domuuid"
,
"2"
,
NULL
};
const
char
*
exp
=
domuuid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomuuidByName
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domuuid"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domuuid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domuuid"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domuuid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomidByName
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domid"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domid"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomidByUUID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domid"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domid"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domid_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomnameByID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domname"
,
"2"
,
NULL
};
const
char
*
exp
=
domname_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domname"
,
"2"
,
NULL
};
const
char
*
exp
=
domname_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomnameByUUID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domname"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domname_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domname"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domname_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomstateByID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
"2"
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
"2"
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomstateByUUID
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
DOM_UUID
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
static
int
testCompareDomstateByName
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
const
char
*
const
argv
[]
=
{
VIRSH_CUSTOM
,
"domstate"
,
"fc4"
,
NULL
};
const
char
*
exp
=
domstate_fc4
;
return
testCompareOutputLit
(
exp
,
NULL
,
argv
);
}
struct
testInfo
{
...
...
tests/xml2sexprtest.c
浏览文件 @
a618b064
...
...
@@ -22,32 +22,32 @@ static virDomainXMLOptionPtr xmlopt;
static
int
testCompareFiles
(
const
char
*
xml
,
const
char
*
sexpr
)
{
char
*
gotsexpr
=
NULL
;
int
ret
=
-
1
;
virDomainDefPtr
def
=
NULL
;
char
*
gotsexpr
=
NULL
;
int
ret
=
-
1
;
virDomainDefPtr
def
=
NULL
;
if
(
!
(
def
=
virDomainDefParseFile
(
xml
,
caps
,
xmlopt
,
NULL
,
VIR_DOMAIN_DEF_PARSE_INACTIVE
)))
goto
fail
;
if
(
!
(
def
=
virDomainDefParseFile
(
xml
,
caps
,
xmlopt
,
NULL
,
VIR_DOMAIN_DEF_PARSE_INACTIVE
)))
goto
fail
;
if
(
!
virDomainDefCheckABIStability
(
def
,
def
,
xmlopt
))
{
fprintf
(
stderr
,
"ABI stability check failed on %s"
,
xml
);
goto
fail
;
}
if
(
!
virDomainDefCheckABIStability
(
def
,
def
,
xmlopt
))
{
fprintf
(
stderr
,
"ABI stability check failed on %s"
,
xml
);
goto
fail
;
}
if
(
!
(
gotsexpr
=
xenFormatSxpr
(
NULL
,
def
)))
goto
fail
;
if
(
!
(
gotsexpr
=
xenFormatSxpr
(
NULL
,
def
)))
goto
fail
;
if
(
virTestCompareToFile
(
gotsexpr
,
sexpr
)
<
0
)
goto
fail
;
if
(
virTestCompareToFile
(
gotsexpr
,
sexpr
)
<
0
)
goto
fail
;
ret
=
0
;
ret
=
0
;
fail:
VIR_FREE
(
gotsexpr
);
virDomainDefFree
(
def
);
VIR_FREE
(
gotsexpr
);
virDomainDefFree
(
def
);
return
ret
;
return
ret
;
}
struct
testInfo
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录