Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812535/?format=api
{ "id": 812535, "url": "http://patchwork.ozlabs.org/api/patches/812535/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911172022.4738-39-eblake@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170911172022.4738-39-eblake@redhat.com>", "list_archive_url": null, "date": "2017-09-11T17:20:22", "name": "[v7,38/38] libqtest: Merge qtest_hmp() with hmp()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3ee55eb1ac85cc089bd98beff99fb9ac95975a42", "submitter": { "id": 6591, "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api", "name": "Eric Blake", "email": "eblake@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911172022.4738-39-eblake@redhat.com/mbox/", "series": [ { "id": 2534, "url": "http://patchwork.ozlabs.org/api/series/2534/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2534", "date": "2017-09-11T17:19:47", "name": "Preliminary libqtest cleanups", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/2534/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812535/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812535/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrbV53KCvz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 04:06:53 +1000 (AEST)", "from localhost ([::1]:59605 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drT6h-0007Nt-FE\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 14:06:51 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:39353)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1drSPj-0000Aw-HL\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:22:29 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1drSPg-0001qp-QL\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:22:27 -0400", "from mx1.redhat.com ([209.132.183.28]:47822)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1drSPc-0001o2-Vh; Mon, 11 Sep 2017 13:22:21 -0400", "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1C5AC254A0;\n\tMon, 11 Sep 2017 17:22:20 +0000 (UTC)", "from red.redhat.com (ovpn-120-44.rdu2.redhat.com [10.10.120.44])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id D82E75D9CA;\n\tMon, 11 Sep 2017 17:22:18 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 1C5AC254A0", "From": "Eric Blake <eblake@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Mon, 11 Sep 2017 12:20:22 -0500", "Message-Id": "<20170911172022.4738-39-eblake@redhat.com>", "In-Reply-To": "<20170911172022.4738-1-eblake@redhat.com>", "References": "<20170911172022.4738-1-eblake@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tMon, 11 Sep 2017 17:22:20 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PATCH v7 38/38] libqtest: Merge qtest_hmp() with hmp()", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "thuth@redhat.com, \"open list:IDE\" <qemu-block@nongnu.org>,\n\tarmbru@redhat.com, \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>,\n\tpbonzini@redhat.com, John Snow <jsnow@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "Maintaining two layers of libqtest APIs, one that takes an explicit\nQTestState object, and the other that uses the implicit global_qtest,\nis annoying. In the interest of getting rid of global implicit\nstate and having less code to maintain, merge:\n qtest_hmp()\nwith its short counterpart, and delete qtest_hmpv() as unused (not\nto mention that a 'v' suffix is unusual, when compared to the\nprintf family or even our new qtest_vstartf() where the va_list\ncounterpart uses 'v' as a prefix). All callers that previously\nused the short form now make it explicit that they are relying on\nglobal_qtest, and later patches can then clean things up to remove\nthe global variable.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n---\n tests/libqtest.h | 27 ++-------------------------\n tests/libqtest.c | 26 ++++----------------------\n tests/device-introspect-test.c | 6 +++---\n tests/drive_del-test.c | 4 ++--\n tests/ide-test.c | 4 ++--\n tests/numa-test.c | 6 +++---\n tests/test-hmp.c | 6 +++---\n 7 files changed, 19 insertions(+), 60 deletions(-)", "diff": "diff --git a/tests/libqtest.h b/tests/libqtest.h\nindex b811394d4d..34986955d3 100644\n--- a/tests/libqtest.h\n+++ b/tests/libqtest.h\n@@ -140,7 +140,7 @@ void qtest_qmp_eventwait(QTestState *s, const char *event);\n QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);\n\n /**\n- * qtest_hmp:\n+ * hmp:\n * @s: #QTestState instance to operate on.\n * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().\n *\n@@ -149,20 +149,7 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);\n *\n * Returns: the command's output. The caller should g_free() it.\n */\n-char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);\n-\n-/**\n- * qtest_hmpv:\n- * @s: #QTestState instance to operate on.\n- * @fmt: HMP command to send to QEMU\n- * @ap: HMP command arguments\n- *\n- * Send HMP command to QEMU via QMP's human-monitor-command.\n- * QMP events are discarded.\n- *\n- * Returns: the command's output. The caller should g_free() it.\n- */\n-char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap);\n+char *hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);\n\n /**\n * get_irq:\n@@ -570,16 +557,6 @@ static inline QDict *qmp_eventwait_ref(const char *event)\n return qtest_qmp_eventwait_ref(global_qtest, event);\n }\n\n-/**\n- * hmp:\n- * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().\n- *\n- * Send HMP command to QEMU via QMP's human-monitor-command.\n- *\n- * Returns: the command's output. The caller should g_free() it.\n- */\n-char *hmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);\n-\n QDict *qmp_fd_receive(int fd);\n void qmp_fd_sendv(int fd, const char *fmt, va_list ap);\n void qmp_fd_send(int fd, const char *fmt, ...);\ndiff --git a/tests/libqtest.c b/tests/libqtest.c\nindex 747411b5b5..1641c3ae4c 100644\n--- a/tests/libqtest.c\n+++ b/tests/libqtest.c\n@@ -596,13 +596,16 @@ void qtest_qmp_eventwait(QTestState *s, const char *event)\n QDECREF(response);\n }\n\n-char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap)\n+char *hmp(QTestState *s, const char *fmt, ...)\n {\n+ va_list ap;\n char *cmd;\n QDict *resp;\n char *ret;\n\n+ va_start(ap, fmt);\n cmd = g_strdup_vprintf(fmt, ap);\n+ va_end(ap);\n resp = qtest_qmp(s, \"{'execute': 'human-monitor-command',\"\n \" 'arguments': {'command-line': %s}}\",\n cmd);\n@@ -619,17 +622,6 @@ char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap)\n return ret;\n }\n\n-char *qtest_hmp(QTestState *s, const char *fmt, ...)\n-{\n- va_list ap;\n- char *ret;\n-\n- va_start(ap, fmt);\n- ret = qtest_hmpv(s, fmt, ap);\n- va_end(ap);\n- return ret;\n-}\n-\n const char *qtest_get_arch(void)\n {\n const char *qemu = getenv(\"QTEST_QEMU_BINARY\");\n@@ -952,16 +944,6 @@ void qmp_discard_response(void)\n\n QDECREF(response);\n }\n-char *hmp(const char *fmt, ...)\n-{\n- va_list ap;\n- char *ret;\n-\n- va_start(ap, fmt);\n- ret = qtest_hmpv(global_qtest, fmt, ap);\n- va_end(ap);\n- return ret;\n-}\n\n bool qtest_big_endian(QTestState *s)\n {\ndiff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c\nindex ed4f5f2eed..7dbd27330a 100644\n--- a/tests/device-introspect-test.c\n+++ b/tests/device-introspect-test.c\n@@ -110,14 +110,14 @@ static void test_one_device(const char *type)\n type);\n QDECREF(resp);\n\n- help = hmp(\"device_add \\\"%s,help\\\"\", type);\n+ help = hmp(global_qtest, \"device_add \\\"%s,help\\\"\", type);\n g_free(help);\n\n /*\n * Some devices leave dangling pointers in QOM behind.\n * \"info qom-tree\" has a good chance at crashing then\n */\n- qom_tree = hmp(\"info qom-tree\");\n+ qom_tree = hmp(global_qtest, \"info qom-tree\");\n g_free(qom_tree);\n }\n\n@@ -131,7 +131,7 @@ static void test_device_intro_list(void)\n types = device_type_list(true);\n QDECREF(types);\n\n- help = hmp(\"device_add help\");\n+ help = hmp(global_qtest, \"device_add help\");\n g_free(help);\n\n qtest_quit(global_qtest);\ndiff --git a/tests/drive_del-test.c b/tests/drive_del-test.c\nindex 0fde0c2040..6b53ac5a1a 100644\n--- a/tests/drive_del-test.c\n+++ b/tests/drive_del-test.c\n@@ -15,7 +15,7 @@\n\n static void drive_add(void)\n {\n- char *resp = hmp(\"drive_add 0 if=none,id=drive0\");\n+ char *resp = hmp(global_qtest, \"drive_add 0 if=none,id=drive0\");\n\n g_assert_cmpstr(resp, ==, \"OK\\r\\n\");\n g_free(resp);\n@@ -23,7 +23,7 @@ static void drive_add(void)\n\n static void drive_del(void)\n {\n- char *resp = hmp(\"drive_del drive0\");\n+ char *resp = hmp(global_qtest, \"drive_del drive0\");\n\n g_assert_cmpstr(resp, ==, \"\");\n g_free(resp);\ndiff --git a/tests/ide-test.c b/tests/ide-test.c\nindex 6ba3a8589d..5e7fa6e461 100644\n--- a/tests/ide-test.c\n+++ b/tests/ide-test.c\n@@ -587,7 +587,7 @@ static void test_flush(void)\n make_dirty(0);\n\n /* Delay the completion of the flush request until we explicitly do it */\n- g_free(hmp(\"qemu-io ide0-hd0 \\\"break flush_to_os A\\\"\"));\n+ g_free(hmp(global_qtest, \"qemu-io ide0-hd0 \\\"break flush_to_os A\\\"\"));\n\n /* FLUSH CACHE command on device 0*/\n qpci_io_writeb(dev, ide_bar, reg_device, 0);\n@@ -599,7 +599,7 @@ static void test_flush(void)\n assert_bit_clear(data, DF | ERR | DRQ);\n\n /* Complete the command */\n- g_free(hmp(\"qemu-io ide0-hd0 \\\"resume A\\\"\"));\n+ g_free(hmp(global_qtest, \"qemu-io ide0-hd0 \\\"resume A\\\"\"));\n\n /* Check registers */\n data = qpci_io_readb(dev, ide_bar, reg_device);\ndiff --git a/tests/numa-test.c b/tests/numa-test.c\nindex e2f6c68be8..a7e2b183f7 100644\n--- a/tests/numa-test.c\n+++ b/tests/numa-test.c\n@@ -21,7 +21,7 @@ static void test_mon_explicit(const void *data)\n \"-numa node,nodeid=0,cpus=0-3 \"\n \"-numa node,nodeid=1,cpus=4-7 \", args);\n\n- s = hmp(\"info numa\");\n+ s = hmp(global_qtest, \"info numa\");\n g_assert(strstr(s, \"node 0 cpus: 0 1 2 3\"));\n g_assert(strstr(s, \"node 1 cpus: 4 5 6 7\"));\n g_free(s);\n@@ -36,7 +36,7 @@ static void test_mon_default(const void *data)\n\n global_qtest = qtest_startf(\"%s -smp 8 -numa node -numa node\", args);\n\n- s = hmp(\"info numa\");\n+ s = hmp(global_qtest, \"info numa\");\n g_assert(strstr(s, \"node 0 cpus: 0 2 4 6\"));\n g_assert(strstr(s, \"node 1 cpus: 1 3 5 7\"));\n g_free(s);\n@@ -53,7 +53,7 @@ static void test_mon_partial(const void *data)\n \"-numa node,nodeid=0,cpus=0-1 \"\n \"-numa node,nodeid=1,cpus=4-5 \", args);\n\n- s = hmp(\"info numa\");\n+ s = hmp(global_qtest, \"info numa\");\n g_assert(strstr(s, \"node 0 cpus: 0 1 2 3 6 7\"));\n g_assert(strstr(s, \"node 1 cpus: 4 5\"));\n g_free(s);\ndiff --git a/tests/test-hmp.c b/tests/test-hmp.c\nindex b3102daea1..e670a5ee6c 100644\n--- a/tests/test-hmp.c\n+++ b/tests/test-hmp.c\n@@ -80,7 +80,7 @@ static void test_commands(void)\n if (verbose) {\n fprintf(stderr, \"\\t%s\\n\", hmp_cmds[i]);\n }\n- response = hmp(\"%s\", hmp_cmds[i]);\n+ response = hmp(global_qtest, \"%s\", hmp_cmds[i]);\n g_free(response);\n }\n\n@@ -91,7 +91,7 @@ static void test_info_commands(void)\n {\n char *resp, *info, *info_buf, *endp;\n\n- info_buf = info = hmp(\"help info\");\n+ info_buf = info = hmp(global_qtest, \"help info\");\n\n while (*info) {\n /* Extract the info command, ignore parameters and description */\n@@ -103,7 +103,7 @@ static void test_info_commands(void)\n if (verbose) {\n fprintf(stderr, \"\\t%s\\n\", info);\n }\n- resp = hmp(\"%s\", info);\n+ resp = hmp(global_qtest, \"%s\", info);\n g_free(resp);\n /* And move forward to the next line */\n info = strchr(endp + 1, '\\n');\n", "prefixes": [ "v7", "38/38" ] }