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>
* 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
TESTS_ENVIRONMENT
=
\
abs_top_builddir
=
`
cd
'
$(top_builddir)
'
;
pwd
`
\
abs_top_srcdir
=
`
cd
'
$(top_srcdir)
'
;
pwd
`
\
abs_builddir
=
`
cd
'
$(builddir)
'
;
pwd
`
\
abs_srcdir
=
`
cd
'
$(srcdir)
'
;
pwd
`
\
PATH
=
"
$(path_add)$(PATH_SEPARATOR)$$
PATH"
\
SHELL
=
"
$(SHELL)
"
\
$(VG)
...
...
tests/statstest.c
浏览文件 @
94353ef6
...
...
@@ -7,6 +7,8 @@
#include "stats_linux.h"
#include "internal.h"
#include "testutils.h"
#if WITH_XEN
static
void
testQuietError
(
void
*
userData
ATTRIBUTE_UNUSED
,
virErrorPtr
error
ATTRIBUTE_UNUSED
)
...
...
@@ -21,13 +23,26 @@ static int testDevice(const char *path, int expect)
int
actual
=
xenLinuxDomainDeviceID
(
NULL
,
1
,
path
);
if
(
actual
==
expect
)
{
fprintf
(
stderr
,
"%-14s == %-6d OK
\n
"
,
path
,
expect
);
return
0
;
}
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
;
}
}
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
int
...
...
@@ -42,85 +57,67 @@ main(void)
if
(
!
getenv
(
"DEBUG_TESTS"
))
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
********************************/
/* first valid disk */
if
(
testDevice
(
"xvda"
,
51712
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"xvda1"
,
51713
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"xvda15"
,
51727
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda"
,
51712
);
DO_TEST
(
"xvda1"
,
51713
);
DO_TEST
(
"xvda15"
,
51727
);
/* Last valid disk */
if
(
testDevice
(
"xvdp"
,
51952
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"xvdp1"
,
51953
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"xvdp15"
,
51967
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvdp"
,
51952
);
DO_TEST
(
"xvdp1"
,
51953
);
DO_TEST
(
"xvdp15"
,
51967
);
/* Disk letter to large */
if
(
testDevice
(
"xvdq"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvdq"
,
-
1
);
/* missing disk letter */
if
(
testDevice
(
"xvd1"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvd1"
,
-
1
);
/* partition to large */
if
(
testDevice
(
"xvda16"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda16"
,
-
1
);
/* partition to small */
if
(
testDevice
(
"xvda0"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda0"
,
-
1
);
/* leading zeros */
if
(
testDevice
(
"xvda01"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda01"
,
-
1
);
/* leading + */
if
(
testDevice
(
"xvda+1"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda+1"
,
-
1
);
/* leading - */
if
(
testDevice
(
"xvda-1"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"xvda-1"
,
-
1
);
/********************************
* IDE disks
********************************/
/* odd numbered disk */
if
(
testDevice
(
"hda"
,
768
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hda1"
,
769
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hda63"
,
831
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hda"
,
768
);
DO_TEST
(
"hda1"
,
769
);
DO_TEST
(
"hda63"
,
831
);
/* even number disk */
if
(
testDevice
(
"hdd"
,
5695
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hdd1"
,
5696
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hdd63"
,
5758
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hdd"
,
5695
);
DO_TEST
(
"hdd1"
,
5696
);
DO_TEST
(
"hdd63"
,
5758
);
/* last valid disk */
if
(
testDevice
(
"hdt"
,
23359
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hdt1"
,
23360
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"hdt63"
,
23422
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hdt"
,
23359
);
DO_TEST
(
"hdt1"
,
23360
);
DO_TEST
(
"hdt63"
,
23422
);
/* Disk letter to large */
if
(
testDevice
(
"hdu"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hdu"
,
-
1
);
/* missing disk letter */
if
(
testDevice
(
"hd1"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hd1"
,
-
1
);
/* partition to large */
if
(
testDevice
(
"hda64"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hda64"
,
-
1
);
/* partition to small */
if
(
testDevice
(
"hda0"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"hda0"
,
-
1
);
...
...
@@ -129,89 +126,55 @@ main(void)
********************************/
/* first valid disk */
if
(
testDevice
(
"sda"
,
2048
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sda1"
,
2049
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sda15"
,
2063
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sda"
,
2048
);
DO_TEST
(
"sda1"
,
2049
);
DO_TEST
(
"sda15"
,
2063
);
/* last valid disk of first SCSI major number */
if
(
testDevice
(
"sdp"
,
2288
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdp1"
,
2289
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdp15"
,
2303
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdp"
,
2288
);
DO_TEST
(
"sdp1"
,
2289
);
DO_TEST
(
"sdp15"
,
2303
);
/* first valid disk of second SCSI major number */
if
(
testDevice
(
"sdq"
,
16640
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdq1"
,
16641
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdq15"
,
16655
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdq"
,
16640
);
DO_TEST
(
"sdq1"
,
16641
);
DO_TEST
(
"sdq15"
,
16655
);
/* last valid single letter disk */
if
(
testDevice
(
"sdz"
,
16784
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdz1"
,
16785
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdz15"
,
16799
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdz"
,
16784
);
DO_TEST
(
"sdz1"
,
16785
);
DO_TEST
(
"sdz15"
,
16799
);
/* first valid dual letter disk */
if
(
testDevice
(
"sdaa"
,
16800
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdaa1"
,
16801
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdaa15"
,
16815
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdaa"
,
16800
);
DO_TEST
(
"sdaa1"
,
16801
);
DO_TEST
(
"sdaa15"
,
16815
);
/* second valid dual letter disk */
if
(
testDevice
(
"sdab"
,
16816
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdab1"
,
16817
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdab15"
,
16831
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdab"
,
16816
);
DO_TEST
(
"sdab1"
,
16817
);
DO_TEST
(
"sdab15"
,
16831
);
/* first letter of second sequence of dual letter disk */
if
(
testDevice
(
"sdba"
,
17216
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdba1"
,
17217
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdba15"
,
17231
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdba"
,
17216
);
DO_TEST
(
"sdba1"
,
17217
);
DO_TEST
(
"sdba15"
,
17231
);
/* last valid dual letter disk */
if
(
testDevice
(
"sdiv"
,
34800
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdiv1"
,
34801
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"sdiv15"
,
34815
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdiv"
,
34800
);
DO_TEST
(
"sdiv1"
,
34801
);
DO_TEST
(
"sdiv15"
,
34815
);
/* Disk letter to large */
if
(
testDevice
(
"sdix"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sdix"
,
-
1
);
/* missing disk letter */
if
(
testDevice
(
"sd1"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sd1"
,
-
1
);
/* partition to large */
if
(
testDevice
(
"sda16"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sda16"
,
-
1
);
/* partition to small */
if
(
testDevice
(
"sda0"
,
-
1
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"sda0"
,
-
1
);
/* Path stripping */
if
(
testDevice
(
"/dev"
,
-
1
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/"
,
-
1
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvd"
,
-
1
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvda"
,
51712
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvda1"
,
51713
)
<
0
)
ret
=
-
1
;
if
(
testDevice
(
"/dev/xvda15"
,
51727
)
<
0
)
ret
=
-
1
;
DO_TEST
(
"/dev"
,
-
1
);
DO_TEST
(
"/dev/"
,
-
1
);
DO_TEST
(
"/dev/xvd"
,
-
1
);
DO_TEST
(
"/dev/xvda"
,
51712
);
DO_TEST
(
"/dev/xvda1"
,
51713
);
DO_TEST
(
"/dev/xvda15"
,
51727
);
#endif
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
...
...
tests/test_conf.sh
浏览文件 @
94353ef6
#!/bin/bash
set
-x
NOK
=
0
for
f
in
$abs_top_srcdir
/tests/confdata/
*
.conf
#!/bin/sh
if
test
"
$VERBOSE
"
=
yes
;
then
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
./conftest
$f
>
conftest.
$$
outfile
=
`
echo
"
$f
"
|
sed
s+
\.
conf
$+
\.
out+
`
diff
$outfile
conftest.
$$
>
/dev/null
if
[
$?
!=
0
]
then
if
[
-n
"
$DEBUG_TESTS
"
]
;
then
diff
-u
$outfile
conftest.
$$
fi
echo
"
$f
FAILED"
NOK
=
1
"
$abs_builddir
/conftest"
"
$data_dir
/
$f
"
>
"
$f
-actual"
expected
=
"
$data_dir
"
/
`
echo
"
$f
"
|
sed
s+
\.
conf
$+
\.
out+
`
if
compare
"
$expected
"
"
$f
-actual"
;
then
msg
=
OK
else
echo
"
$f
OK"
msg
=
FAILED
fail
=
1
fi
printf
"%2d) %-60s ... %s
\n
"
$i
"
$f
"
$msg
i
=
`
expr
$i
+ 1
`
done
rm
-f
conftest.
$$
exit
$NOK
(
exit
$fail
)
;
exit
$fail
tests/xencapstest.c
浏览文件 @
94353ef6
...
...
@@ -50,14 +50,10 @@ static int testCompareFiles(const char *hostmachine,
if
(
!
(
actualxml
=
xenHypervisorMakeCapabilitiesXML
(
NULL
,
hostmachine
,
fp1
,
fp2
)))
goto
fail
;
if
(
getenv
(
"DEBUG_TESTS"
)
&&
STRNEQ
(
expectxml
,
actualxml
))
{
printf
(
"In test file %s:
\n
"
,
capabilities
);
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
expectxml
),
expectxml
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
actualxml
),
actualxml
);
if
(
STRNEQ
(
expectxml
,
actualxml
))
{
virtTestDifference
(
stderr
,
expectxml
,
actualxml
);
goto
fail
;
}
if
(
strcmp
(
expectxml
,
actualxml
))
goto
fail
;
ret
=
0
;
...
...
tests/xmconfigtest.c
浏览文件 @
94353ef6
...
...
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifdef WITH_XEN
...
...
@@ -35,11 +36,11 @@
#include "conf.h"
static
char
*
progname
;
static
char
*
abs_
top_
srcdir
;
static
char
*
abs_srcdir
;
#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
)
{
char
xmlData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
...
...
@@ -53,11 +54,6 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
int
wrote
=
MAX_FILE
;
void
*
old_priv
=
NULL
;
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"
);
if
(
!
conn
)
goto
fail
;
...
...
@@ -80,11 +76,8 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
goto
fail
;
gotxmcfgPtr
[
wrote
]
=
'\0'
;
if
(
strcmp
(
xmcfgData
,
gotxmcfgData
))
{
if
(
getenv
(
"DEBUG_TESTS"
))
{
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
xmcfgData
),
xmcfgData
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
gotxmcfgData
),
gotxmcfgData
);
}
if
(
STRNEQ
(
xmcfgData
,
gotxmcfgData
))
{
virtTestDifference
(
stderr
,
xmcfgData
,
gotxmcfgData
);
goto
fail
;
}
...
...
@@ -102,7 +95,7 @@ static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
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
)
{
char
xmlData
[
MAX_FILE
];
char
xmcfgData
[
MAX_FILE
];
...
...
@@ -114,11 +107,6 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
virConnectPtr
conn
;
void
*
old_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"
);
if
(
!
conn
)
goto
fail
;
...
...
@@ -163,102 +151,25 @@ static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
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
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-utc.cfg"
,
"xmconfigdata/test-fullvirt-utc.xml"
,
2
);
}
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
);
}
struct
testInfo
{
const
char
*
name
;
int
version
;
int
mode
;
};
static
int
testCompareFullvirtInputUSBTabletParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbtablet.cfg"
,
"xmconfigdata/test-fullvirt-usbtablet.xml"
,
2
);
}
static
int
testCompareFullvirtInputUSBTabletNoBusParse
(
const
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareParseXML
(
"xmconfigdata/test-fullvirt-usbtablet.cfg"
,
"xmconfigdata/test-fullvirt-usbtablet-no-bus.xml"
,
2
);
}
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
);
static
int
testCompareHelper
(
const
void
*
data
)
{
const
struct
testInfo
*
info
=
data
;
char
xml
[
PATH_MAX
];
char
cfg
[
PATH_MAX
];
snprintf
(
xml
,
PATH_MAX
,
"%s/xmconfigdata/test-%s.xml"
,
abs_srcdir
,
info
->
name
);
snprintf
(
cfg
,
PATH_MAX
,
"%s/xmconfigdata/test-%s.cfg"
,
abs_srcdir
,
info
->
name
);
if
(
info
->
mode
==
0
)
return
testCompareParseXML
(
cfg
,
xml
,
info
->
version
);
else
return
testCompareFormatXML
(
cfg
,
xml
,
info
->
version
);
}
...
...
@@ -266,6 +177,7 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
char
cwd
[
PATH_MAX
];
progname
=
argv
[
0
];
...
...
@@ -274,65 +186,31 @@ main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
}
abs_top_srcdir
=
getenv
(
"abs_top_srcdir"
);
if
(
!
abs_top_srcdir
)
return
1
;
/* Config -> XML */
if
(
virtTestRun
(
"Paravirt old PVFB (Format)"
,
1
,
testCompareParavirtOldPVFBFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Paravirt new PVFB (Format)"
,
1
,
testCompareParavirtNewPVFBFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt old PVFB (Format)"
,
1
,
testCompareFullvirtOldCDROMFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt new PVFB (Format)"
,
1
,
testCompareFullvirtNewCDROMFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt clock Localtime (Format)"
,
1
,
testCompareFullvirtClockLocaltimeFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt clock UTC (Format)"
,
1
,
testCompareFullvirtClockUTCFormat
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"Fullvirt USB mouse (Format)"
,
1
,
testCompareFullvirtInputUSBMouseFormat
,
NULL
)
!=
0
)
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
;
abs_srcdir
=
getenv
(
"abs_srcdir"
);
if
(
!
abs_srcdir
)
abs_srcdir
=
getcwd
(
cwd
,
sizeof
(
cwd
));
#define DO_TEST(name, version) \
do { \
struct testInfo info0 = { name, version, 0 }; \
struct testInfo info1 = { name, version, 1 }; \
if (virtTestRun("Xen XM-2-XML Parse " name, \
1, testCompareHelper, &info0) < 0) \
ret = -1; \
if (virtTestRun("Xen XM-2-XML Format " name, \
1, testCompareHelper, &info1) < 0) \
ret = -1; \
} while (0)
DO_TEST
(
"paravirt-old-pvfb"
,
2
);
DO_TEST
(
"paravirt-new-pvfb"
,
3
);
DO_TEST
(
"fullvirt-old-cdrom"
,
1
);
DO_TEST
(
"fullvirt-new-cdrom"
,
2
);
DO_TEST
(
"fullvirt-utc"
,
2
);
DO_TEST
(
"fullvirt-localtime"
,
2
);
DO_TEST
(
"fullvirt-usbtablet"
,
2
);
DO_TEST
(
"fullvirt-usbmouse"
,
2
);
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录