Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
49956f04
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49956f04
编写于
4月 25, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement serial & parallel device support for QEMU driver
上级
d62a9f23
变更
45
展开全部
显示空白变更内容
内联
并排
Showing
45 changed file
with
1216 addition
and
197 deletion
+1216
-197
ChangeLog
ChangeLog
+13
-1
src/internal.h
src/internal.h
+4
-0
src/qemu_conf.c
src/qemu_conf.c
+642
-6
src/qemu_conf.h
src/qemu_conf.h
+57
-3
src/qemu_driver.c
src/qemu_driver.c
+58
-19
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-boot-network.args
tests/qemuxml2argvdata/qemuxml2argv-boot-network.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-console-compat.args
tests/qemuxml2argvdata/qemuxml2argv-console-compat.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
+28
-0
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-disk-many.args
tests/qemuxml2argvdata/qemuxml2argv-disk-many.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-minimal.args
tests/qemuxml2argvdata/qemuxml2argv-minimal.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-net-user.args
tests/qemuxml2argvdata/qemuxml2argv-net-user.args
+1
-1
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
+27
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
+30
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-file.args
tests/qemuxml2argvdata/qemuxml2argv-serial-file.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
+30
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-many.args
tests/qemuxml2argvdata/qemuxml2argv-serial-many.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
+32
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
+28
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
+32
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
+32
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
+32
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
+30
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
+28
-0
tests/qemuxml2argvtest.c
tests/qemuxml2argvtest.c
+44
-77
tests/qemuxml2xmltest.c
tests/qemuxml2xmltest.c
+42
-75
未找到文件。
ChangeLog
浏览文件 @
49956f04
Fri Apr 25 12:21:28 EST 2008 Daniel P. Berrange <berrange@redhat.coM>
Fri Apr 25 16:45:28 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/internal.c: Convenience macros for fixed arrays
* src/qemu_driver.c: Extract TTY paths for serial and parallel
devices too
* src/qemu_conf.c, src/qemu_conf.h: Support arbitrary serial
and parallel devices.
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests
for serial and parallel devices
* tests/qemuxml2argvdata/*: Updated and added data files for
new test cases
Fri Apr 25 12:21:28 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* docs/page.xsl, docs/libvir.css: Re-arrange layout to workaround
IE6 bugs
...
...
src/internal.h
浏览文件 @
49956f04
...
...
@@ -66,6 +66,10 @@ extern "C" {
#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
/* If configured with --enable-debug=yes then library calls
* are printed to stderr for debugging.
*/
...
...
src/qemu_conf.c
浏览文件 @
49956f04
此差异已折叠。
点击以展开。
src/qemu_conf.h
浏览文件 @
49956f04
...
...
@@ -119,6 +119,54 @@ struct qemud_vm_net_def {
struct
qemud_vm_net_def
*
next
;
};
enum
qemu_vm_chr_dst_type
{
QEMUD_CHR_SRC_TYPE_NULL
,
QEMUD_CHR_SRC_TYPE_VC
,
QEMUD_CHR_SRC_TYPE_PTY
,
QEMUD_CHR_SRC_TYPE_DEV
,
QEMUD_CHR_SRC_TYPE_FILE
,
QEMUD_CHR_SRC_TYPE_PIPE
,
QEMUD_CHR_SRC_TYPE_STDIO
,
QEMUD_CHR_SRC_TYPE_UDP
,
QEMUD_CHR_SRC_TYPE_TCP
,
QEMUD_CHR_SRC_TYPE_UNIX
,
QEMUD_CHR_SRC_TYPE_LAST
,
};
enum
{
QEMUD_CHR_SRC_TCP_PROTOCOL_RAW
,
QEMUD_CHR_SRC_TCP_PROTOCOL_TELNET
,
};
struct
qemud_vm_chr_def
{
int
dstPort
;
int
srcType
;
union
{
struct
{
char
path
[
PATH_MAX
];
}
file
;
/* pty, file, pipe, or device */
struct
{
char
host
[
BR_INET_ADDR_MAXLEN
];
char
service
[
BR_INET_ADDR_MAXLEN
];
int
listen
;
int
protocol
;
}
tcp
;
struct
{
char
bindHost
[
BR_INET_ADDR_MAXLEN
];
char
bindService
[
BR_INET_ADDR_MAXLEN
];
char
connectHost
[
BR_INET_ADDR_MAXLEN
];
char
connectService
[
BR_INET_ADDR_MAXLEN
];
}
udp
;
struct
{
char
path
[
PATH_MAX
];
int
listen
;
}
nix
;
}
srcData
;
struct
qemud_vm_chr_def
*
next
;
};
enum
qemu_vm_input_type
{
QEMU_INPUT_TYPE_MOUSE
,
...
...
@@ -215,14 +263,20 @@ struct qemud_vm_def {
char
vncListen
[
BR_INET_ADDR_MAXLEN
];
char
*
keymap
;
int
ndisks
;
unsigned
int
ndisks
;
struct
qemud_vm_disk_def
*
disks
;
int
nnets
;
unsigned
int
nnets
;
struct
qemud_vm_net_def
*
nets
;
int
ninputs
;
unsigned
int
ninputs
;
struct
qemud_vm_input_def
*
inputs
;
unsigned
int
nserials
;
struct
qemud_vm_chr_def
*
serials
;
unsigned
int
nparallels
;
struct
qemud_vm_chr_def
*
parallels
;
};
/* Guest VM runtime state */
...
...
src/qemu_driver.c
浏览文件 @
49956f04
...
...
@@ -381,7 +381,6 @@ qemudReadMonitorOutput(virConnectPtr conn,
const
char
*
what
)
{
#define MONITOR_TIMEOUT 3000
int
got
=
0
;
buf
[
0
]
=
'\0'
;
...
...
@@ -498,48 +497,88 @@ static int qemudOpenMonitor(virConnectPtr conn,
return
ret
;
}
static
int
qemudExtractMonitorPath
(
const
char
*
haystack
,
char
*
path
,
int
pathmax
)
{
static
int
qemudExtractMonitorPath
(
const
char
*
haystack
,
size_t
*
offset
,
char
*
path
,
int
pathmax
)
{
static
const
char
needle
[]
=
"char device redirected to"
;
char
*
tmp
;
if
(
!
(
tmp
=
strstr
(
haystack
,
needle
)))
/* First look for our magic string */
if
(
!
(
tmp
=
strstr
(
haystack
+
*
offset
,
needle
)))
return
-
1
;
/* Grab all the trailing data */
strncpy
(
path
,
tmp
+
sizeof
(
needle
),
pathmax
-
1
);
path
[
pathmax
-
1
]
=
'\0'
;
while
(
*
path
)
{
/*
* The monitor path ends at first whitespace char
* so lets search for it & NULL terminate it there
* And look for first whitespace character and nul terminate
* to mark end of the pty path
*/
if
(
isspace
(
to_uchar
(
*
path
)))
{
*
path
=
'\0'
;
tmp
=
path
;
while
(
*
tmp
)
{
if
(
isspace
(
to_uchar
(
*
tmp
)))
{
*
tmp
=
'\0'
;
*
offset
+=
(
sizeof
(
needle
)
-
1
)
+
strlen
(
path
);
return
0
;
}
path
++
;
tmp
++
;
}
/*
* We found a path, but didn't find any whitespace,
* so it must be still incomplete - we should at
* least see a \n
* least see a \n - indicate that we want to carry
* on trying again
*/
return
-
1
;
}
static
int
qemud
OpenMonitorPath
(
virConnectPtr
conn
,
qemud
FindCharDevicePTYs
(
virConnectPtr
conn
,
struct
qemud_driver
*
driver
,
struct
qemud_vm
*
vm
,
const
char
*
output
,
int
fd
ATTRIBUTE_UNUSED
)
{
char
monitor
[
PATH_MAX
];
size_t
offset
=
0
;
struct
qemud_vm_chr_def
*
chr
;
/* The order in which QEMU prints out the PTY paths is
the order in which it procsses its monitor, serial
and parallel device args. This code must match that
ordering.... */
/* So first comes the monitor device */
if
(
qemudExtractMonitorPath
(
output
,
&
offset
,
monitor
,
sizeof
(
monitor
))
<
0
)
return
1
;
/* keep reading */
if
(
qemudExtractMonitorPath
(
output
,
monitor
,
sizeof
(
monitor
))
<
0
)
/* then the serial devices */
chr
=
vm
->
def
->
serials
;
while
(
chr
)
{
if
(
chr
->
srcType
==
QEMUD_CHR_SRC_TYPE_PTY
)
{
if
(
qemudExtractMonitorPath
(
output
,
&
offset
,
chr
->
srcData
.
file
.
path
,
sizeof
(
chr
->
srcData
.
file
.
path
))
<
0
)
return
1
;
/* keep reading */
}
chr
=
chr
->
next
;
}
/* and finally the parallel devices */
chr
=
vm
->
def
->
parallels
;
while
(
chr
)
{
if
(
chr
->
srcType
==
QEMUD_CHR_SRC_TYPE_PTY
)
{
if
(
qemudExtractMonitorPath
(
output
,
&
offset
,
chr
->
srcData
.
file
.
path
,
sizeof
(
chr
->
srcData
.
file
.
path
))
<
0
)
return
1
;
/* keep reading */
}
chr
=
chr
->
next
;
}
/* Got them all, so now open the monitor console */
return
qemudOpenMonitor
(
conn
,
driver
,
vm
,
monitor
);
}
...
...
@@ -550,7 +589,7 @@ static int qemudWaitForMonitor(virConnectPtr conn,
int
ret
=
qemudReadMonitorOutput
(
conn
,
driver
,
vm
,
vm
->
stderr
,
buf
,
sizeof
(
buf
),
qemud
OpenMonitorPath
,
qemud
FindCharDevicePTYs
,
"console"
);
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
...
...
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-boot-network.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-console-compat.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'pty'
>
<target
port=
'0'
/>
</serial>
<console
type=
'pty'
>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-disk-many.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -vnc 127.0.0.1:3
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -usbdevice mouse
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice mouse
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb -usbdevice tablet
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice tablet
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-minimal.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-net-user.args
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -usb
\ No newline at end of file
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel tcp:127.0.0.1:9999,listen -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<parallel
type=
'tcp'
>
<source
mode=
'bind'
host=
'127.0.0.1'
service=
'9999'
/>
<protocol
type=
'raw'
/>
<target
port=
'0'
/>
</parallel>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial /dev/ttyS2 -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'dev'
>
<source
path=
'/dev/ttyS2'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'dev'
>
<source
path=
'/dev/ttyS2'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-file.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'file'
>
<source
path=
'/tmp/serial.log'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'file'
>
<source
path=
'/tmp/serial.log'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-many.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'pty'
>
<target
port=
'0'
/>
</serial>
<serial
type=
'file'
>
<source
path=
'/tmp/serial.log'
/>
<target
port=
'1'
/>
</serial>
<console
type=
'pty'
>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'pty'
>
<target
port=
'0'
/>
</serial>
<console
type=
'pty'
>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial telnet:127.0.0.1:9999,listen -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'tcp'
>
<source
mode=
'bind'
host=
'127.0.0.1'
service=
'9999'
/>
<protocol
type=
'telnet'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'tcp'
>
<source
mode=
'bind'
host=
'127.0.0.1'
service=
'9999'
/>
<protocol
type=
'telnet'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial tcp:127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'tcp'
>
<source
mode=
'connect'
host=
'127.0.0.1'
service=
'9999'
/>
<protocol
type=
'raw'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'tcp'
>
<source
mode=
'connect'
host=
'127.0.0.1'
service=
'9999'
/>
<protocol
type=
'raw'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial udp:127.0.0.1:9998@127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'udp'
>
<source
mode=
'bind'
host=
'127.0.0.1'
service=
'9999'
/>
<source
mode=
'connect'
host=
'127.0.0.1'
service=
'9998'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'udp'
>
<source
mode=
'bind'
host=
'127.0.0.1'
service=
'9999'
/>
<source
mode=
'connect'
host=
'127.0.0.1'
service=
'9998'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial unix:/tmp/serial.sock -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'unix'
>
<source
mode=
'connect'
path=
'/tmp/serial.sock'
/>
<target
port=
'0'
/>
</serial>
<console
type=
'unix'
>
<source
mode=
'connect'
path=
'/tmp/serial.sock'
/>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args
0 → 100644
浏览文件 @
49956f04
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial vc -parallel none -usb
\ No newline at end of file
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
0 → 100644
浏览文件 @
49956f04
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
/>
</disk>
<serial
type=
'vc'
>
<target
port=
'0'
/>
</serial>
<console
type=
'vc'
>
<target
port=
'0'
/>
</console>
</devices>
</domain>
tests/qemuxml2argvtest.c
浏览文件 @
49956f04
...
...
@@ -15,7 +15,7 @@
#include "qemu_conf.h"
static
char
*
progname
;
static
char
*
abs_
top_
srcdir
;
static
char
*
abs_srcdir
;
static
struct
qemud_driver
driver
;
#define MAX_FILE 4096
...
...
@@ -71,11 +71,8 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd) {
tmp
++
;
}
if
(
strcmp
(
expectargv
,
actualargv
))
{
if
(
getenv
(
"DEBUG_TESTS"
))
{
printf
(
"Expect %4d '%s'
\n
"
,
(
int
)
strlen
(
expectargv
),
expectargv
);
printf
(
"Actual %4d '%s'
\n
"
,
(
int
)
strlen
(
actualargv
),
actualargv
);
}
if
(
STRNEQ
(
expectargv
,
actualargv
))
{
virtTestDifference
(
stderr
,
expectargv
,
actualargv
);
goto
fail
;
}
...
...
@@ -100,10 +97,10 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd) {
static
int
testCompareXMLToArgvHelper
(
const
void
*
data
)
{
char
xml
[
PATH_MAX
];
char
args
[
PATH_MAX
];
snprintf
(
xml
,
PATH_MAX
,
"%s/
tests/
qemuxml2argvdata/qemuxml2argv-%s.xml"
,
abs_
top_
srcdir
,
(
const
char
*
)
data
);
snprintf
(
args
,
PATH_MAX
,
"%s/
tests/
qemuxml2argvdata/qemuxml2argv-%s.args"
,
abs_
top_
srcdir
,
(
const
char
*
)
data
);
snprintf
(
xml
,
PATH_MAX
,
"%s/qemuxml2argvdata/qemuxml2argv-%s.xml"
,
abs_srcdir
,
(
const
char
*
)
data
);
snprintf
(
args
,
PATH_MAX
,
"%s/qemuxml2argvdata/qemuxml2argv-%s.args"
,
abs_srcdir
,
(
const
char
*
)
data
);
return
testCompareXMLToArgvFiles
(
xml
,
args
);
}
...
...
@@ -113,6 +110,7 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
char
cwd
[
PATH_MAX
];
progname
=
argv
[
0
];
...
...
@@ -121,76 +119,45 @@ main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
}
abs_
top_srcdir
=
getenv
(
"abs_top
_srcdir"
);
if
(
!
abs_
top_
srcdir
)
return
1
;
abs_
srcdir
=
getenv
(
"abs
_srcdir"
);
if
(
!
abs_srcdir
)
abs_srcdir
=
getcwd
(
cwd
,
sizeof
(
cwd
))
;
driver
.
caps
=
qemudCapsInit
();
if
(
virtTestRun
(
"QEMU XML-2-ARGV minimal"
,
1
,
testCompareXMLToArgvHelper
,
"minimal"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot CDROM"
,
1
,
testCompareXMLToArgvHelper
,
"boot-cdrom"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot Network"
,
1
,
testCompareXMLToArgvHelper
,
"boot-network"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot Floppy"
,
1
,
testCompareXMLToArgvHelper
,
"boot-floppy"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Clock UTC"
,
1
,
testCompareXMLToArgvHelper
,
"clock-utc"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Clock Localtime"
,
1
,
testCompareXMLToArgvHelper
,
"clock-localtime"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk CDROM"
,
1
,
testCompareXMLToArgvHelper
,
"disk-cdrom"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk Floppy"
,
1
,
testCompareXMLToArgvHelper
,
"disk-floppy"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk Many"
,
1
,
testCompareXMLToArgvHelper
,
"disk-many"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Graphics VNC"
,
1
,
testCompareXMLToArgvHelper
,
"graphics-vnc"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Graphics SDL"
,
1
,
testCompareXMLToArgvHelper
,
"graphics-sdl"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Input USB Mouse"
,
1
,
testCompareXMLToArgvHelper
,
"input-usbmouse"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Input USB Tablet"
,
1
,
testCompareXMLToArgvHelper
,
"input-usbtablet"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Misc ACPI"
,
1
,
testCompareXMLToArgvHelper
,
"misc-acpi"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Misc No Reboot"
,
1
,
testCompareXMLToArgvHelper
,
"misc-no-reboot"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Net User"
,
1
,
testCompareXMLToArgvHelper
,
"net-user"
)
<
0
)
ret
=
-
1
;
#define DO_TEST(name) \
if (virtTestRun("QEMU XML-2-ARGV " name, \
1, testCompareXMLToArgvHelper, (name)) < 0) \
ret = -1
DO_TEST
(
"minimal"
);
DO_TEST
(
"boot-cdrom"
);
DO_TEST
(
"boot-network"
);
DO_TEST
(
"boot-floppy"
);
DO_TEST
(
"clock-utc"
);
DO_TEST
(
"clock-localtime"
);
DO_TEST
(
"disk-cdrom"
);
DO_TEST
(
"disk-floppy"
);
DO_TEST
(
"disk-many"
);
DO_TEST
(
"graphics-vnc"
);
DO_TEST
(
"graphics-sdl"
);
DO_TEST
(
"input-usbmouse"
);
DO_TEST
(
"input-usbtablet"
);
DO_TEST
(
"misc-acpi"
);
DO_TEST
(
"misc-no-reboot"
);
DO_TEST
(
"net-user"
);
DO_TEST
(
"serial-vc"
);
DO_TEST
(
"serial-pty"
);
DO_TEST
(
"serial-dev"
);
DO_TEST
(
"serial-file"
);
DO_TEST
(
"serial-unix"
);
DO_TEST
(
"serial-tcp"
);
DO_TEST
(
"serial-udp"
);
DO_TEST
(
"serial-tcp-telnet"
);
DO_TEST
(
"serial-many"
);
DO_TEST
(
"parallel-tcp"
);
DO_TEST
(
"console-compat"
);
virCapabilitiesFree
(
driver
.
caps
);
...
...
tests/qemuxml2xmltest.c
浏览文件 @
49956f04
...
...
@@ -15,7 +15,7 @@
#include "qemu_conf.h"
static
char
*
progname
;
static
char
*
abs_
top_
srcdir
;
static
char
*
abs_srcdir
;
static
struct
qemud_driver
driver
;
#define MAX_FILE 4096
...
...
@@ -47,11 +47,8 @@ static int testCompareXMLToXMLFiles(const char *xml) {
if
(
!
(
actual
=
qemudGenerateXML
(
NULL
,
&
driver
,
&
vm
,
vmdef
,
0
)))
goto
fail
;
if
(
strcmp
(
xmlData
,
actual
))
{
if
(
getenv
(
"DEBUG_TESTS"
))
{
printf
(
"Expect %4d '%s'
\n
"
,
(
int
)
strlen
(
xmlData
),
xmlData
);
printf
(
"Actual %4d '%s'
\n
"
,
(
int
)
strlen
(
actual
),
actual
);
}
if
(
STRNEQ
(
xmlData
,
actual
))
{
virtTestDifference
(
stderr
,
xmlData
,
actual
);
goto
fail
;
}
...
...
@@ -66,8 +63,8 @@ static int testCompareXMLToXMLFiles(const char *xml) {
static
int
testCompareXMLToXMLHelper
(
const
void
*
data
)
{
char
xml
[
PATH_MAX
];
snprintf
(
xml
,
PATH_MAX
,
"%s/
tests/
qemuxml2argvdata/qemuxml2argv-%s.xml"
,
abs_
top_
srcdir
,
(
const
char
*
)
data
);
snprintf
(
xml
,
PATH_MAX
,
"%s/qemuxml2argvdata/qemuxml2argv-%s.xml"
,
abs_srcdir
,
(
const
char
*
)
data
);
return
testCompareXMLToXMLFiles
(
xml
);
}
...
...
@@ -76,6 +73,7 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
char
cwd
[
PATH_MAX
];
progname
=
argv
[
0
];
...
...
@@ -84,76 +82,45 @@ main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
}
abs_top_srcdir
=
getenv
(
"abs_top_srcdir"
);
if
(
!
abs_top_srcdir
)
return
1
;
abs_srcdir
=
getenv
(
"abs_srcdir"
);
if
(
!
abs_srcdir
)
abs_srcdir
=
getcwd
(
cwd
,
sizeof
(
cwd
));
driver
.
caps
=
qemudCapsInit
();
if
(
virtTestRun
(
"QEMU XML-2-ARGV minimal"
,
1
,
testCompareXMLToXMLHelper
,
"minimal"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot CDROM"
,
1
,
testCompareXMLToXMLHelper
,
"boot-cdrom"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot Network"
,
1
,
testCompareXMLToXMLHelper
,
"boot-network"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Boot Floppy"
,
1
,
testCompareXMLToXMLHelper
,
"boot-floppy"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Clock UTC"
,
1
,
testCompareXMLToXMLHelper
,
"clock-utc"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Clock Localtime"
,
1
,
testCompareXMLToXMLHelper
,
"clock-localtime"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk CDROM"
,
1
,
testCompareXMLToXMLHelper
,
"disk-cdrom"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk Floppy"
,
1
,
testCompareXMLToXMLHelper
,
"disk-floppy"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Disk Many"
,
1
,
testCompareXMLToXMLHelper
,
"disk-many"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Graphics VNC"
,
1
,
testCompareXMLToXMLHelper
,
"graphics-vnc"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Graphics SDL"
,
1
,
testCompareXMLToXMLHelper
,
"graphics-sdl"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Input USB Mouse"
,
1
,
testCompareXMLToXMLHelper
,
"input-usbmouse"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Input USB Tablet"
,
1
,
testCompareXMLToXMLHelper
,
"input-usbtablet"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Misc ACPI"
,
1
,
testCompareXMLToXMLHelper
,
"misc-acpi"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Misc No Reboot"
,
1
,
testCompareXMLToXMLHelper
,
"misc-no-reboot"
)
<
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"QEMU XML-2-ARGV Net User"
,
1
,
testCompareXMLToXMLHelper
,
"net-user"
)
<
0
)
ret
=
-
1
;
#define DO_TEST(name) \
if (virtTestRun("QEMU XML-2-XML " name, \
1, testCompareXMLToXMLHelper, (name)) < 0) \
ret = -1
DO_TEST
(
"minimal"
);
DO_TEST
(
"boot-cdrom"
);
DO_TEST
(
"boot-network"
);
DO_TEST
(
"boot-floppy"
);
DO_TEST
(
"clock-utc"
);
DO_TEST
(
"clock-localtime"
);
DO_TEST
(
"disk-cdrom"
);
DO_TEST
(
"disk-floppy"
);
DO_TEST
(
"disk-many"
);
DO_TEST
(
"graphics-vnc"
);
DO_TEST
(
"graphics-sdl"
);
DO_TEST
(
"input-usbmouse"
);
DO_TEST
(
"input-usbtablet"
);
DO_TEST
(
"misc-acpi"
);
DO_TEST
(
"misc-no-reboot"
);
DO_TEST
(
"net-user"
);
DO_TEST
(
"serial-vc"
);
DO_TEST
(
"serial-pty"
);
DO_TEST
(
"serial-dev"
);
DO_TEST
(
"serial-file"
);
DO_TEST
(
"serial-unix"
);
DO_TEST
(
"serial-tcp"
);
DO_TEST
(
"serial-udp"
);
DO_TEST
(
"serial-tcp-telnet"
);
DO_TEST
(
"serial-many"
);
DO_TEST
(
"parallel-tcp"
);
DO_TEST
(
"console-compat"
);
virCapabilitiesFree
(
driver
.
caps
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录