|
|
9ae3a8 |
From ecbbc511c0c4239fed38527e05677f058e5dd5f9 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <ecbbc511c0c4239fed38527e05677f058e5dd5f9.1387288155.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <527da6c2ce2c09d0183aa8595fc95f136f61b6df.1387288155.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <527da6c2ce2c09d0183aa8595fc95f136f61b6df.1387288155.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 12 Dec 2013 16:21:24 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 4/8] libqtest: rename qmp() to qmp_discard_response()
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1386865288-1575-5-git-send-email-stefanha@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56258
|
|
|
9ae3a8 |
O-Subject: [RHEL7 qemu-kvm PATCH 4/8] libqtest: rename qmp() to qmp_discard_response()
|
|
|
9ae3a8 |
Bugzilla: 1003773
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Existing qmp() callers do not expect a response object. In order to
|
|
|
9ae3a8 |
implement real QMP test cases it will be necessary to inspect the
|
|
|
9ae3a8 |
response object.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Rename qmp() to qmp_discard_response(). Later patches will introduce a
|
|
|
9ae3a8 |
qmp() function that returns the response object and tests that use it.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Andreas Färber <afaerber@suse.de>
|
|
|
9ae3a8 |
(cherry picked from commit 0d1aa05e9eba2437fdcdfbaa846c850c986bf7c6)
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
tests/boot-order-test.c
|
|
|
9ae3a8 |
tests/ide-test.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL does not have tests/ide-test.c:test_flush() and the
|
|
|
9ae3a8 |
boot-order-test.c is also slightly older.
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
tests/boot-order-test.c | 4 ++--
|
|
|
9ae3a8 |
tests/fdc-test.c | 15 +++++++++------
|
|
|
9ae3a8 |
tests/libqtest.c | 10 +++++-----
|
|
|
9ae3a8 |
tests/libqtest.h | 20 ++++++++++----------
|
|
|
9ae3a8 |
4 files changed, 26 insertions(+), 23 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
tests/boot-order-test.c | 4 ++--
|
|
|
9ae3a8 |
tests/fdc-test.c | 15 +++++++++------
|
|
|
9ae3a8 |
tests/libqtest.c | 10 +++++-----
|
|
|
9ae3a8 |
tests/libqtest.h | 20 ++++++++++----------
|
|
|
9ae3a8 |
4 files changed, 26 insertions(+), 23 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c
|
|
|
9ae3a8 |
index 447be31..a35e9f7 100644
|
|
|
9ae3a8 |
--- a/tests/boot-order-test.c
|
|
|
9ae3a8 |
+++ b/tests/boot-order-test.c
|
|
|
9ae3a8 |
@@ -36,12 +36,12 @@ static void test_pc_with_args(const char *test_args,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
qtest_start(args);
|
|
|
9ae3a8 |
test_pc_cmos(boot1, boot2);
|
|
|
9ae3a8 |
- qmp("{ 'execute': 'system_reset' }");
|
|
|
9ae3a8 |
+ qmp_discard_response("{ 'execute': 'system_reset' }");
|
|
|
9ae3a8 |
/*
|
|
|
9ae3a8 |
* system_reset only requests reset. We get a RESET event after
|
|
|
9ae3a8 |
* the actual reset completes. Need to wait for that.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
- qmp(""); /* HACK: wait for event */
|
|
|
9ae3a8 |
+ qmp_discard_response(""); /* HACK: wait for event */
|
|
|
9ae3a8 |
test_pc_cmos(reboot1, reboot2);
|
|
|
9ae3a8 |
qtest_quit(global_qtest);
|
|
|
9ae3a8 |
g_free(args);
|
|
|
9ae3a8 |
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
|
|
|
9ae3a8 |
index fd198dc..38b5b17 100644
|
|
|
9ae3a8 |
--- a/tests/fdc-test.c
|
|
|
9ae3a8 |
+++ b/tests/fdc-test.c
|
|
|
9ae3a8 |
@@ -290,10 +290,12 @@ static void test_media_insert(void)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Insert media in drive. DSKCHK should not be reset until a step pulse
|
|
|
9ae3a8 |
* is sent. */
|
|
|
9ae3a8 |
- qmp("{'execute':'change', 'arguments':{ 'device':'floppy0', "
|
|
|
9ae3a8 |
- "'target': '%s' }}", test_image);
|
|
|
9ae3a8 |
- qmp(""); /* ignore event (FIXME open -> open transition?!) */
|
|
|
9ae3a8 |
- qmp(""); /* ignore event */
|
|
|
9ae3a8 |
+ qmp_discard_response("{'execute':'change', 'arguments':{"
|
|
|
9ae3a8 |
+ " 'device':'floppy0', 'target': '%s' }}",
|
|
|
9ae3a8 |
+ test_image);
|
|
|
9ae3a8 |
+ qmp_discard_response(""); /* ignore event
|
|
|
9ae3a8 |
+ (FIXME open -> open transition?!) */
|
|
|
9ae3a8 |
+ qmp_discard_response(""); /* ignore event */
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
dir = inb(FLOPPY_BASE + reg_dir);
|
|
|
9ae3a8 |
assert_bit_set(dir, DSKCHG);
|
|
|
9ae3a8 |
@@ -322,8 +324,9 @@ static void test_media_change(void)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Eject the floppy and check that DSKCHG is set. Reading it out doesn't
|
|
|
9ae3a8 |
* reset the bit. */
|
|
|
9ae3a8 |
- qmp("{'execute':'eject', 'arguments':{ 'device':'floppy0' }}");
|
|
|
9ae3a8 |
- qmp(""); /* ignore event */
|
|
|
9ae3a8 |
+ qmp_discard_response("{'execute':'eject', 'arguments':{"
|
|
|
9ae3a8 |
+ " 'device':'floppy0' }}");
|
|
|
9ae3a8 |
+ qmp_discard_response(""); /* ignore event */
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
dir = inb(FLOPPY_BASE + reg_dir);
|
|
|
9ae3a8 |
assert_bit_set(dir, DSKCHG);
|
|
|
9ae3a8 |
diff --git a/tests/libqtest.c b/tests/libqtest.c
|
|
|
9ae3a8 |
index bb82069..dc4c983 100644
|
|
|
9ae3a8 |
--- a/tests/libqtest.c
|
|
|
9ae3a8 |
+++ b/tests/libqtest.c
|
|
|
9ae3a8 |
@@ -151,8 +151,8 @@ QTestState *qtest_init(const char *extra_args)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Read the QMP greeting and then do the handshake */
|
|
|
9ae3a8 |
- qtest_qmp(s, "");
|
|
|
9ae3a8 |
- qtest_qmp(s, "{ 'execute': 'qmp_capabilities' }");
|
|
|
9ae3a8 |
+ qtest_qmp_discard_response(s, "");
|
|
|
9ae3a8 |
+ qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (getenv("QTEST_STOP")) {
|
|
|
9ae3a8 |
kill(qtest_qemu_pid(s), SIGSTOP);
|
|
|
9ae3a8 |
@@ -291,7 +291,7 @@ redo:
|
|
|
9ae3a8 |
return words;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void qtest_qmpv(QTestState *s, const char *fmt, va_list ap)
|
|
|
9ae3a8 |
+void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
bool has_reply = false;
|
|
|
9ae3a8 |
int nesting = 0;
|
|
|
9ae3a8 |
@@ -326,12 +326,12 @@ void qtest_qmpv(QTestState *s, const char *fmt, va_list ap)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void qtest_qmp(QTestState *s, const char *fmt, ...)
|
|
|
9ae3a8 |
+void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
va_list ap;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
va_start(ap, fmt);
|
|
|
9ae3a8 |
- qtest_qmpv(s, fmt, ap);
|
|
|
9ae3a8 |
+ qtest_qmpv_discard_response(s, fmt, ap);
|
|
|
9ae3a8 |
va_end(ap);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/tests/libqtest.h b/tests/libqtest.h
|
|
|
9ae3a8 |
index 0f6aade..3faa49b 100644
|
|
|
9ae3a8 |
--- a/tests/libqtest.h
|
|
|
9ae3a8 |
+++ b/tests/libqtest.h
|
|
|
9ae3a8 |
@@ -44,23 +44,23 @@ QTestState *qtest_init(const char *extra_args);
|
|
|
9ae3a8 |
void qtest_quit(QTestState *s);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/**
|
|
|
9ae3a8 |
- * qtest_qmp:
|
|
|
9ae3a8 |
+ * qtest_qmp_discard_response:
|
|
|
9ae3a8 |
* @s: #QTestState instance to operate on.
|
|
|
9ae3a8 |
* @fmt...: QMP message to send to qemu
|
|
|
9ae3a8 |
*
|
|
|
9ae3a8 |
- * Sends a QMP message to QEMU
|
|
|
9ae3a8 |
+ * Sends a QMP message to QEMU and consumes the response.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-void qtest_qmp(QTestState *s, const char *fmt, ...);
|
|
|
9ae3a8 |
+void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/**
|
|
|
9ae3a8 |
- * qtest_qmpv:
|
|
|
9ae3a8 |
+ * qtest_qmpv_discard_response:
|
|
|
9ae3a8 |
* @s: #QTestState instance to operate on.
|
|
|
9ae3a8 |
* @fmt: QMP message to send to QEMU
|
|
|
9ae3a8 |
* @ap: QMP message arguments
|
|
|
9ae3a8 |
*
|
|
|
9ae3a8 |
- * Sends a QMP message to QEMU.
|
|
|
9ae3a8 |
+ * Sends a QMP message to QEMU and consumes the response.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-void qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
|
|
|
9ae3a8 |
+void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/**
|
|
|
9ae3a8 |
* qtest_get_irq:
|
|
|
9ae3a8 |
@@ -331,17 +331,17 @@ static inline void qtest_end(void)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/**
|
|
|
9ae3a8 |
- * qmp:
|
|
|
9ae3a8 |
+ * qmp_discard_response:
|
|
|
9ae3a8 |
* @fmt...: QMP message to send to qemu
|
|
|
9ae3a8 |
*
|
|
|
9ae3a8 |
- * Sends a QMP message to QEMU
|
|
|
9ae3a8 |
+ * Sends a QMP message to QEMU and consumes the response.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-static inline void qmp(const char *fmt, ...)
|
|
|
9ae3a8 |
+static inline void qmp_discard_response(const char *fmt, ...)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
va_list ap;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
va_start(ap, fmt);
|
|
|
9ae3a8 |
- qtest_qmpv(global_qtest, fmt, ap);
|
|
|
9ae3a8 |
+ qtest_qmpv_discard_response(global_qtest, fmt, ap);
|
|
|
9ae3a8 |
va_end(ap);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|