1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

tests: Use qemuProcessPrepareMonitorChr in qemuxmlnstest

The output of that function was not tested until now.  In order to keep
the paths in /tmp, the test driver config is "fixed" as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2015-08-13 11:00:48 +02:00
parent f1f68ca334
commit f1e927c4bf
8 changed files with 20 additions and 13 deletions

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT

View File

@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none

View File

@ -16,6 +16,7 @@
# include "qemu/qemu_capabilities.h" # include "qemu/qemu_capabilities.h"
# include "qemu/qemu_command.h" # include "qemu/qemu_command.h"
# include "qemu/qemu_domain.h" # include "qemu/qemu_domain.h"
# include "qemu/qemu_process.h"
# include "datatypes.h" # include "datatypes.h"
# include "cpu/cpu_map.h" # include "cpu/cpu_map.h"
# include "testutilsqemu.h" # include "testutilsqemu.h"
@ -37,7 +38,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
char *actualargv = NULL; char *actualargv = NULL;
int ret = -1; int ret = -1;
virDomainDefPtr vmdef = NULL; virDomainDefPtr vmdef = NULL;
virDomainChrSourceDef monitor_chr; virDomainChrSourceDefPtr monitor_chr = NULL;
virConnectPtr conn; virConnectPtr conn;
char *log = NULL; char *log = NULL;
char *emulator = NULL; char *emulator = NULL;
@ -77,10 +78,12 @@ static int testCompareXMLToArgvFiles(const char *xml,
vmdef->id = -1; vmdef->id = -1;
memset(&monitor_chr, 0, sizeof(monitor_chr)); if (VIR_ALLOC(monitor_chr) < 0)
monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX; goto fail;
monitor_chr.data.nix.path = (char *)"/tmp/test-monitor"; if (qemuProcessPrepareMonitorChr(driver.config,
monitor_chr.data.nix.listen = true; monitor_chr,
vmdef->name) < 0)
goto fail;
virQEMUCapsSetList(extraFlags, virQEMUCapsSetList(extraFlags,
QEMU_CAPS_VNC_COLON, QEMU_CAPS_VNC_COLON,
@ -104,7 +107,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto fail; goto fail;
if (!(cmd = qemuBuildCommandLine(conn, &driver, if (!(cmd = qemuBuildCommandLine(conn, &driver,
vmdef, &monitor_chr, json, extraFlags, vmdef, monitor_chr, json, extraFlags,
migrateFrom, migrateFd, NULL, migrateFrom, migrateFd, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&testCallbacks, false, false, NULL, &testCallbacks, false, false, NULL,
@ -142,6 +145,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0; ret = 0;
fail: fail:
virDomainChrSourceDefFree(monitor_chr);
VIR_FREE(log); VIR_FREE(log);
VIR_FREE(emulator); VIR_FREE(emulator);
VIR_FREE(actualargv); VIR_FREE(actualargv);
@ -199,6 +203,9 @@ mymain(void)
if (!(driver.config = virQEMUDriverConfigNew(false))) if (!(driver.config = virQEMUDriverConfigNew(false)))
return EXIT_FAILURE; return EXIT_FAILURE;
VIR_FREE(driver.config->libDir);
if (VIR_STRDUP_QUIET(driver.config->libDir, "/tmp") < 0)
return EXIT_FAILURE;
if ((driver.caps = testQemuCapsInit()) == NULL) if ((driver.caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE; return EXIT_FAILURE;
if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver))) if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))