From 055a1efc7c5a30ca0993720da57ba70179d28c7b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:25 +0200 Subject: libqtest: Remove qtest_qmp_discard_response() & friends qtest_qmp_discard_response(...) is shorthand for qobject_unref(qtest_qmp(...), except it's not actually shorter. Moreover, the presence of these functions encourage sloppy testing. Remove them from libqtest. Add them as macros to the tests that use them, with a TODO comment asking for cleanup. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-5-armbru@redhat.com> Reviewed-by: Thomas Huth --- tests/ide-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/ide-test.c') diff --git a/tests/ide-test.c b/tests/ide-test.c index 2384c2c..7ab09c3 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -29,12 +29,15 @@ #include "libqos/libqos.h" #include "libqos/pci-pc.h" #include "libqos/malloc-pc.h" - +#include "qapi/qmp/qdict.h" #include "qemu-common.h" #include "qemu/bswap.h" #include "hw/pci/pci_ids.h" #include "hw/pci/pci_regs.h" +/* TODO actually test the results and get rid of this */ +#define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) + #define TEST_IMAGE_SIZE 64 * 1024 * 1024 #define IDE_PCI_DEV 1 -- cgit v1.1 From 62fff696d56b90e5820d2c3c3085b778b23f0d93 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:32 +0200 Subject: tests: Pass literal format strings directly to qmp_FOO() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The qmp_FOO() take a printf-like format string. In a few places, we assign a string literal to a variable and pass that instead of simply passing the literal. Clean that up. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-12-armbru@redhat.com> --- tests/ide-test.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests/ide-test.c') diff --git a/tests/ide-test.c b/tests/ide-test.c index 7ab09c3..89c4468 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -697,7 +697,6 @@ static void test_retry_flush(const char *machine) QPCIDevice *dev; QPCIBar bmdma_bar, ide_bar; uint8_t data; - const char *s; prepare_blkdebug_script(debug_path, "flush_to_disk"); @@ -725,8 +724,7 @@ static void test_retry_flush(const char *machine) qmp_eventwait("STOP"); /* Complete the command */ - s = "{'execute':'cont' }"; - qmp_discard_response(s); + qmp_discard_response("{'execute':'cont' }"); /* Check registers */ data = qpci_io_readb(dev, ide_bar, reg_device); -- cgit v1.1