Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e60b9783
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看板
提交
e60b9783
编写于
5月 03, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_STRDUP and VIR_STRNDUP in tests/*
上级
aaf8114d
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
71 addition
and
67 deletion
+71
-67
tests/commandhelper.c
tests/commandhelper.c
+8
-3
tests/commandtest.c
tests/commandtest.c
+1
-1
tests/openvzutilstest.c
tests/openvzutilstest.c
+4
-2
tests/qemumonitortestutils.c
tests/qemumonitortestutils.c
+7
-8
tests/qemuxml2argvtest.c
tests/qemuxml2argvtest.c
+12
-11
tests/qemuxmlnstest.c
tests/qemuxmlnstest.c
+3
-1
tests/securityselinuxhelper.c
tests/securityselinuxhelper.c
+3
-6
tests/securityselinuxlabeltest.c
tests/securityselinuxlabeltest.c
+1
-2
tests/securityselinuxtest.c
tests/securityselinuxtest.c
+5
-4
tests/storagebackendsheepdogtest.c
tests/storagebackendsheepdogtest.c
+2
-4
tests/testutils.c
tests/testutils.c
+3
-1
tests/testutilsqemu.c
tests/testutilsqemu.c
+4
-1
tests/vircgrouptest.c
tests/vircgrouptest.c
+1
-1
tests/virnetmessagetest.c
tests/virnetmessagetest.c
+9
-12
tests/vmx2xmltest.c
tests/vmx2xmltest.c
+4
-5
tests/xml2vmxtest.c
tests/xml2vmxtest.c
+4
-5
未找到文件。
tests/commandhelper.c
浏览文件 @
e60b9783
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "viralloc.h"
#include "viralloc.h"
#include "virfile.h"
#include "virfile.h"
#include "testutils.h"
#include "testutils.h"
#include "virstring.h"
#ifndef WIN32
#ifndef WIN32
...
@@ -42,9 +43,13 @@ static int envsort(const void *a, const void *b) {
...
@@ -42,9 +43,13 @@ static int envsort(const void *a, const void *b) {
const
char
*
bstr
=
*
bstrptr
;
const
char
*
bstr
=
*
bstrptr
;
char
*
aeq
=
strchr
(
astr
,
'='
);
char
*
aeq
=
strchr
(
astr
,
'='
);
char
*
beq
=
strchr
(
bstr
,
'='
);
char
*
beq
=
strchr
(
bstr
,
'='
);
char
*
akey
=
strndup
(
astr
,
aeq
-
astr
);
char
*
akey
;
char
*
bkey
=
strndup
(
bstr
,
beq
-
bstr
);
char
*
bkey
;
int
ret
=
strcmp
(
akey
,
bkey
);
int
ret
;
ignore_value
(
VIR_STRNDUP_QUIET
(
akey
,
astr
,
aeq
-
astr
));
ignore_value
(
VIR_STRNDUP_QUIET
(
bkey
,
bstr
,
beq
-
bstr
));
ret
=
strcmp
(
akey
,
bkey
);
VIR_FREE
(
akey
);
VIR_FREE
(
akey
);
VIR_FREE
(
bkey
);
VIR_FREE
(
bkey
);
return
ret
;
return
ret
;
...
...
tests/commandtest.c
浏览文件 @
e60b9783
...
@@ -685,7 +685,7 @@ static int test17(const void *unused ATTRIBUTE_UNUSED)
...
@@ -685,7 +685,7 @@ static int test17(const void *unused ATTRIBUTE_UNUSED)
goto
cleanup
;
goto
cleanup
;
}
}
VIR_FREE
(
outbuf
);
VIR_FREE
(
outbuf
);
if
(
(
outbuf
=
strdup
(
"should not be leaked"
))
==
NULL
)
{
if
(
VIR_STRDUP
(
outbuf
,
"should not be leaked"
)
<
0
)
{
puts
(
"test framework failure"
);
puts
(
"test framework failure"
);
goto
cleanup
;
goto
cleanup
;
}
}
...
...
tests/openvzutilstest.c
浏览文件 @
e60b9783
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
# include "openvz/openvz_conf.h"
# include "openvz/openvz_conf.h"
# include "virstring.h"
# include "virstring.h"
# define VIR_FROM_THIS VIR_FROM_OPENVZ
static
int
static
int
testLocateConfFile
(
int
vpsid
ATTRIBUTE_UNUSED
,
char
**
conffile
,
testLocateConfFile
(
int
vpsid
ATTRIBUTE_UNUSED
,
char
**
conffile
,
const
char
*
ext
ATTRIBUTE_UNUSED
)
const
char
*
ext
ATTRIBUTE_UNUSED
)
...
@@ -103,8 +105,8 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED)
...
@@ -103,8 +105,8 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED)
"</domain>
\n
"
;
"</domain>
\n
"
;
if
(
VIR_ALLOC
(
def
)
<
0
||
if
(
VIR_ALLOC
(
def
)
<
0
||
!
(
def
->
os
.
type
=
strdup
(
"exe"
))
||
VIR_STRDUP
(
def
->
os
.
type
,
"exe"
)
<
0
||
!
(
def
->
os
.
init
=
strdup
(
"/sbin/init"
))
)
VIR_STRDUP
(
def
->
os
.
init
,
"/sbin/init"
)
<
0
)
goto
cleanup
;
goto
cleanup
;
def
->
virtType
=
VIR_DOMAIN_VIRT_OPENVZ
;
def
->
virtType
=
VIR_DOMAIN_VIRT_OPENVZ
;
...
...
tests/qemumonitortestutils.c
浏览文件 @
e60b9783
...
@@ -159,10 +159,8 @@ static int qemuMonitorTestProcessCommandText(qemuMonitorTestPtr test,
...
@@ -159,10 +159,8 @@ static int qemuMonitorTestProcessCommandText(qemuMonitorTestPtr test,
char
*
cmdname
;
char
*
cmdname
;
int
ret
=
-
1
;
int
ret
=
-
1
;
if
(
!
(
cmdname
=
strdup
(
cmdstr
)))
{
if
(
VIR_STRDUP
(
cmdname
,
cmdstr
)
<
0
)
virReportOOMError
();
return
-
1
;
return
-
1
;
}
if
(
!
(
tmp
=
strchr
(
cmdname
,
' '
)))
{
if
(
!
(
tmp
=
strchr
(
cmdname
,
' '
)))
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"Cannot find command name in '%s'"
,
cmdstr
);
"Cannot find command name in '%s'"
,
cmdstr
);
...
@@ -407,9 +405,9 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
...
@@ -407,9 +405,9 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
if
(
VIR_ALLOC
(
item
)
<
0
)
if
(
VIR_ALLOC
(
item
)
<
0
)
goto
no_memory
;
goto
no_memory
;
if
(
!
(
item
->
command_name
=
strdup
(
command_name
))
||
if
(
VIR_STRDUP
(
item
->
command_name
,
command_name
)
<
0
||
!
(
item
->
response
=
strdup
(
response
))
)
VIR_STRDUP
(
item
->
response
,
response
)
<
0
)
goto
no_memory
;
goto
error
;
virMutexLock
(
&
test
->
lock
);
virMutexLock
(
&
test
->
lock
);
if
(
VIR_EXPAND_N
(
test
->
items
,
test
->
nitems
,
1
)
<
0
)
{
if
(
VIR_EXPAND_N
(
test
->
items
,
test
->
nitems
,
1
)
<
0
)
{
...
@@ -424,6 +422,7 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
...
@@ -424,6 +422,7 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
no_memory:
no_memory:
virReportOOMError
();
virReportOOMError
();
error:
qemuMonitorTestItemFree
(
item
);
qemuMonitorTestItemFree
(
item
);
return
-
1
;
return
-
1
;
}
}
...
@@ -467,8 +466,8 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json, virDomainXMLOptionPtr xmlopt)
...
@@ -467,8 +466,8 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json, virDomainXMLOptionPtr xmlopt)
return
NULL
;
return
NULL
;
}
}
if
(
!
(
tmpdir_template
=
strdup
(
"/tmp/libvirt_XXXXXX"
))
)
if
(
VIR_STRDUP
(
tmpdir_template
,
"/tmp/libvirt_XXXXXX"
)
<
0
)
goto
no_memory
;
goto
error
;
if
(
!
(
test
->
tmpdir
=
mkdtemp
(
tmpdir_template
)))
{
if
(
!
(
test
->
tmpdir
=
mkdtemp
(
tmpdir_template
)))
{
virReportSystemError
(
errno
,
"%s"
,
virReportSystemError
(
errno
,
"%s"
,
...
...
tests/qemuxml2argvtest.c
浏览文件 @
e60b9783
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
# include "testutilsqemu.h"
# include "testutilsqemu.h"
# define VIR_FROM_THIS VIR_FROM_QEMU
static
const
char
*
abs_top_srcdir
;
static
const
char
*
abs_top_srcdir
;
static
virQEMUDriver
driver
;
static
virQEMUDriver
driver
;
...
@@ -32,10 +34,9 @@ fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
...
@@ -32,10 +34,9 @@ fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
unsigned
int
fakeflags
ATTRIBUTE_UNUSED
,
unsigned
int
fakeflags
ATTRIBUTE_UNUSED
,
unsigned
int
internalFlags
ATTRIBUTE_UNUSED
)
unsigned
int
internalFlags
ATTRIBUTE_UNUSED
)
{
{
char
*
secret
=
strdup
(
"AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A"
)
;
char
*
secret
;
if
(
!
secret
)
{
if
(
VIR_STRDUP
(
secret
,
"AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A"
)
<
0
)
return
NULL
;
return
NULL
;
}
*
value_size
=
strlen
(
secret
);
*
value_size
=
strlen
(
secret
);
return
(
unsigned
char
*
)
secret
;
return
(
unsigned
char
*
)
secret
;
}
}
...
@@ -129,7 +130,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
...
@@ -129,7 +130,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
if
(
STREQ
(
vmdef
->
os
.
machine
,
"pc"
)
&&
if
(
STREQ
(
vmdef
->
os
.
machine
,
"pc"
)
&&
STREQ
(
vmdef
->
emulator
,
"/usr/bin/qemu-system-x86_64"
))
{
STREQ
(
vmdef
->
emulator
,
"/usr/bin/qemu-system-x86_64"
))
{
VIR_FREE
(
vmdef
->
os
.
machine
);
VIR_FREE
(
vmdef
->
os
.
machine
);
if
(
!
(
vmdef
->
os
.
machine
=
strdup
(
"pc-0.11"
))
)
if
(
VIR_STRDUP
(
vmdef
->
os
.
machine
,
"pc-0.11"
)
<
0
)
goto
out
;
goto
out
;
}
}
...
@@ -288,10 +289,10 @@ mymain(void)
...
@@ -288,10 +289,10 @@ mymain(void)
VIR_FREE
(
driver
.
config
->
vncListen
);
VIR_FREE
(
driver
.
config
->
vncListen
);
VIR_FREE
(
driver
.
config
->
vncTLSx509certdir
);
VIR_FREE
(
driver
.
config
->
vncTLSx509certdir
);
if
(
(
driver
.
config
->
vncTLSx509certdir
=
strdup
(
"/etc/pki/libvirt-vnc"
))
==
NULL
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
vncTLSx509certdir
,
"/etc/pki/libvirt-vnc"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
VIR_FREE
(
driver
.
config
->
spiceTLSx509certdir
);
VIR_FREE
(
driver
.
config
->
spiceTLSx509certdir
);
if
(
(
driver
.
config
->
spiceTLSx509certdir
=
strdup
(
"/etc/pki/libvirt-spice"
))
==
NULL
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
spiceTLSx509certdir
,
"/etc/pki/libvirt-spice"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
if
((
driver
.
caps
=
testQemuCapsInit
())
==
NULL
)
if
((
driver
.
caps
=
testQemuCapsInit
())
==
NULL
)
...
@@ -299,16 +300,16 @@ mymain(void)
...
@@ -299,16 +300,16 @@ mymain(void)
if
(
!
(
driver
.
xmlopt
=
virQEMUDriverCreateXMLConf
(
&
driver
)))
if
(
!
(
driver
.
xmlopt
=
virQEMUDriverCreateXMLConf
(
&
driver
)))
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
VIR_FREE
(
driver
.
config
->
stateDir
);
VIR_FREE
(
driver
.
config
->
stateDir
);
if
(
(
driver
.
config
->
stateDir
=
strdup
(
"/nowhere"
))
==
NULL
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
stateDir
,
"/nowhere"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
VIR_FREE
(
driver
.
config
->
hugetlbfsMount
);
VIR_FREE
(
driver
.
config
->
hugetlbfsMount
);
if
(
(
driver
.
config
->
hugetlbfsMount
=
strdup
(
"/dev/hugepages"
))
==
NULL
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
hugetlbfsMount
,
"/dev/hugepages"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
VIR_FREE
(
driver
.
config
->
hugepagePath
);
VIR_FREE
(
driver
.
config
->
hugepagePath
);
if
(
(
driver
.
config
->
hugepagePath
=
strdup
(
"/dev/hugepages/libvirt/qemu"
))
==
NULL
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
hugepagePath
,
"/dev/hugepages/libvirt/qemu"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
driver
.
config
->
spiceTLS
=
1
;
driver
.
config
->
spiceTLS
=
1
;
if
(
!
(
driver
.
config
->
spicePassword
=
strdup
(
"123456"
))
)
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
spicePassword
,
"123456"
)
<
0
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
if
(
virAsprintf
(
&
map
,
"%s/src/cpu/cpu_map.xml"
,
abs_top_srcdir
)
<
0
||
if
(
virAsprintf
(
&
map
,
"%s/src/cpu/cpu_map.xml"
,
abs_top_srcdir
)
<
0
||
cpuMapOverride
(
map
)
<
0
)
{
cpuMapOverride
(
map
)
<
0
)
{
...
@@ -601,7 +602,7 @@ mymain(void)
...
@@ -601,7 +602,7 @@ mymain(void)
driver
.
config
->
vncSASL
=
1
;
driver
.
config
->
vncSASL
=
1
;
VIR_FREE
(
driver
.
config
->
vncSASLdir
);
VIR_FREE
(
driver
.
config
->
vncSASLdir
);
driver
.
config
->
vncSASLdir
=
strdup
(
"/root/.sasl2"
);
ignore_value
(
VIR_STRDUP
(
driver
.
config
->
vncSASLdir
,
"/root/.sasl2"
)
);
DO_TEST
(
"graphics-vnc-sasl"
,
QEMU_CAPS_VNC
,
QEMU_CAPS_VGA
);
DO_TEST
(
"graphics-vnc-sasl"
,
QEMU_CAPS_VNC
,
QEMU_CAPS_VGA
);
driver
.
config
->
vncTLS
=
1
;
driver
.
config
->
vncTLS
=
1
;
driver
.
config
->
vncTLSx509verify
=
1
;
driver
.
config
->
vncTLSx509verify
=
1
;
...
...
tests/qemuxmlnstest.c
浏览文件 @
e60b9783
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
# include "testutilsqemu.h"
# include "testutilsqemu.h"
# include "virstring.h"
# include "virstring.h"
# define VIR_FROM_THIS VIR_FROM_QEMU
static
const
char
*
abs_top_srcdir
;
static
const
char
*
abs_top_srcdir
;
static
virQEMUDriver
driver
;
static
virQEMUDriver
driver
;
...
@@ -68,7 +70,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
...
@@ -68,7 +70,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
* detects such paths, strips the extra '/' and makes the path absolute.
* detects such paths, strips the extra '/' and makes the path absolute.
*/
*/
if
(
vmdef
->
emulator
&&
STRPREFIX
(
vmdef
->
emulator
,
"/."
))
{
if
(
vmdef
->
emulator
&&
STRPREFIX
(
vmdef
->
emulator
,
"/."
))
{
if
(
!
(
emulator
=
strdup
(
vmdef
->
emulator
+
1
))
)
if
(
VIR_STRDUP
(
emulator
,
vmdef
->
emulator
+
1
)
<
0
)
goto
fail
;
goto
fail
;
VIR_FREE
(
vmdef
->
emulator
);
VIR_FREE
(
vmdef
->
emulator
);
vmdef
->
emulator
=
NULL
;
vmdef
->
emulator
=
NULL
;
...
...
tests/securityselinuxhelper.c
浏览文件 @
e60b9783
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
# include <attr/xattr.h>
# include <attr/xattr.h>
#endif
#endif
#include "virstring.h"
/*
/*
* The kernel policy will not allow us to arbitrarily change
* The kernel policy will not allow us to arbitrarily change
...
@@ -43,9 +44,7 @@ int getcon_raw(security_context_t *context)
...
@@ -43,9 +44,7 @@ int getcon_raw(security_context_t *context)
errno
=
EINVAL
;
errno
=
EINVAL
;
return
-
1
;
return
-
1
;
}
}
if
(
!
(
*
context
=
strdup
(
getenv
(
"FAKE_CONTEXT"
))))
return
VIR_STRDUP_QUIET
(
*
context
,
getenv
(
"FAKE_CONTEXT"
));
return
-
1
;
return
0
;
}
}
int
getcon
(
security_context_t
*
context
)
int
getcon
(
security_context_t
*
context
)
...
@@ -65,9 +64,7 @@ int getpidcon_raw(pid_t pid, security_context_t *context)
...
@@ -65,9 +64,7 @@ int getpidcon_raw(pid_t pid, security_context_t *context)
errno
=
EINVAL
;
errno
=
EINVAL
;
return
-
1
;
return
-
1
;
}
}
if
(
!
(
*
context
=
strdup
(
getenv
(
"FAKE_CONTEXT"
))))
return
VIR_STRDUP_QUIET
(
*
context
,
getenv
(
"FAKE_CONTEXT"
));
return
-
1
;
return
0
;
}
}
int
getpidcon
(
pid_t
pid
,
security_context_t
*
context
)
int
getpidcon
(
pid_t
pid
,
security_context_t
*
context
)
...
...
tests/securityselinuxlabeltest.c
浏览文件 @
e60b9783
...
@@ -116,10 +116,9 @@ testSELinuxLoadFileList(const char *testname,
...
@@ -116,10 +116,9 @@ testSELinuxLoadFileList(const char *testname,
goto
cleanup
;
goto
cleanup
;
}
}
if
(
*
tmp
!=
'\0'
&&
*
tmp
!=
'\n'
)
{
if
(
*
tmp
!=
'\0'
&&
*
tmp
!=
'\n'
)
{
if
(
!
(
context
=
strdup
(
tmp
))
)
{
if
(
VIR_STRDUP
(
context
,
tmp
)
<
0
)
{
VIR_FREE
(
line
);
VIR_FREE
(
line
);
VIR_FREE
(
file
);
VIR_FREE
(
file
);
virReportOOMError
();
goto
cleanup
;
goto
cleanup
;
}
}
...
...
tests/securityselinuxtest.c
浏览文件 @
e60b9783
...
@@ -81,17 +81,18 @@ testBuildDomainDef(bool dynamic,
...
@@ -81,17 +81,18 @@ testBuildDomainDef(bool dynamic,
def
->
seclabels
[
0
]
->
type
=
dynamic
?
VIR_DOMAIN_SECLABEL_DYNAMIC
:
VIR_DOMAIN_SECLABEL_STATIC
;
def
->
seclabels
[
0
]
->
type
=
dynamic
?
VIR_DOMAIN_SECLABEL_DYNAMIC
:
VIR_DOMAIN_SECLABEL_STATIC
;
if
(
label
&&
if
(
label
&&
!
(
def
->
seclabels
[
0
]
->
label
=
strdup
(
label
))
)
VIR_STRDUP
(
def
->
seclabels
[
0
]
->
label
,
label
)
<
0
)
goto
no_memory
;
goto
error
;
if
(
baselabel
&&
if
(
baselabel
&&
!
(
def
->
seclabels
[
0
]
->
baselabel
=
strdup
(
baselabel
))
)
VIR_STRDUP
(
def
->
seclabels
[
0
]
->
baselabel
,
baselabel
)
<
0
)
goto
no_memory
;
goto
error
;
return
def
;
return
def
;
no_memory:
no_memory:
virReportOOMError
();
virReportOOMError
();
error:
virDomainDefFree
(
def
);
virDomainDefFree
(
def
);
return
NULL
;
return
NULL
;
}
}
...
...
tests/storagebackendsheepdogtest.c
浏览文件 @
e60b9783
...
@@ -57,8 +57,7 @@ test_node_info_parser(collie_test test, char *poolxml)
...
@@ -57,8 +57,7 @@ test_node_info_parser(collie_test test, char *poolxml)
if
(
!
(
pool
=
virStoragePoolDefParseString
(
poolXmlData
)))
if
(
!
(
pool
=
virStoragePoolDefParseString
(
poolXmlData
)))
goto
cleanup
;
goto
cleanup
;
output
=
strdup
(
test
.
output
);
if
(
VIR_STRDUP
(
output
,
test
.
output
)
<
0
)
if
(
!
output
)
goto
cleanup
;
goto
cleanup
;
if
(
virStorageBackendSheepdogParseNodeInfo
(
pool
,
output
)
!=
if
(
virStorageBackendSheepdogParseNodeInfo
(
pool
,
output
)
!=
...
@@ -102,8 +101,7 @@ test_vdi_list_parser(collie_test test, char *poolxml, char *volxml)
...
@@ -102,8 +101,7 @@ test_vdi_list_parser(collie_test test, char *poolxml, char *volxml)
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
)))
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
)))
goto
cleanup
;
goto
cleanup
;
output
=
strdup
(
test
.
output
);
if
(
VIR_STRDUP
(
output
,
test
.
output
)
<
0
)
if
(
!
output
)
goto
cleanup
;
goto
cleanup
;
if
(
virStorageBackendSheepdogParseVdiList
(
vol
,
output
)
!=
if
(
virStorageBackendSheepdogParseVdiList
(
vol
,
output
)
!=
...
...
tests/testutils.c
浏览文件 @
e60b9783
...
@@ -512,7 +512,9 @@ virtTestLogContentAndReset(void)
...
@@ -512,7 +512,9 @@ virtTestLogContentAndReset(void)
if
(
virBufferError
(
&
testLog
.
buf
))
if
(
virBufferError
(
&
testLog
.
buf
))
return
NULL
;
return
NULL
;
ret
=
virBufferContentAndReset
(
&
testLog
.
buf
);
ret
=
virBufferContentAndReset
(
&
testLog
.
buf
);
return
ret
?
ret
:
strdup
(
""
);
if
(
!
ret
)
ignore_value
(
VIR_STRDUP
(
ret
,
""
));
return
ret
;
}
}
#if TEST_OOM_TRACE
#if TEST_OOM_TRACE
...
...
tests/testutilsqemu.c
浏览文件 @
e60b9783
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
# include "cpu_conf.h"
# include "cpu_conf.h"
# include "qemu/qemu_driver.h"
# include "qemu/qemu_driver.h"
# include "qemu/qemu_domain.h"
# include "qemu/qemu_domain.h"
# include "virstring.h"
# define VIR_FROM_THIS VIR_FROM_QEMU
static
virCapsGuestMachinePtr
*
testQemuAllocMachines
(
int
*
nmachines
)
static
virCapsGuestMachinePtr
*
testQemuAllocMachines
(
int
*
nmachines
)
{
{
...
@@ -38,7 +41,7 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
...
@@ -38,7 +41,7 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
"pc-0.11"
,
"pc"
,
"pc-0.10"
,
"isapc"
"pc-0.11"
,
"pc"
,
"pc-0.10"
,
"isapc"
};
};
if
(
(
canonical
=
strdup
(
x86_machines
[
0
]))
==
NULL
)
if
(
VIR_STRDUP
(
canonical
,
x86_machines
[
0
])
<
0
)
return
NULL
;
return
NULL
;
machines
=
virCapabilitiesAllocMachines
(
x86_machines
,
machines
=
virCapabilitiesAllocMachines
(
x86_machines
,
...
...
tests/vircgrouptest.c
浏览文件 @
e60b9783
...
@@ -501,7 +501,7 @@ mymain(void)
...
@@ -501,7 +501,7 @@ mymain(void)
int
ret
=
0
;
int
ret
=
0
;
char
*
fakesysfsdir
;
char
*
fakesysfsdir
;
if
(
!
(
fakesysfsdir
=
strdup
(
FAKESYSFSDIRTEMPLATE
))
)
{
if
(
VIR_STRDUP_QUIET
(
fakesysfsdir
,
FAKESYSFSDIRTEMPLATE
)
<
0
)
{
fprintf
(
stderr
,
"Out of memory
\n
"
);
fprintf
(
stderr
,
"Out of memory
\n
"
);
abort
();
abort
();
}
}
...
...
tests/virnetmessagetest.c
浏览文件 @
e60b9783
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "virerror.h"
#include "virerror.h"
#include "viralloc.h"
#include "viralloc.h"
#include "virlog.h"
#include "virlog.h"
#include "virstring.h"
#include "rpc/virnetmessage.h"
#include "rpc/virnetmessage.h"
#define VIR_FROM_THIS VIR_FROM_RPC
#define VIR_FROM_THIS VIR_FROM_RPC
...
@@ -236,18 +236,15 @@ static int testMessagePayloadEncode(const void *args ATTRIBUTE_UNUSED)
...
@@ -236,18 +236,15 @@ static int testMessagePayloadEncode(const void *args ATTRIBUTE_UNUSED)
err
.
domain
=
VIR_FROM_RPC
;
err
.
domain
=
VIR_FROM_RPC
;
err
.
level
=
VIR_ERR_ERROR
;
err
.
level
=
VIR_ERR_ERROR
;
if
(
VIR_ALLOC
(
err
.
message
)
<
0
)
if
(
VIR_ALLOC
(
err
.
message
)
<
0
||
goto
cleanup
;
VIR_STRDUP
(
*
err
.
message
,
"Hello World"
)
<
0
||
*
err
.
message
=
strdup
(
"Hello World"
);
VIR_ALLOC
(
err
.
str1
)
<
0
||
if
(
VIR_ALLOC
(
err
.
str1
)
<
0
)
VIR_STRDUP
(
*
err
.
str1
,
"One"
)
<
0
||
goto
cleanup
;
VIR_ALLOC
(
err
.
str2
)
<
0
||
*
err
.
str1
=
strdup
(
"One"
);
VIR_STRDUP
(
*
err
.
str2
,
"Two"
)
<
0
||
if
(
VIR_ALLOC
(
err
.
str2
)
<
0
)
VIR_ALLOC
(
err
.
str3
)
<
0
||
goto
cleanup
;
VIR_STRDUP
(
*
err
.
str3
,
"Three"
)
<
0
)
*
err
.
str2
=
strdup
(
"Two"
);
if
(
VIR_ALLOC
(
err
.
str3
)
<
0
)
goto
cleanup
;
goto
cleanup
;
*
err
.
str3
=
strdup
(
"Three"
);
err
.
int1
=
1
;
err
.
int1
=
1
;
err
.
int2
=
2
;
err
.
int2
=
2
;
...
...
tests/vmx2xmltest.c
浏览文件 @
e60b9783
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
# include "vmx/vmx.h"
# include "vmx/vmx.h"
# include "virstring.h"
# include "virstring.h"
# define VIR_FROM_THIS VIR_FROM_VMWARE
static
virCapsPtr
caps
;
static
virCapsPtr
caps
;
static
virDomainXMLOptionPtr
xmlopt
;
static
virDomainXMLOptionPtr
xmlopt
;
static
virVMXContext
ctx
;
static
virVMXContext
ctx
;
...
@@ -159,11 +161,8 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
...
@@ -159,11 +161,8 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
if
(
STRPREFIX
(
fileName
,
"/vmfs/volumes/"
))
{
if
(
STRPREFIX
(
fileName
,
"/vmfs/volumes/"
))
{
/* Found absolute path referencing a file inside a datastore */
/* Found absolute path referencing a file inside a datastore */
copyOfFileName
=
strdup
(
fileName
);
if
(
VIR_STRDUP
(
copyOfFileName
,
fileName
)
<
0
)
if
(
copyOfFileName
==
NULL
)
{
goto
cleanup
;
goto
cleanup
;
}
/* Expected format: '/vmfs/volumes/<datastore>/<path>' */
/* Expected format: '/vmfs/volumes/<datastore>/<path>' */
if
((
tmp
=
STRSKIP
(
copyOfFileName
,
"/vmfs/volumes/"
))
==
NULL
||
if
((
tmp
=
STRSKIP
(
copyOfFileName
,
"/vmfs/volumes/"
))
==
NULL
||
...
@@ -177,7 +176,7 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
...
@@ -177,7 +176,7 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
goto
cleanup
;
goto
cleanup
;
}
else
if
(
STRPREFIX
(
fileName
,
"/"
))
{
}
else
if
(
STRPREFIX
(
fileName
,
"/"
))
{
/* Found absolute path referencing a file outside a datastore */
/* Found absolute path referencing a file outside a datastore */
src
=
strdup
(
fileName
);
ignore_value
(
VIR_STRDUP
(
src
,
fileName
)
);
}
else
if
(
strchr
(
fileName
,
'/'
)
!=
NULL
)
{
}
else
if
(
strchr
(
fileName
,
'/'
)
!=
NULL
)
{
/* Found relative path, this is not supported */
/* Found relative path, this is not supported */
src
=
NULL
;
src
=
NULL
;
...
...
tests/xml2vmxtest.c
浏览文件 @
e60b9783
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
# include "vmx/vmx.h"
# include "vmx/vmx.h"
# include "virstring.h"
# include "virstring.h"
# define VIR_FROM_THIS VIR_FROM_VMWARE
static
virCapsPtr
caps
;
static
virCapsPtr
caps
;
static
virVMXContext
ctx
;
static
virVMXContext
ctx
;
static
virDomainXMLOptionPtr
xmlopt
;
static
virDomainXMLOptionPtr
xmlopt
;
...
@@ -169,11 +171,8 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
...
@@ -169,11 +171,8 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
if
(
STRPREFIX
(
src
,
"["
))
{
if
(
STRPREFIX
(
src
,
"["
))
{
/* Found potential datastore path */
/* Found potential datastore path */
copyOfDatastorePath
=
strdup
(
src
);
if
(
VIR_STRDUP
(
copyOfDatastorePath
,
src
)
<
0
)
if
(
copyOfDatastorePath
==
NULL
)
{
goto
cleanup
;
goto
cleanup
;
}
/* Expected format: '[<datastore>] <path>' where <path> is optional */
/* Expected format: '[<datastore>] <path>' where <path> is optional */
if
((
tmp
=
STRSKIP
(
copyOfDatastorePath
,
"["
))
==
NULL
||
*
tmp
==
']'
||
if
((
tmp
=
STRSKIP
(
copyOfDatastorePath
,
"["
))
==
NULL
||
*
tmp
==
']'
||
...
@@ -194,7 +193,7 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
...
@@ -194,7 +193,7 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
goto
cleanup
;
goto
cleanup
;
}
else
if
(
STRPREFIX
(
src
,
"/"
))
{
}
else
if
(
STRPREFIX
(
src
,
"/"
))
{
/* Found absolute path */
/* Found absolute path */
absolutePath
=
strdup
(
src
);
ignore_value
(
VIR_STRDUP
(
absolutePath
,
src
)
);
}
else
{
}
else
{
/* Found relative path, this is not supported */
/* Found relative path, this is not supported */
goto
cleanup
;
goto
cleanup
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录