Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808933/?format=api
{ "id": 808933, "url": "http://patchwork.ozlabs.org/api/patches/808933/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-21-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": "<20170901180340.30009-21-eblake@redhat.com>", "list_archive_url": null, "date": "2017-09-01T18:03:31", "name": "[v6,20/29] vhost-user-test: Drop dependence on global_qtest", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f0ea5a36acb2a453e7405517c6947dfe463aa951", "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/20170901180340.30009-21-eblake@redhat.com/mbox/", "series": [ { "id": 1089, "url": "http://patchwork.ozlabs.org/api/series/1089/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1089", "date": "2017-09-01T18:03:12", "name": "Preliminary libqtest cleanups", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/1089/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808933/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808933/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-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx08.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 3xkSHB2jgVz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 2 Sep 2017 04:21:10 +1000 (AEST)", "from localhost ([::1]:53344 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 1dnqZ1-0006yZ-TW\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 14:21:07 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:56128)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIn-0007QM-TS\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:27 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIi-0001s6-Mo\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:21 -0400", "from mx1.redhat.com ([209.132.183.28]:33096)\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>) id 1dnqIi-0001rE-FU\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:16 -0400", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\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 85F29C056828\n\tfor <qemu-devel@nongnu.org>; Fri, 1 Sep 2017 18:04:15 +0000 (UTC)", "from red.redhat.com (ovpn-121-149.rdu2.redhat.com [10.10.121.149])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id E59A562929;\n\tFri, 1 Sep 2017 18:04:14 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 85F29C056828", "From": "Eric Blake <eblake@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 1 Sep 2017 13:03:31 -0500", "Message-Id": "<20170901180340.30009-21-eblake@redhat.com>", "In-Reply-To": "<20170901180340.30009-1-eblake@redhat.com>", "References": "<20170901180340.30009-1-eblake@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tFri, 01 Sep 2017 18:04:15 +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 v6 20/29] vhost-user-test: Drop dependence on\n\tglobal_qtest", "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": "pbonzini@redhat.com, armbru@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": "Managing parallel connections to two different monitors via\nthe implicit global_qtest makes it hard to copy-and-paste code\nto tests that are not aware of the implicit state. Now that\nlibqos is fully-explicit, it is easy to expand the rest of\nvhost-user-test to also use explicit state everywhere.\n\nWe can assert that the conversion is correct by checking that\nglobal_qtest remains NULL throughout the test (a later patch\nthat changes global_qtest to not be a public global variable\nwill drop the assertions).\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n---\n tests/vhost-user-test.c | 68 ++++++++++++++++++++++---------------------------\n 1 file changed, 30 insertions(+), 38 deletions(-)", "diff": "diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c\nindex 562bfaefd2..1e0c50d12a 100644\n--- a/tests/vhost-user-test.c\n+++ b/tests/vhost-user-test.c\n@@ -139,6 +139,7 @@ enum {\n };\n\n typedef struct TestServer {\n+ QTestState *qts;\n QPCIBus *bus;\n gchar *socket_path;\n gchar *mig_path;\n@@ -164,7 +165,7 @@ static void init_virtio_dev(TestServer *s)\n QVirtioPCIDevice *dev;\n uint32_t features;\n\n- s->bus = qpci_init_pc(global_qtest, NULL);\n+ s->bus = qpci_init_pc(s->qts, NULL);\n g_assert_nonnull(s->bus);\n\n dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET);\n@@ -236,8 +237,11 @@ static void read_guest_mem(const void *data)\n guest_mem += (s->memory.regions[i].mmap_offset / sizeof(*guest_mem));\n\n for (j = 0; j < 256; j++) {\n- uint32_t a = readl(s->memory.regions[i].guest_phys_addr + j*4);\n- uint32_t b = guest_mem[j];\n+ uint32_t a, b;\n+\n+ a = qtest_readl(s->qts,\n+ s->memory.regions[i].guest_phys_addr + j * 4);\n+ b = guest_mem[j];\n\n g_assert_cmpint(a, ==, b);\n }\n@@ -515,6 +519,12 @@ static gboolean _test_server_free(TestServer *server)\n\n static void test_server_free(TestServer *server)\n {\n+ assert(!global_qtest);\n+ if (server->qts) {\n+ qtest_quit(server->qts);\n+ server->qts = NULL;\n+ }\n+\n g_idle_add((GSourceFunc)_test_server_free, server);\n }\n\n@@ -626,7 +636,6 @@ static void test_migrate(void)\n TestServer *s = test_server_new(\"src\");\n TestServer *dest = test_server_new(\"dest\");\n char *uri = g_strdup_printf(\"%s%s\", \"unix:\", dest->mig_path);\n- QTestState *global = global_qtest, *from, *to;\n GSource *source;\n gchar *cmd;\n QDict *rsp;\n@@ -637,7 +646,7 @@ static void test_migrate(void)\n test_server_listen(dest);\n\n cmd = GET_QEMU_CMDE(s, 2, \"\", \"\");\n- from = qtest_start(cmd);\n+ s->qts = qtest_init(cmd);\n g_free(cmd);\n\n init_virtio_dev(s);\n@@ -646,7 +655,7 @@ static void test_migrate(void)\n g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8));\n\n cmd = GET_QEMU_CMDE(dest, 2, \"\", \" -incoming %s\", uri);\n- to = qtest_init(cmd);\n+ dest->qts = qtest_init(cmd);\n g_free(cmd);\n\n source = g_source_new(&test_migrate_source_funcs,\n@@ -657,16 +666,13 @@ static void test_migrate(void)\n\n /* slow down migration to have time to fiddle with log */\n /* TODO: qtest could learn to break on some places */\n- rsp = qmp(\"{ 'execute': 'migrate_set_speed',\"\n- \"'arguments': { 'value': 10 } }\");\n+ rsp = qtest_qmp(s->qts, \"{ 'execute': 'migrate_set_speed',\"\n+ \"'arguments': { 'value': 10 } }\");\n g_assert(qdict_haskey(rsp, \"return\"));\n QDECREF(rsp);\n\n- cmd = g_strdup_printf(\"{ 'execute': 'migrate',\"\n- \"'arguments': { 'uri': '%s' } }\",\n- uri);\n- rsp = qmp(cmd);\n- g_free(cmd);\n+ rsp = qtest_qmp(s->qts,\n+ \"{'execute': 'migrate', 'arguments': { 'uri': %s}}\", uri);\n g_assert(qdict_haskey(rsp, \"return\"));\n QDECREF(rsp);\n\n@@ -681,28 +687,23 @@ static void test_migrate(void)\n munmap(log, size);\n\n /* speed things up */\n- rsp = qmp(\"{ 'execute': 'migrate_set_speed',\"\n- \"'arguments': { 'value': 0 } }\");\n+ rsp = qtest_qmp(s->qts, \"{ 'execute': 'migrate_set_speed',\"\n+ \"'arguments': { 'value': 0 } }\");\n g_assert(qdict_haskey(rsp, \"return\"));\n QDECREF(rsp);\n\n- qmp_eventwait(\"STOP\");\n+ qtest_qmp_eventwait(s->qts, \"STOP\");\n\n- global_qtest = to;\n- qmp_eventwait(\"RESUME\");\n+ qtest_qmp_eventwait(dest->qts, \"RESUME\");\n\n read_guest_mem(dest);\n\n g_source_destroy(source);\n g_source_unref(source);\n\n- qtest_quit(to);\n test_server_free(dest);\n- qtest_quit(from);\n test_server_free(s);\n g_free(uri);\n-\n- global_qtest = global;\n }\n\n static void wait_for_rings_started(TestServer *s, size_t count)\n@@ -752,7 +753,7 @@ static void test_reconnect_subprocess(void)\n\n g_thread_new(\"connect\", connect_thread, s);\n cmd = GET_QEMU_CMDE(s, 2, \",server\", \"\");\n- qtest_start(cmd);\n+ s->qts = qtest_init(cmd);\n g_free(cmd);\n\n init_virtio_dev(s);\n@@ -766,7 +767,6 @@ static void test_reconnect_subprocess(void)\n wait_for_fds(s);\n wait_for_rings_started(s, 2);\n\n- qtest_end();\n test_server_free(s);\n return;\n }\n@@ -788,14 +788,13 @@ static void test_connect_fail_subprocess(void)\n s->test_fail = true;\n g_thread_new(\"connect\", connect_thread, s);\n cmd = GET_QEMU_CMDE(s, 2, \",server\", \"\");\n- qtest_start(cmd);\n+ s->qts = qtest_init(cmd);\n g_free(cmd);\n\n init_virtio_dev(s);\n wait_for_fds(s);\n wait_for_rings_started(s, 2);\n\n- qtest_end();\n test_server_free(s);\n }\n\n@@ -816,14 +815,13 @@ static void test_flags_mismatch_subprocess(void)\n s->test_flags = TEST_FLAGS_DISCONNECT;\n g_thread_new(\"connect\", connect_thread, s);\n cmd = GET_QEMU_CMDE(s, 2, \",server\", \"\");\n- qtest_start(cmd);\n+ s->qts = qtest_init(cmd);\n g_free(cmd);\n\n init_virtio_dev(s);\n wait_for_fds(s);\n wait_for_rings_started(s, 2);\n\n- qtest_end();\n test_server_free(s);\n }\n\n@@ -888,13 +886,13 @@ static void test_multiqueue(void)\n 512, 512, root, s->chr_name,\n s->socket_path, \"\", s->chr_name,\n queues, queues * 2 + 2);\n- qtest_start(cmd);\n+ s->qts = qtest_init(cmd);\n g_free(cmd);\n\n- bus = qpci_init_pc(global_qtest, NULL);\n+ bus = qpci_init_pc(s->qts, NULL);\n dev = virtio_net_pci_init(bus, PCI_SLOT);\n\n- alloc = pc_alloc_init(global_qtest);\n+ alloc = pc_alloc_init(s->qts);\n for (i = 0; i < queues * 2; i++) {\n vq[i] = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, i);\n }\n@@ -911,14 +909,12 @@ static void test_multiqueue(void)\n g_free(dev->pdev);\n g_free(dev);\n qpci_free_pc(bus);\n- qtest_end();\n\n test_server_free(s);\n }\n\n int main(int argc, char **argv)\n {\n- QTestState *s = NULL;\n TestServer *server = NULL;\n const char *hugefs;\n char *qemu_cmd = NULL;\n@@ -955,7 +951,7 @@ int main(int argc, char **argv)\n\n qemu_cmd = GET_QEMU_CMD(server);\n\n- s = qtest_start(qemu_cmd);\n+ server->qts = qtest_init(qemu_cmd);\n g_free(qemu_cmd);\n init_virtio_dev(server);\n\n@@ -976,10 +972,6 @@ int main(int argc, char **argv)\n\n ret = g_test_run();\n\n- if (s) {\n- qtest_quit(s);\n- }\n-\n /* cleanup */\n test_server_free(server);\n\n", "prefixes": [ "v6", "20/29" ] }