|
|
7a3408 |
From 4085e9f2cbf097a62529f0afcc57f20194ac0036 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <4085e9f2cbf097a62529f0afcc57f20194ac0036@dist-git>
|
|
|
7a3408 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Date: Mon, 24 Aug 2015 13:04:52 +0200
|
|
|
7a3408 |
Subject: [PATCH] tests: Use qemuProcessPrepareMonitorChr in qemuxmlnstest
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1146886
|
|
|
7a3408 |
|
|
|
7a3408 |
The output of that function was not tested until now. In order to keep
|
|
|
7a3408 |
the paths in /tmp, the test driver config is "fixed" as well.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit f1e927c4bfd3da9511fd54bd6070149af04b5ee5)
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
.../qemuxmlns-qemu-ns-commandline-ns0.args | 2 +-
|
|
|
7a3408 |
.../qemuxmlns-qemu-ns-commandline-ns1.args | 2 +-
|
|
|
7a3408 |
.../qemuxmlnsdata/qemuxmlns-qemu-ns-commandline.args | 2 +-
|
|
|
7a3408 |
.../qemuxmlns-qemu-ns-domain-commandline-ns0.args | 2 +-
|
|
|
7a3408 |
.../qemuxmlns-qemu-ns-domain-commandline.args | 2 +-
|
|
|
7a3408 |
tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.args | 2 +-
|
|
|
7a3408 |
tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.args | 2 +-
|
|
|
7a3408 |
tests/qemuxmlnstest.c | 19 +++++++++++++------
|
|
|
7a3408 |
8 files changed, 20 insertions(+), 13 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns0.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns0.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns0.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns0.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns1.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns1.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns1.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline-ns1.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-commandline.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline-ns0.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline-ns0.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline-ns0.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline-ns0.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-commandline.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.args
|
|
|
7a3408 |
index ad16f43..dac8651 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none ARGUMENT
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.args b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.args
|
|
|
7a3408 |
index 26038a0..ce2bf40 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.args
|
|
|
7a3408 |
+++ b/tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.args
|
|
|
7a3408 |
@@ -1,4 +1,4 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
|
|
7a3408 |
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
+unix:/tmp/domain-QEMUGuest1/monitor.sock,server,nowait -no-acpi -boot c -usb -hda \
|
|
|
7a3408 |
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
|
|
|
7a3408 |
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
|
|
|
7a3408 |
index 8eaab8a..a68e762 100644
|
|
|
7a3408 |
--- a/tests/qemuxmlnstest.c
|
|
|
7a3408 |
+++ b/tests/qemuxmlnstest.c
|
|
|
7a3408 |
@@ -16,6 +16,7 @@
|
|
|
7a3408 |
# include "qemu/qemu_capabilities.h"
|
|
|
7a3408 |
# include "qemu/qemu_command.h"
|
|
|
7a3408 |
# include "qemu/qemu_domain.h"
|
|
|
7a3408 |
+# include "qemu/qemu_process.h"
|
|
|
7a3408 |
# include "datatypes.h"
|
|
|
7a3408 |
# include "cpu/cpu_map.h"
|
|
|
7a3408 |
# include "testutilsqemu.h"
|
|
|
7a3408 |
@@ -37,7 +38,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|
|
7a3408 |
char *actualargv = NULL;
|
|
|
7a3408 |
int ret = -1;
|
|
|
7a3408 |
virDomainDefPtr vmdef = NULL;
|
|
|
7a3408 |
- virDomainChrSourceDef monitor_chr;
|
|
|
7a3408 |
+ virDomainChrSourceDefPtr monitor_chr = NULL;
|
|
|
7a3408 |
virConnectPtr conn;
|
|
|
7a3408 |
char *log = NULL;
|
|
|
7a3408 |
char *emulator = NULL;
|
|
|
7a3408 |
@@ -77,10 +78,12 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|
|
7a3408 |
|
|
|
7a3408 |
vmdef->id = -1;
|
|
|
7a3408 |
|
|
|
7a3408 |
- memset(&monitor_chr, 0, sizeof(monitor_chr));
|
|
|
7a3408 |
- monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
|
|
7a3408 |
- monitor_chr.data.nix.path = (char *)"/tmp/test-monitor";
|
|
|
7a3408 |
- monitor_chr.data.nix.listen = true;
|
|
|
7a3408 |
+ if (VIR_ALLOC(monitor_chr) < 0)
|
|
|
7a3408 |
+ goto fail;
|
|
|
7a3408 |
+ if (qemuProcessPrepareMonitorChr(driver.config,
|
|
|
7a3408 |
+ monitor_chr,
|
|
|
7a3408 |
+ vmdef->name) < 0)
|
|
|
7a3408 |
+ goto fail;
|
|
|
7a3408 |
|
|
|
7a3408 |
virQEMUCapsSetList(extraFlags,
|
|
|
7a3408 |
QEMU_CAPS_VNC_COLON,
|
|
|
7a3408 |
@@ -104,7 +107,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|
|
7a3408 |
goto fail;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (!(cmd = qemuBuildCommandLine(conn, &driver,
|
|
|
7a3408 |
- vmdef, &monitor_chr, json, extraFlags,
|
|
|
7a3408 |
+ vmdef, monitor_chr, json, extraFlags,
|
|
|
7a3408 |
migrateFrom, migrateFd, NULL,
|
|
|
7a3408 |
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
|
|
|
7a3408 |
&testCallbacks, false, false, NULL,
|
|
|
7a3408 |
@@ -142,6 +145,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|
|
7a3408 |
ret = 0;
|
|
|
7a3408 |
|
|
|
7a3408 |
fail:
|
|
|
7a3408 |
+ virDomainChrSourceDefFree(monitor_chr);
|
|
|
7a3408 |
VIR_FREE(log);
|
|
|
7a3408 |
VIR_FREE(emulator);
|
|
|
7a3408 |
VIR_FREE(actualargv);
|
|
|
7a3408 |
@@ -199,6 +203,9 @@ mymain(void)
|
|
|
7a3408 |
|
|
|
7a3408 |
if (!(driver.config = virQEMUDriverConfigNew(false)))
|
|
|
7a3408 |
return EXIT_FAILURE;
|
|
|
7a3408 |
+ VIR_FREE(driver.config->libDir);
|
|
|
7a3408 |
+ if (VIR_STRDUP_QUIET(driver.config->libDir, "/tmp") < 0)
|
|
|
7a3408 |
+ return EXIT_FAILURE;
|
|
|
7a3408 |
if ((driver.caps = testQemuCapsInit()) == NULL)
|
|
|
7a3408 |
return EXIT_FAILURE;
|
|
|
7a3408 |
if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.1
|
|
|
7a3408 |
|