Blame SOURCES/kvm-libqtest-rename-qmp-to-qmp_discard_response.patch

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