Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
6d8331fd
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看板
提交
6d8331fd
编写于
10月 09, 2009
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: Add network XML to XML tests.
上级
40274618
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
194 addition
and
4 deletion
+194
-4
tests/.gitignore
tests/.gitignore
+1
-0
tests/Makefile.am
tests/Makefile.am
+11
-1
tests/networkschematest
tests/networkschematest
+1
-2
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/isolated-network.xml
+10
-0
tests/networkxml2xmlin/nat-network.xml
tests/networkxml2xmlin/nat-network.xml
+13
-0
tests/networkxml2xmlin/netboot-network.xml
tests/networkxml2xmlin/netboot-network.xml
+3
-1
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlin/routed-network.xml
+11
-0
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/isolated-network.xml
+10
-0
tests/networkxml2xmlout/nat-network.xml
tests/networkxml2xmlout/nat-network.xml
+13
-0
tests/networkxml2xmlout/netboot-network.xml
tests/networkxml2xmlout/netboot-network.xml
+14
-0
tests/networkxml2xmlout/routed-network.xml
tests/networkxml2xmlout/routed-network.xml
+11
-0
tests/networkxml2xmltest.c
tests/networkxml2xmltest.c
+96
-0
未找到文件。
tests/.gitignore
浏览文件 @
6d8331fd
...
...
@@ -13,6 +13,7 @@ qemuxml2xmltest
qemuxml2argvtest
qemuargv2xmltest
qemuhelptest
networkxml2xmltest
nodedevxml2xmltest
interfacexml2xmltest
storagepoolxml2xmltest
...
...
tests/Makefile.am
浏览文件 @
6d8331fd
...
...
@@ -56,7 +56,8 @@ EXTRA_DIST = \
capabilityschematest
\
capabilityschemadata
\
networkschematest
\
networkschemadata
\
networkpoolxml2xmlout
\
networkpoolxml2xmlin
\
domainschematest
\
domainschemadata
\
interfaceschemadata
\
...
...
@@ -96,6 +97,8 @@ if WITH_CIL
noinst_PROGRAMS
+=
object-locking
endif
noinst_PROGRAMS
+=
networkxml2xmltest
noinst_PROGRAMS
+=
storagepoolxml2xmltest
noinst_PROGRAMS
+=
nodedevxml2xmltest
...
...
@@ -171,6 +174,8 @@ noinst_PROGRAMS += eventtest
TESTS
+=
eventtest
endif
TESTS
+=
networkxml2xmltest
TESTS
+=
storagepoolxml2xmltest
TESTS
+=
nodedevxml2xmltest
...
...
@@ -269,6 +274,11 @@ else
EXTRA_DIST
+=
esxutilstest.c vmx2xmltest.c xml2vmxtest.c
endif
networkxml2xmltest_SOURCES
=
\
networkxml2xmltest.c
\
testutils.c testutils.h
networkxml2xmltest_LDADD
=
$(LDADDS)
storagepoolxml2xmltest_SOURCES
=
\
storagepoolxml2xmltest.c
\
testutils.c testutils.h
...
...
tests/networkschematest
浏览文件 @
6d8331fd
...
...
@@ -2,8 +2,7 @@
source
./schematestutils.sh
DIRS
=
"../src/network network
schemadata
"
DIRS
=
"../src/network network
xml2xmlin networkxml2xmlout
"
SCHEMA
=
"network.rng"
check_schema
"
$DIRS
"
"
$SCHEMA
"
tests/networkxml2xmlin/isolated-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
private
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<bridge
name=
"virbr2"
/>
<ip
address=
"192.168.152.1"
netmask=
"255.255.255.0"
>
<dhcp>
<range
start=
"192.168.152.2"
end=
"192.168.152.254"
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmlin/nat-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
default
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<bridge
name=
"virbr0"
/>
<forward
mode=
"nat"
dev=
"eth1"
/>
<ip
address=
"192.168.122.1"
netmask=
"255.255.255.0"
>
<dhcp>
<range
start=
"192.168.122.2"
end=
"192.168.122.254"
/>
<host
mac=
"00:16:3e:77:e2:ed"
name=
"a.example.com"
ip=
"192.168.122.10"
/>
<host
mac=
"00:16:3e:3e:a9:1a"
name=
"b.example.com"
ip=
"192.168.122.11"
/>
</dhcp>
</ip>
</network>
tests/network
schemadata
/netboot-network.xml
→
tests/network
xml2xmlin
/netboot-network.xml
浏览文件 @
6d8331fd
<network>
<name>
netboot
</name>
<bridge
name=
"virbr1"
/>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<bridge
name=
"virbr1"
stp=
'off'
delay=
'1'
/>
<domain
name=
"example.com"
/>
<forward/>
<ip
address=
"192.168.122.1"
netmask=
"255.255.255.0"
>
<tftp
root=
"/var/lib/tftproot"
/>
...
...
tests/networkxml2xmlin/routed-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
local
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<bridge
name=
"virbr1"
/>
<forward
mode=
"route"
dev=
"eth1"
/>
<ip
address=
"192.168.122.1"
netmask=
"255.255.255.0"
>
<dhcp>
<range
start=
"192.168.122.2"
end=
"192.168.122.254"
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmlout/isolated-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
private
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<bridge
name=
'virbr2'
stp=
'on'
delay=
'0'
/>
<ip
address=
'192.168.152.1'
netmask=
'255.255.255.0'
>
<dhcp>
<range
start=
'192.168.152.2'
end=
'192.168.152.254'
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmlout/nat-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
default
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<forward
dev=
'eth1'
mode=
'nat'
/>
<bridge
name=
'virbr0'
stp=
'on'
delay=
'0'
/>
<ip
address=
'192.168.122.1'
netmask=
'255.255.255.0'
>
<dhcp>
<range
start=
'192.168.122.2'
end=
'192.168.122.254'
/>
<host
mac=
'00:16:3e:77:e2:ed'
name=
'a.example.com'
ip=
'192.168.122.10'
/>
<host
mac=
'00:16:3e:3e:a9:1a'
name=
'b.example.com'
ip=
'192.168.122.11'
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmlout/netboot-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
netboot
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<forward
mode=
'nat'
/>
<bridge
name=
'virbr1'
stp=
'off'
delay=
'1'
/>
<domain
name=
'example.com'
/>
<ip
address=
'192.168.122.1'
netmask=
'255.255.255.0'
>
<tftp
root=
'/var/lib/tftproot'
/>
<dhcp>
<range
start=
'192.168.122.2'
end=
'192.168.122.254'
/>
<bootp
file=
'pxeboot.img'
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmlout/routed-network.xml
0 → 100644
浏览文件 @
6d8331fd
<network>
<name>
local
</name>
<uuid>
81ff0d90-c91e-6742-64da-4a736edb9a9b
</uuid>
<forward
dev=
'eth1'
mode=
'route'
/>
<bridge
name=
'virbr1'
stp=
'on'
delay=
'0'
/>
<ip
address=
'192.168.122.1'
netmask=
'255.255.255.0'
>
<dhcp>
<range
start=
'192.168.122.2'
end=
'192.168.122.254'
/>
</dhcp>
</ip>
</network>
tests/networkxml2xmltest.c
0 → 100644
浏览文件 @
6d8331fd
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include "internal.h"
#include "testutils.h"
#include "network_conf.h"
#include "testutilsqemu.h"
static
char
*
progname
;
static
char
*
abs_srcdir
;
#define MAX_FILE 4096
static
int
testCompareXMLToXMLFiles
(
const
char
*
inxml
,
const
char
*
outxml
)
{
char
inXmlData
[
MAX_FILE
];
char
*
inXmlPtr
=
&
(
inXmlData
[
0
]);
char
outXmlData
[
MAX_FILE
];
char
*
outXmlPtr
=
&
(
outXmlData
[
0
]);
char
*
actual
=
NULL
;
int
ret
=
-
1
;
virNetworkDefPtr
dev
=
NULL
;
if
(
virtTestLoadFile
(
inxml
,
&
inXmlPtr
,
MAX_FILE
)
<
0
)
goto
fail
;
if
(
virtTestLoadFile
(
outxml
,
&
outXmlPtr
,
MAX_FILE
)
<
0
)
goto
fail
;
if
(
!
(
dev
=
virNetworkDefParseString
(
NULL
,
inXmlData
)))
goto
fail
;
if
(
!
(
actual
=
virNetworkDefFormat
(
NULL
,
dev
)))
goto
fail
;
if
(
STRNEQ
(
outXmlData
,
actual
))
{
virtTestDifference
(
stderr
,
outXmlData
,
actual
);
goto
fail
;
}
ret
=
0
;
fail:
free
(
actual
);
virNetworkDefFree
(
dev
);
return
ret
;
}
static
int
testCompareXMLToXMLHelper
(
const
void
*
data
)
{
char
inxml
[
PATH_MAX
];
char
outxml
[
PATH_MAX
];
snprintf
(
inxml
,
PATH_MAX
,
"%s/networkxml2xmlin/%s.xml"
,
abs_srcdir
,
(
const
char
*
)
data
);
snprintf
(
outxml
,
PATH_MAX
,
"%s/networkxml2xmlout/%s.xml"
,
abs_srcdir
,
(
const
char
*
)
data
);
return
testCompareXMLToXMLFiles
(
inxml
,
outxml
);
}
static
int
mymain
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
char
cwd
[
PATH_MAX
];
progname
=
argv
[
0
];
if
(
argc
>
1
)
{
fprintf
(
stderr
,
"Usage: %s
\n
"
,
progname
);
return
(
EXIT_FAILURE
);
}
abs_srcdir
=
getenv
(
"abs_srcdir"
);
if
(
!
abs_srcdir
)
abs_srcdir
=
getcwd
(
cwd
,
sizeof
(
cwd
));
#define DO_TEST(name) \
if (virtTestRun("Network XML-2-XML " name, \
1, testCompareXMLToXMLHelper, (name)) < 0) \
ret = -1
DO_TEST
(
"isolated-network"
);
DO_TEST
(
"routed-network"
);
DO_TEST
(
"nat-network"
);
DO_TEST
(
"netboot-network"
);
return
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
}
VIRT_TEST_MAIN
(
mymain
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录