Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
94353ef6
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看板
提交
94353ef6
编写于
4月 18, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Re-factor and pretty print differences
上级
48455914
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
177 addition
and
317 deletion
+177
-317
ChangeLog
ChangeLog
+9
-0
tests/Makefile.am
tests/Makefile.am
+2
-0
tests/statstest.c
tests/statstest.c
+85
-122
tests/test_conf.sh
tests/test_conf.sh
+29
-17
tests/xencapstest.c
tests/xencapstest.c
+3
-7
tests/xmconfigtest.c
tests/xmconfigtest.c
+49
-171
未找到文件。
ChangeLog
浏览文件 @
94353ef6
Fri Apr 18 11:26:24 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* tests/Makefile.am: Add abs_srcdir and abs_builddir to test
environment
* tests/test_conf.sh: Refactor to pretty print
* tests/statstest.c, tests/xencapstest.c, tests/xmconfigtest.c:
Use new virtTestDifference for display. Autoset abs_srcdir if
not in environment. Refactor common code into macros
Fri Apr 18 11:04:24 EST 2008 Daniel P. Berrange <berrange@redhat.com>
Fri Apr 18 11:04:24 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* tests/testutils.h, tests/testutils.c: Add virtTestDifference
* tests/testutils.h, tests/testutils.c: Add virtTestDifference
...
...
tests/Makefile.am
浏览文件 @
94353ef6
...
@@ -66,6 +66,8 @@ path_add = $$abs_top_builddir/src$(PATH_SEPARATOR)$$abs_top_builddir/qemud
...
@@ -66,6 +66,8 @@ path_add = $$abs_top_builddir/src$(PATH_SEPARATOR)$$abs_top_builddir/qemud
TESTS_ENVIRONMENT
=
\
TESTS_ENVIRONMENT
=
\
abs_top_builddir
=
`
cd
'
$(top_builddir)
'
;
pwd
`
\
abs_top_builddir
=
`
cd
'
$(top_builddir)
'
;
pwd
`
\
abs_top_srcdir
=
`
cd
'
$(top_srcdir)
'
;
pwd
`
\
abs_top_srcdir
=
`
cd
'
$(top_srcdir)
'
;
pwd
`
\
abs_builddir
=
`
cd
'
$(builddir)
'
;
pwd
`
\
abs_srcdir
=
`
cd
'
$(srcdir)
'
;
pwd
`
\
PATH
=
"
$(path_add)$(PATH_SEPARATOR)$$
PATH"
\
PATH
=
"
$(path_add)$(PATH_SEPARATOR)$$
PATH"
\
SHELL
=
"
$(SHELL)
"
\
SHELL
=
"
$(SHELL)
"
\
$(VG)
$(VG)
...
...
tests/statstest.c
浏览文件 @
94353ef6
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include "stats_linux.h"
#include "stats_linux.h"
#include "internal.h"
#include "internal.h"
#include "testutils.h"
#if WITH_XEN
#if WITH_XEN
static
void
testQuietError
(
void
*
userData
ATTRIBUTE_UNUSED
,
static
void
testQuietError
(
void
*
userData
ATTRIBUTE_UNUSED
,
virErrorPtr
error
ATTRIBUTE_UNUSED
)
virErrorPtr
error
ATTRIBUTE_UNUSED
)
...
@@ -21,13 +23,26 @@ static int testDevice(const char *path, int expect)
...
@@ -21,13 +23,26 @@ static int testDevice(const char *path, int expect)
int
actual
=
xenLinuxDomainDeviceID
(
NULL
,
1
,
path
);
int
actual
=
xenLinuxDomainDeviceID
(
NULL
,
1
,
path
);
if
(
actual
==
expect
)
{
if
(
actual
==
expect
)
{
fprintf
(
stderr
,
"%-14s == %-6d OK
\n
"
,
path
,
expect
);
return
0
;
return
0
;
}
else
{
}
else
{
fprintf
(
stderr
,
"%-14s == %-6d (%-6d) FAILED
\n
"
,
path
,
expect
,
actual
);
if
(
getenv
(
"DEBUG_TESTS"
))
fprintf
(
stderr
,
"Expect %-6d Actual %-6d
\n
"
,
expect
,
actual
);
return
-
1
;
return
-
1
;
}
}
}
}
struct
testInfo
{
const
char
*
dev
;
int
num
;
};
static
int
testDeviceHelper
(
const
void
*
data
)
{
const
struct
testInfo
*
info
=
data
;
return
testDevice
(
info
->
dev
,
info
->
num
);
}
#endif
#endif
int
int
...
@@ -42,85 +57,67 @@ main(void)
...
@@ -42,85 +57,67 @@ main(void)
if
(
!
getenv
(
"DEBUG_TESTS"
))
if
(
!
getenv
(
"DEBUG_TESTS"
))
virSetErrorFunc
(
NULL
,
testQuietError
);
virSetErrorFunc
(
NULL
,
testQuietError
);
#define DO_TEST(dev, num) \
do { \
struct testInfo info = { dev, num }; \
if (virtTestRun("Device " dev " -> " # num, \
1, testDeviceHelper, &info) < 0) \
ret = -1; \
} while (0)
/********************************
/********************************
* Xen paravirt disks
* Xen paravirt disks
********************************/
********************************/
/* first valid disk */
/* first valid disk */
if
(
testDevice
(
"xvda"
,
51712
)
<
0
)
DO_TEST
(
"xvda"
,
51712
);
ret
=
-
1
;
DO_TEST
(
"xvda1"
,
51713
);
if
(
testDevice
(
"xvda1"
,
51713
)
<
0
)
DO_TEST
(
"xvda15"
,
51727
);
ret
=
-
1
;
if
(
testDevice
(
"xvda15"
,
51727
)
<
0
)
ret
=
-
1
;
/* Last valid disk */
/* Last valid disk */
if
(
testDevice
(
"xvdp"
,
51952
)
<
0
)
DO_TEST
(
"xvdp"
,
51952
);
ret
=
-
1
;
DO_TEST
(
"xvdp1"
,
51953
);
if
(
testDevice
(
"xvdp1"
,
51953
)
<
0
)
DO_TEST
(
"xvdp15"
,
51967
);
ret
=
-
1
;
if
(
testDevice
(
"xvdp15"
,
51967
)
<
0
)
ret
=
-
1
;
/* Disk letter to large */
/* Disk letter to large */
if
(
testDevice
(
"xvdq"
,
-
1
)
<
0
)
DO_TEST
(
"xvdq"
,
-
1
);
ret
=
-
1
;
/* missing disk letter */
/* missing disk letter */
if
(
testDevice
(
"xvd1"
,
-
1
)
<
0
)
DO_TEST
(
"xvd1"
,
-
1
);
ret
=
-
1
;
/* partition to large */
/* partition to large */
if
(
testDevice
(
"xvda16"
,
-
1
)
<
0
)
DO_TEST
(
"xvda16"
,
-
1
);
ret
=
-
1
;
/* partition to small */
/* partition to small */
if
(
testDevice
(
"xvda0"
,
-
1
)
<
0
)
DO_TEST
(
"xvda0"
,
-
1
);
ret
=
-
1
;
/* leading zeros */
/* leading zeros */
if
(
testDevice
(
"xvda01"
,
-
1
)
<
0
)
DO_TEST
(
"xvda01"
,
-
1
);
ret
=
-
1
;
/* leading + */
/* leading + */
if
(
testDevice
(
"xvda+1"
,
-
1
)
<
0
)
DO_TEST
(
"xvda+1"
,
-
1
);
ret
=
-
1
;
/* leading - */
/* leading - */
if
(
testDevice
(
"xvda-1"
,
-
1
)
<
0
)
DO_TEST
(
"xvda-1"
,
-
1
);
ret
=
-
1
;
/********************************
/********************************
* IDE disks
* IDE disks
********************************/
********************************/
/* odd numbered disk */
/* odd numbered disk */
if
(
testDevice
(
"hda"
,
768
)
<
0
)
DO_TEST
(
"hda"
,
768
);
ret
=
-
1
;
DO_TEST
(
"hda1"
,
769
);
if
(
testDevice
(
"hda1"
,
769
)
<
0
)
DO_TEST
(
"hda63"
,
831
);
ret
=
-
1
;
if
(
testDevice
(
"hda63"
,
831
)
<
0
)
ret
=
-
1
;
/* even number disk */
/* even number disk */
if
(
testDevice
(
"hdd"
,
5695
)
<
0
)
DO_TEST
(
"hdd"
,
5695
);
ret
=
-
1
;
DO_TEST
(
"hdd1"
,
5696
);
if
(
testDevice
(
"hdd1"
,
5696
)
<
0
)
DO_TEST
(
"hdd63"
,
5758
);
ret
=
-
1
;
if
(
testDevice
(
"hdd63"
,
5758
)
<
0
)
ret
=
-
1
;
/* last valid disk */
/* last valid disk */
if
(
testDevice
(
"hdt"
,
23359
)
<
0
)
DO_TEST
(
"hdt"
,
23359
);
ret
=
-
1
;
DO_TEST
(
"hdt1"
,
23360
);
if
(
testDevice
(
"hdt1"
,
23360
)
<
0
)
DO_TEST
(
"hdt63"
,
23422
);
ret
=
-
1
;
if
(
testDevice
(
"hdt63"
,
23422
)
<
0
)
ret
=
-
1
;
/* Disk letter to large */
/* Disk letter to large */
if
(
testDevice
(
"hdu"
,
-
1
)
<
0
)
DO_TEST
(
"hdu"
,
-
1
);
ret
=
-
1
;
/* missing disk letter */
/* missing disk letter */
if
(
testDevice
(
"hd1"
,
-
1
)
<
0
)
DO_TEST
(
"hd1"
,
-
1
);
ret
=
-
1
;
/* partition to large */
/* partition to large */
if
(
testDevice
(
"hda64"
,
-
1
)
<
0
)
DO_TEST
(
"hda64"
,
-
1
);
ret
=
-
1
;
/* partition to small */
/* partition to small */
if
(
testDevice
(
"hda0"
,
-
1
)
<
0
)
DO_TEST
(
"hda0"
,
-
1
);
ret
=
-
1
;
...
@@ -129,89 +126,55 @@ main(void)
...
@@ -129,89 +126,55 @@ main(void)
********************************/
********************************/
/* first valid disk */
/* first valid disk */
if
(
testDevice
(
"sda"
,
2048
)
<
0
)
DO_TEST
(
"sda"
,
2048
);
ret
=
-
1
;
DO_TEST
(
"sda1"
,
2049
);
if
(
testDevice
(
"sda1"
,
2049
)
<
0
)
DO_TEST
(
"sda15"
,
2063
);
ret
=
-
1
;
if
(
testDevice
(
"sda15"
,
2063
)
<
0
)
ret
=
-
1
;
/* last valid disk of first SCSI major number */
/* last valid disk of first SCSI major number */
if
(
testDevice
(
"sdp"
,
2288
)
<
0
)
DO_TEST
(
"sdp"
,
2288
);
ret
=
-
1
;
DO_TEST
(
"sdp1"
,
2289
);
if
(
testDevice
(
"sdp1"
,
2289
)
<
0
)
DO_TEST
(
"sdp15"
,
2303
);
ret
=
-
1
;
if
(
testDevice
(
"sdp15"
,
2303
)
<
0
)
ret
=
-
1
;
/* first valid disk of second SCSI major number */
/* first valid disk of second SCSI major number */
if
(
testDevice
(
"sdq"
,
16640
)
<
0
)
DO_TEST
(
"sdq"
,
16640
);
ret
=
-
1
;
DO_TEST
(
"sdq1"
,
16641
);
if
(
testDevice
(
"sdq1"
,
16641
)
<
0
)
DO_TEST
(
"sdq15"
,
16655
);
ret
=
-
1
;
if
(
testDevice
(
"sdq15"
,
16655
)
<
0
)
ret
=
-
1
;
/* last valid single letter disk */
/* last valid single letter disk */
if
(
testDevice
(
"sdz"
,
16784
)
<
0
)
DO_TEST
(
"sdz"
,
16784
);
ret
=
-
1
;
DO_TEST
(
"sdz1"
,
16785
);
if
(
testDevice
(
"sdz1"
,
16785
)
<
0
)
DO_TEST
(
"sdz15"
,
16799
);
ret
=
-
1
;
if
(
testDevice
(
"sdz15"
,
16799
)
<
0
)
ret
=
-
1
;
/* first valid dual letter disk */
/* first valid dual letter disk */
if
(
testDevice
(
"sdaa"
,
16800
)
<
0
)
DO_TEST
(
"sdaa"
,
16800
);
ret
=
-
1
;
DO_TEST
(
"sdaa1"
,
16801
);
if
(
testDevice
(
"sdaa1"
,
16801
)
<
0
)
DO_TEST
(
"sdaa15"
,
16815
);
ret
=
-
1
;
if
(
testDevice
(
"sdaa15"
,
16815
)
<
0
)
ret
=
-
1
;
/* second valid dual letter disk */
/* second valid dual letter disk */
if
(
testDevice
(
"sdab"
,
16816
)
<
0
)
DO_TEST
(
"sdab"
,
16816
);
ret
=
-
1
;
DO_TEST
(
"sdab1"
,
16817
);
if
(
testDevice
(
"sdab1"
,
16817
)
<
0
)
DO_TEST
(
"sdab15"
,
16831
);
ret
=
-
1
;
if
(
testDevice
(
"sdab15"
,
16831
)
<
0
)
ret
=
-
1
;
/* first letter of second sequence of dual letter disk */
/* first letter of second sequence of dual letter disk */
if
(
testDevice
(
"sdba"
,
17216
)
<
0
)
DO_TEST
(
"sdba"
,
17216
);
ret
=
-
1
;
DO_TEST
(
"sdba1"
,
17217
);
if
(
testDevice
(
"sdba1"
,
17217
)
<
0
)
DO_TEST
(
"sdba15"
,
17231
);
ret
=
-
1
;
if
(
testDevice
(
"sdba15"
,
17231
)
<
0
)
ret
=
-
1
;
/* last valid dual letter disk */
/* last valid dual letter disk */
if
(
testDevice
(
"sdiv"
,
34800
)
<
0
)
DO_TEST
(
"sdiv"
,
34800
);
ret
=
-
1
;
DO_TEST
(
"sdiv1"
,
34801
);
if
(
testDevice
(
"sdiv1"
,
34801
)
<
0
)
DO_TEST
(
"sdiv15"
,
34815
);
ret
=
-
1
;
if
(
testDevice
(
"sdiv15"
,
34815
)
<
0
)
ret
=
-
1
;
/* Disk letter to large */
/* Disk letter to large */
if
(
testDevice
(
"sdix"
,
-
1
)
<
0
)
DO_TEST
(
"sdix"
,
-
1
);
ret
=
-
1
;
/* missing disk letter */
/* missing disk letter */
if
(
testDevice
(
"sd1"
,
-
1
)
<
0
)
DO_TEST
(
"sd1"
,
-
1
);
ret
=
-
1
;
/* partition to large */
/* partition to large */
if
(
testDevice
(
"sda16"
,
-
1
)
<
0
)
DO_TEST
(
"sda16"
,
-
1
);
ret
=
-
1
;
/* partition to small */
/* partition to small */
if
(
testDevice
(
"sda0"
,
-
1
)
<
0
)
DO_TEST
(
"sda0"
,
-
1
);
ret
=
-
1
;
/* Path stripping */
/* Path stripping */
if
(
testDevice
(
"/dev"
,
-
1
)
<
0
)
DO_TEST
(
"/dev"
,
-
1
);
ret
=
-
1
;
DO_TEST
(
"/dev/"
,
-
1
);
if
(
testDevice
(
"/dev/"
,
-
1
)
<
0
)
DO_TEST
(
"/dev/xvd"
,
-
1
);
ret
=
-
1
;
DO_TEST
(
"/dev/xvda"
,
51712
);
if
(
testDevice
(
"/dev/xvd"
,
-
1
)
<
0
)
DO_TEST
(
"/dev/xvda1"
,
51713
);
ret
=
-
1
;
DO_TEST
(
"/dev/xvda15"
,
51727
);
if
(
testDevice
(
"/dev/xvda"
,
51712
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvda1"
,
51713
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvda15"
,
51727
)
<
0
)
ret
=
-
1
;
#endif
#endif
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
...
...
tests/test_conf.sh
浏览文件 @
94353ef6
#!/bin/bash
#!/bin/sh
set
-x
NOK
=
0
if
test
"
$VERBOSE
"
=
yes
;
then
for
f
in
$abs_top_srcdir
/tests/confdata/
*
.conf
set
-x
virsh
--version
fi
.
$srcdir
/test-lib.sh
set
-e
if
test
"x
$abs_srcdir
"
=
x
;
then
abs_srcdir
=
`
pwd
`
abs_builddir
=
`
pwd
`
fi
fail
=
0
i
=
1
data_dir
=
$abs_srcdir
/confdata
for
f
in
$(
cd
"
$data_dir
"
&&
echo
*
.conf
)
do
do
./conftest
$f
>
conftest.
$$
"
$abs_builddir
/conftest"
"
$data_dir
/
$f
"
>
"
$f
-actual"
outfile
=
`
echo
"
$f
"
|
sed
s+
\.
conf
$+
\.
out+
`
expected
=
"
$data_dir
"
/
`
echo
"
$f
"
|
sed
s+
\.
conf
$+
\.
out+
`
diff
$outfile
conftest.
$$
>
/dev/null
if
compare
"
$expected
"
"
$f
-actual"
;
then
if
[
$?
!=
0
]
msg
=
OK
then
if
[
-n
"
$DEBUG_TESTS
"
]
;
then
diff
-u
$outfile
conftest.
$$
fi
echo
"
$f
FAILED"
NOK
=
1
else
else
echo
"
$f
OK"
msg
=
FAILED
fail
=
1
fi
fi
printf
"%2d) %-60s ... %s
\n
"
$i
"
$f
"
$msg
i
=
`
expr
$i
+ 1
`
done
done
rm
-f
conftest.
$$
exit
$NOK
(
exit
$fail
)
;
exit
$fail
tests/xencapstest.c
浏览文件 @
94353ef6
...
@@ -50,14 +50,10 @@ static int testCompareFiles(const char *hostmachine,
...
@@ -50,14 +50,10 @@ static int testCompareFiles(const char *hostmachine,
if
(
!
(
actualxml
=
xenHypervisorMakeCapabilitiesXML
(
NULL
,
hostmachine
,
fp1
,
fp2
)))
if
(
!
(
actualxml
=
xenHypervisorMakeCapabilitiesXML
(
NULL
,
hostmachine
,
fp1
,
fp2
)))
goto
fail
;
goto
fail
;
if
(
getenv
(
"DEBUG_TESTS"
)
&&
if
(
STRNEQ
(
expectxml
,
actualxml
))
{
STRNEQ
(
expectxml
,
actualxml
))
{
virtTestDifference
(
stderr
,
expectxml
,
actualxml
);
printf
(
"In test file %s:
\n
"
,
capabilities
);
goto
fail
;
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
expectxml
),
expectxml
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
actualxml
),
actualxml
);
}
}
if
(
strcmp
(
expectxml
,
actualxml
))
goto
fail
;
ret
=
0
;
ret
=
0
;
...
...
tests/xmconfigtest.c
浏览文件 @
94353ef6
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#ifdef WITH_XEN
#ifdef WITH_XEN
...
@@ -35,11 +36,11 @@
...
@@ -35,11 +36,11 @@
#include "conf.h"
#include "conf.h"
static
char
*
progname
;
static
char
*
progname
;
static
char
*
abs_
top_
srcdir
;
static
char
*
abs_srcdir
;
#define MAX_FILE 4096
#define MAX_FILE 4096
static
int
testCompareParseXML
(
const
char
*
xmcfg
_rel
,
const
char
*
xml_re
l
,
static
int
testCompareParseXML
(
const
char
*
xmcfg
,
const
char
*
xm
l
,
int
xendConfigVersion
)
{
int
xendConfigVersion
)
{
char
xmlData
[
MAX_FILE
];
char
xmlData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
...
@@ -53,11 +54,6 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
...
@@ -53,11 +54,6 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
int
wrote
=
MAX_FILE
;
int
wrote
=
MAX_FILE
;
void
*
old_priv
=
NULL
;
void
*
old_priv
=
NULL
;
struct
_xenUnifiedPrivate
priv
;
struct
_xenUnifiedPrivate
priv
;
char
xmcfg
[
PATH_MAX
];
char
xml
[
PATH_MAX
];
snprintf
(
xmcfg
,
sizeof
xmcfg
-
1
,
"%s/tests/%s"
,
abs_top_srcdir
,
xmcfg_rel
);
snprintf
(
xml
,
sizeof
xml
-
1
,
"%s/tests/%s"
,
abs_top_srcdir
,
xml_rel
);
conn
=
virConnectOpenReadOnly
(
"test:///default"
);
conn
=
virConnectOpenReadOnly
(
"test:///default"
);
if
(
!
conn
)
goto
fail
;
if
(
!
conn
)
goto
fail
;
...
@@ -80,11 +76,8 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
...
@@ -80,11 +76,8 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
goto
fail
;
goto
fail
;
gotxmcfgPtr
[
wrote
]
=
'\0'
;
gotxmcfgPtr
[
wrote
]
=
'\0'
;
if
(
strcmp
(
xmcfgData
,
gotxmcfgData
))
{
if
(
STRNEQ
(
xmcfgData
,
gotxmcfgData
))
{
if
(
getenv
(
"DEBUG_TESTS"
))
{
virtTestDifference
(
stderr
,
xmcfgData
,
gotxmcfgData
);
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
xmcfgData
),
xmcfgData
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
gotxmcfgData
),
gotxmcfgData
);
}
goto
fail
;
goto
fail
;
}
}
...
@@ -102,7 +95,7 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
...
@@ -102,7 +95,7 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
return
ret
;
return
ret
;
}
}
static
int
testCompareFormatXML
(
const
char
*
xmcfg
_rel
,
const
char
*
xml_re
l
,
static
int
testCompareFormatXML
(
const
char
*
xmcfg
,
const
char
*
xm
l
,
int
xendConfigVersion
)
{
int
xendConfigVersion
)
{
char
xmlData
[
MAX_FILE
];
char
xmlData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
...
@@ -114,11 +107,6 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
...
@@ -114,11 +107,6 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
virConnectPtr
conn
;
virConnectPtr
conn
;
void
*
old_priv
;
void
*
old_priv
;
struct
_xenUnifiedPrivate
priv
;
struct
_xenUnifiedPrivate
priv
;
char
xmcfg
[
PATH_MAX
];
char
xml
[
PATH_MAX
];
snprintf
(
xmcfg
,
sizeof
xmcfg
-
1
,
"%s/tests/%s"
,
abs_top_srcdir
,
xmcfg_rel
);
snprintf
(
xml
,
sizeof
xml
-
1
,
"%s/tests/%s"
,
abs_top_srcdir
,
xml_rel
);
conn
=
virConnectOpenReadOnly
(
"test:///default"
);
conn
=
virConnectOpenReadOnly
(
"test:///default"
);
if
(
!
conn
)
goto
fail
;
if
(
!
conn
)
goto
fail
;
...
@@ -163,102 +151,25 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
...
@@ -163,102 +151,25 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
return
ret
;
return
ret
;
}
}
static
int
testCompareParavirtOldPVFBFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-paravirt-old-pvfb.cfg"
,
"xmconfigdata/test-paravirt-old-pvfb.xml"
,
2
);
}
static
int
testCompareParavirtOldPVFBParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-paravirt-old-pvfb.cfg"
,
"xmconfigdata/test-paravirt-old-pvfb.xml"
,
2
);
}
static
int
testCompareParavirtNewPVFBFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-paravirt-new-pvfb.cfg"
,
"xmconfigdata/test-paravirt-new-pvfb.xml"
,
3
);
}
static
int
testCompareParavirtNewPVFBParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-paravirt-new-pvfb.cfg"
,
"xmconfigdata/test-paravirt-new-pvfb.xml"
,
3
);
}
static
int
testCompareFullvirtOldCDROMFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-fullvirt-old-cdrom.cfg"
,
"xmconfigdata/test-fullvirt-old-cdrom.xml"
,
1
);
}
static
int
testCompareFullvirtOldCDROMParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-old-cdrom.cfg"
,
"xmconfigdata/test-fullvirt-old-cdrom.xml"
,
1
);
}
static
int
testCompareFullvirtNewCDROMFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-fullvirt-new-cdrom.cfg"
,
"xmconfigdata/test-fullvirt-new-cdrom.xml"
,
2
);
}
static
int
testCompareFullvirtNewCDROMParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-new-cdrom.cfg"
,
"xmconfigdata/test-fullvirt-new-cdrom.xml"
,
2
);
}
static
int
testCompareFullvirtClockUTCFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-fullvirt-utc.cfg"
,
"xmconfigdata/test-fullvirt-utc.xml"
,
2
);
}
static
int
testCompareFullvirtClockUTCParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
struct
testInfo
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-utc.cfg"
,
const
char
*
name
;
"xmconfigdata/test-fullvirt-utc.xml"
,
int
version
;
2
);
int
mode
;
}
};
static
int
testCompareFullvirtClockLocaltimeFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-fullvirt-localtime.cfg"
,
"xmconfigdata/test-fullvirt-localtime.xml"
,
2
);
}
static
int
testCompareFullvirtClockLocaltimeParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-localtime.cfg"
,
"xmconfigdata/test-fullvirt-localtime.xml"
,
2
);
}
static
int
testCompareFullvirtInputUSBTabletFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFormatXML
(
"xmconfigdata/test-fullvirt-usbtablet.cfg"
,
"xmconfigdata/test-fullvirt-usbtablet.xml"
,
2
);
}
static
int
testCompareFullvirtInputUSBTabletParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
static
int
testCompareHelper
(
const
void
*
data
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbtablet.cfg"
,
const
struct
testInfo
*
info
=
data
;
"xmconfigdata/test-fullvirt-usbtablet.xml"
,
char
xml
[
PATH_MAX
];
2
);
char
cfg
[
PATH_MAX
];
}
snprintf
(
xml
,
PATH_MAX
,
"%s/xmconfigdata/test-%s.xml"
,
abs_srcdir
,
info
->
name
);
static
int
testCompareFullvirtInputUSBTabletNoBusParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
snprintf
(
cfg
,
PATH_MAX
,
"%s/xmconfigdata/test-%s.cfg"
,
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbtablet.cfg"
,
abs_srcdir
,
info
->
name
);
"xmconfigdata/test-fullvirt-usbtablet-no-bus.xml"
,
if
(
info
->
mode
==
0
)
2
);
return
testCompareParseXML
(
cfg
,
xml
,
info
->
version
);
}
else
return
testCompareFormatXML
(
cfg
,
xml
,
info
->
version
);
static
int
testCompareFullvirtInputUSBMouseFormat
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbmouse.cfg"
,
"xmconfigdata/test-fullvirt-usbmouse.xml"
,
2
);
}
static
int
testCompareFullvirtInputUSBMouseParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbmouse.cfg"
,
"xmconfigdata/test-fullvirt-usbmouse.xml"
,
2
);
}
}
...
@@ -266,6 +177,7 @@ int
...
@@ -266,6 +177,7 @@ int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
int
ret
=
0
;
int
ret
=
0
;
char
cwd
[
PATH_MAX
];
progname
=
argv
[
0
];
progname
=
argv
[
0
];
...
@@ -274,65 +186,31 @@ main(int argc, char **argv)
...
@@ -274,65 +186,31 @@ main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
abs_top_srcdir
=
getenv
(
"abs_top_srcdir"
);
abs_srcdir
=
getenv
(
"abs_srcdir"
);
if
(
!
abs_top_srcdir
)
if
(
!
abs_srcdir
)
return
1
;
abs_srcdir
=
getcwd
(
cwd
,
sizeof
(
cwd
));
/* Config -> XML */
if
(
virtTestRun
(
"Paravirt old PVFB (Format)"
,
#define DO_TEST(name, version) \
1
,
testCompareParavirtOldPVFBFormat
,
NULL
)
!=
0
)
do { \
ret
=
-
1
;
struct testInfo info0 = { name, version, 0 }; \
if
(
virtTestRun
(
"Paravirt new PVFB (Format)"
,
struct testInfo info1 = { name, version, 1 }; \
1
,
testCompareParavirtNewPVFBFormat
,
NULL
)
!=
0
)
if (virtTestRun("Xen XM-2-XML Parse " name, \
ret
=
-
1
;
1, testCompareHelper, &info0) < 0) \
if
(
virtTestRun
(
"Fullvirt old PVFB (Format)"
,
ret = -1; \
1
,
testCompareFullvirtOldCDROMFormat
,
NULL
)
!=
0
)
if (virtTestRun("Xen XM-2-XML Format " name, \
ret
=
-
1
;
1, testCompareHelper, &info1) < 0) \
if
(
virtTestRun
(
"Fullvirt new PVFB (Format)"
,
ret = -1; \
1
,
testCompareFullvirtNewCDROMFormat
,
NULL
)
!=
0
)
} while (0)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt clock Localtime (Format)"
,
DO_TEST
(
"paravirt-old-pvfb"
,
2
);
1
,
testCompareFullvirtClockLocaltimeFormat
,
NULL
)
!=
0
)
DO_TEST
(
"paravirt-new-pvfb"
,
3
);
ret
=
-
1
;
DO_TEST
(
"fullvirt-old-cdrom"
,
1
);
if
(
virtTestRun
(
"Fullvirt clock UTC (Format)"
,
DO_TEST
(
"fullvirt-new-cdrom"
,
2
);
1
,
testCompareFullvirtClockUTCFormat
,
NULL
)
!=
0
)
DO_TEST
(
"fullvirt-utc"
,
2
);
ret
=
-
1
;
DO_TEST
(
"fullvirt-localtime"
,
2
);
if
(
virtTestRun
(
"Fullvirt USB mouse (Format)"
,
DO_TEST
(
"fullvirt-usbtablet"
,
2
);
1
,
testCompareFullvirtInputUSBMouseFormat
,
NULL
)
!=
0
)
DO_TEST
(
"fullvirt-usbmouse"
,
2
);
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt USB tablet (Format)"
,
1
,
testCompareFullvirtInputUSBTabletFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
/* XML -> Config */
if
(
virtTestRun
(
"Paravirt old PVFB (Parse)"
,
1
,
testCompareParavirtOldPVFBParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Paravirt new PVFB (Parse)"
,
1
,
testCompareParavirtNewPVFBParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt old PVFB (Parse)"
,
1
,
testCompareFullvirtOldCDROMParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt new PVFB (Parse)"
,
1
,
testCompareFullvirtNewCDROMParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt clock Localtime (Parse)"
,
1
,
testCompareFullvirtClockLocaltimeParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt clock UTC (Parse)"
,
1
,
testCompareFullvirtClockUTCParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt USB mouse (Parse)"
,
1
,
testCompareFullvirtInputUSBMouseParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt USB tablet (Parse)"
,
1
,
testCompareFullvirtInputUSBTabletParse
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt USB tablet no bus (Parse)"
,
1
,
testCompareFullvirtInputUSBTabletNoBusParse
,
NULL
)
!=
0
)
ret
=
-
1
;
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录