[{"id":1763210,"web_url":"http://patchwork.ozlabs.org/comment/1763210/","msgid":"<941b7e45-7dfc-8e35-18e0-12b247481d1e@redhat.com>","list_archive_url":null,"date":"2017-09-05T10:59:21","subject":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_qtest","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 01.09.2017 20:03, Eric Blake wrote:\n> As a general rule, we prefer avoiding implicit global state\n> because it makes code harder to safely copy and paste without\n> thinking about the global state.  Although bios-tables-test does\n> not maintain parallel qtest connections, it's just as easy to be\n> explicit about the state; once all tests have been cleaned up, a\n> later patch can then get rid of global_qtest and a layer of\n> wrappers in libqtest.\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n> ---\n>  tests/bios-tables-test.c | 78 +++++++++++++++++++++++++-----------------------\n>  1 file changed, 40 insertions(+), 38 deletions(-)\n> \n> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c\n> index 75b29df493..976792f2c5 100644\n> --- a/tests/bios-tables-test.c\n> +++ b/tests/bios-tables-test.c\n> @@ -38,6 +38,7 @@ typedef struct {\n>      struct smbios_21_entry_point smbios_ep_table;\n>      uint8_t *required_struct_types;\n>      int required_struct_types_len;\n> +    QTestState *qts;\n>  } test_data;\n\nAh, well, ok, here it is. Please merge this with the previous patch!\n\n Thomas","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-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@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 3xmkK26Gt4z9sP3\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 21:00:38 +1000 (AEST)","from localhost ([::1]:58090 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 1dpBav-0007rM-1D\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 07:00:37 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:39574)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpBZu-0007JW-5g\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 06:59:38 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpBZp-0005cP-Ir\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 06:59:34 -0400","from mx1.redhat.com ([209.132.183.28]:42506)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>) id 1dpBZp-0005bL-Cz\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 06:59:29 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 305CC7E428\n\tfor <qemu-devel@nongnu.org>; Tue,  5 Sep 2017 10:59:28 +0000 (UTC)","from [10.36.116.114] (ovpn-116-114.ams2.redhat.com [10.36.116.114])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id A6CD282433;\n\tTue,  5 Sep 2017 10:59:22 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 305CC7E428","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-25-eblake@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<941b7e45-7dfc-8e35-18e0-12b247481d1e@redhat.com>","Date":"Tue, 5 Sep 2017 12:59:21 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-25-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tTue, 05 Sep 2017 10:59:28 +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":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_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, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\tarmbru@redhat.com, Igor Mammedov <imammedo@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>"}},{"id":1764953,"web_url":"http://patchwork.ozlabs.org/comment/1764953/","msgid":"<c127b8de-4973-3c0c-503e-f060080f2a16@redhat.com>","list_archive_url":null,"date":"2017-09-07T21:30:25","subject":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_qtest","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/05/2017 05:59 AM, Thomas Huth wrote:\n> On 01.09.2017 20:03, Eric Blake wrote:\n>> As a general rule, we prefer avoiding implicit global state\n>> because it makes code harder to safely copy and paste without\n>> thinking about the global state.  Although bios-tables-test does\n>> not maintain parallel qtest connections, it's just as easy to be\n>> explicit about the state; once all tests have been cleaned up, a\n>> later patch can then get rid of global_qtest and a layer of\n>> wrappers in libqtest.\n>>\n>> Signed-off-by: Eric Blake <eblake@redhat.com>\n>> ---\n>>  tests/bios-tables-test.c | 78 +++++++++++++++++++++++++-----------------------\n>>  1 file changed, 40 insertions(+), 38 deletions(-)\n>>\n>> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c\n>> index 75b29df493..976792f2c5 100644\n>> --- a/tests/bios-tables-test.c\n>> +++ b/tests/bios-tables-test.c\n>> @@ -38,6 +38,7 @@ typedef struct {\n>>      struct smbios_21_entry_point smbios_ep_table;\n>>      uint8_t *required_struct_types;\n>>      int required_struct_types_len;\n>> +    QTestState *qts;\n>>  } test_data;\n> \n> Ah, well, ok, here it is. Please merge this with the previous patch!\n\nSure, I'll merge the two.","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-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.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 3xpDCY4zsWz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 07:31:05 +1000 (AEST)","from localhost ([::1]:42336 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 1dq4O7-0000gA-Q2\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 17:31:03 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46675)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dq4Nh-0000fU-42\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:30:44 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dq4Nc-00062P-CN\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:30:37 -0400","from mx1.redhat.com ([209.132.183.28]:46262)\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 1dq4Nc-00062H-38\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:30:32 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\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 EADBA81DE3\n\tfor <qemu-devel@nongnu.org>; Thu,  7 Sep 2017 21:30:30 +0000 (UTC)","from [10.10.120.228] (ovpn-120-228.rdu2.redhat.com [10.10.120.228])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 6380C18C65;\n\tThu,  7 Sep 2017 21:30:27 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com EADBA81DE3","To":"Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-25-eblake@redhat.com>\n\t<941b7e45-7dfc-8e35-18e0-12b247481d1e@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<c127b8de-4973-3c0c-503e-f060080f2a16@redhat.com>","Date":"Thu, 7 Sep 2017 16:30:25 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<941b7e45-7dfc-8e35-18e0-12b247481d1e@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"nlpSDa6snG1odAvUnr0hGs3j758Jg9B0w\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tThu, 07 Sep 2017 21:30:31 +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","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_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, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\tarmbru@redhat.com, Igor Mammedov <imammedo@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>"}},{"id":1765308,"web_url":"http://patchwork.ozlabs.org/comment/1765308/","msgid":"<20170908154901-mutt-send-email-mst@kernel.org>","list_archive_url":null,"date":"2017-09-08T12:49:06","subject":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_qtest","submitter":{"id":2235,"url":"http://patchwork.ozlabs.org/api/people/2235/","name":"Michael S. Tsirkin","email":"mst@redhat.com"},"content":"On Fri, Sep 01, 2017 at 01:03:35PM -0500, Eric Blake wrote:\n> As a general rule, we prefer avoiding implicit global state\n> because it makes code harder to safely copy and paste without\n> thinking about the global state.  Although bios-tables-test does\n> not maintain parallel qtest connections, it's just as easy to be\n> explicit about the state; once all tests have been cleaned up, a\n> later patch can then get rid of global_qtest and a layer of\n> wrappers in libqtest.\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n\nAcked-by: Michael S. Tsirkin <mst@redhat.com>\n\n> ---\n>  tests/bios-tables-test.c | 78 +++++++++++++++++++++++++-----------------------\n>  1 file changed, 40 insertions(+), 38 deletions(-)\n> \n> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c\n> index 75b29df493..976792f2c5 100644\n> --- a/tests/bios-tables-test.c\n> +++ b/tests/bios-tables-test.c\n> @@ -38,6 +38,7 @@ typedef struct {\n>      struct smbios_21_entry_point smbios_ep_table;\n>      uint8_t *required_struct_types;\n>      int required_struct_types_len;\n> +    QTestState *qts;\n>  } test_data;\n> \n>  static char disk[] = \"tests/acpi-test-disk-XXXXXX\";\n> @@ -77,7 +78,7 @@ static void free_test_data(test_data *data)\n> \n>  static void test_acpi_rsdp_address(test_data *data)\n>  {\n> -    uint32_t off = acpi_find_rsdp_address(global_qtest);\n> +    uint32_t off = acpi_find_rsdp_address(data->qts);\n>      g_assert_cmphex(off, <, 0x100000);\n>      data->rsdp_addr = off;\n>  }\n> @@ -87,7 +88,7 @@ static void test_acpi_rsdp_table(test_data *data)\n>      AcpiRsdpDescriptor *rsdp_table = &data->rsdp_table;\n>      uint32_t addr = data->rsdp_addr;\n> \n> -    acpi_parse_rsdp_table(global_qtest, addr, rsdp_table);\n> +    acpi_parse_rsdp_table(data->qts, addr, rsdp_table);\n> \n>      /* rsdp checksum is not for the whole table, but for the first 20 bytes */\n>      g_assert(!acpi_calc_checksum((uint8_t *)rsdp_table, 20));\n> @@ -102,7 +103,7 @@ static void test_acpi_rsdt_table(test_data *data)\n>      uint8_t checksum;\n> \n>      /* read the header */\n> -    ACPI_READ_TABLE_HEADER(global_qtest, rsdt_table, addr);\n> +    ACPI_READ_TABLE_HEADER(data->qts, rsdt_table, addr);\n>      ACPI_ASSERT_CMP(rsdt_table->signature, \"RSDT\");\n> \n>      /* compute the table entries in rsdt */\n> @@ -112,7 +113,7 @@ static void test_acpi_rsdt_table(test_data *data)\n> \n>      /* get the addresses of the tables pointed by rsdt */\n>      tables = g_new0(uint32_t, tables_nr);\n> -    ACPI_READ_ARRAY_PTR(global_qtest, tables, tables_nr, addr);\n> +    ACPI_READ_ARRAY_PTR(data->qts, tables, tables_nr, addr);\n> \n>      checksum = acpi_calc_checksum((uint8_t *)rsdt_table, rsdt_table->length) +\n>                 acpi_calc_checksum((uint8_t *)tables,\n> @@ -128,7 +129,7 @@ static void test_acpi_fadt_table(test_data *data)\n>  {\n>      AcpiFadtDescriptorRev3 *fadt_table = &data->fadt_table;\n>      uint32_t addr;\n> -    QTestState *qts = global_qtest;\n> +    QTestState *qts = data->qts;\n> \n>      /* FADT table comes first */\n>      addr = data->rsdt_tables_addr[0];\n> @@ -196,26 +197,27 @@ static void test_acpi_facs_table(test_data *data)\n>      AcpiFacsDescriptorRev1 *facs_table = &data->facs_table;\n>      uint32_t addr = data->fadt_table.firmware_ctrl;\n> \n> -    ACPI_READ_FIELD(global_qtest, facs_table->signature, addr);\n> -    ACPI_READ_FIELD(global_qtest, facs_table->length, addr);\n> -    ACPI_READ_FIELD(global_qtest, facs_table->hardware_signature, addr);\n> -    ACPI_READ_FIELD(global_qtest, facs_table->firmware_waking_vector, addr);\n> -    ACPI_READ_FIELD(global_qtest, facs_table->global_lock, addr);\n> -    ACPI_READ_FIELD(global_qtest, facs_table->flags, addr);\n> -    ACPI_READ_ARRAY(global_qtest, facs_table->resverved3, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->signature, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->length, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->hardware_signature, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->firmware_waking_vector, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->global_lock, addr);\n> +    ACPI_READ_FIELD(data->qts, facs_table->flags, addr);\n> +    ACPI_READ_ARRAY(data->qts, facs_table->resverved3, addr);\n> \n>      ACPI_ASSERT_CMP(facs_table->signature, \"FACS\");\n>  }\n> \n> -static void test_dst_table(AcpiSdtTable *sdt_table, uint32_t addr)\n> +static void test_dst_table(test_data *data, AcpiSdtTable *sdt_table,\n> +                           uint32_t addr)\n>  {\n>      uint8_t checksum;\n> \n> -    ACPI_READ_TABLE_HEADER(global_qtest, &sdt_table->header, addr);\n> +    ACPI_READ_TABLE_HEADER(data->qts, &sdt_table->header, addr);\n> \n>      sdt_table->aml_len = sdt_table->header.length - sizeof(AcpiTableHeader);\n>      sdt_table->aml = g_malloc0(sdt_table->aml_len);\n> -    ACPI_READ_ARRAY_PTR(global_qtest, sdt_table->aml, sdt_table->aml_len, addr);\n> +    ACPI_READ_ARRAY_PTR(data->qts, sdt_table->aml, sdt_table->aml_len, addr);\n> \n>      checksum = acpi_calc_checksum((uint8_t *)sdt_table,\n>                                    sizeof(AcpiTableHeader)) +\n> @@ -232,7 +234,7 @@ static void test_acpi_dsdt_table(test_data *data)\n>      memset(&dsdt_table, 0, sizeof(dsdt_table));\n>      data->tables = g_array_new(false, true, sizeof(AcpiSdtTable));\n> \n> -    test_dst_table(&dsdt_table, addr);\n> +    test_dst_table(data, &dsdt_table, addr);\n>      ACPI_ASSERT_CMP(dsdt_table.header.signature, \"DSDT\");\n> \n>      /* Place DSDT first */\n> @@ -249,7 +251,7 @@ static void test_acpi_tables(test_data *data)\n> \n>          memset(&ssdt_table, 0, sizeof(ssdt_table));\n>          uint32_t addr = data->rsdt_tables_addr[i + 1]; /* fadt is first */\n> -        test_dst_table(&ssdt_table, addr);\n> +        test_dst_table(data, &ssdt_table, addr);\n>          g_array_append_val(data->tables, ssdt_table);\n>      }\n>  }\n> @@ -493,32 +495,32 @@ static bool smbios_ep_table_ok(test_data *data)\n>      struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;\n>      uint32_t addr = data->smbios_ep_addr;\n> \n> -    ACPI_READ_ARRAY(global_qtest, ep_table->anchor_string, addr);\n> +    ACPI_READ_ARRAY(data->qts, ep_table->anchor_string, addr);\n>      if (memcmp(ep_table->anchor_string, \"_SM_\", 4)) {\n>          return false;\n>      }\n> -    ACPI_READ_FIELD(global_qtest, ep_table->checksum, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->length, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->smbios_major_version, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->smbios_minor_version, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->max_structure_size, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->entry_point_revision, addr);\n> -    ACPI_READ_ARRAY(global_qtest, ep_table->formatted_area, addr);\n> -    ACPI_READ_ARRAY(global_qtest, ep_table->intermediate_anchor_string, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->checksum, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->length, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->smbios_major_version, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->smbios_minor_version, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->max_structure_size, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->entry_point_revision, addr);\n> +    ACPI_READ_ARRAY(data->qts, ep_table->formatted_area, addr);\n> +    ACPI_READ_ARRAY(data->qts, ep_table->intermediate_anchor_string, addr);\n>      if (memcmp(ep_table->intermediate_anchor_string, \"_DMI_\", 5)) {\n>          return false;\n>      }\n> -    ACPI_READ_FIELD(global_qtest, ep_table->intermediate_checksum, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->structure_table_length, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->intermediate_checksum, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->structure_table_length, addr);\n>      if (ep_table->structure_table_length == 0) {\n>          return false;\n>      }\n> -    ACPI_READ_FIELD(global_qtest, ep_table->structure_table_address, addr);\n> -    ACPI_READ_FIELD(global_qtest, ep_table->number_of_structures, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->structure_table_address, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->number_of_structures, addr);\n>      if (ep_table->number_of_structures == 0) {\n>          return false;\n>      }\n> -    ACPI_READ_FIELD(global_qtest, ep_table->smbios_bcd_revision, addr);\n> +    ACPI_READ_FIELD(data->qts, ep_table->smbios_bcd_revision, addr);\n>      if (acpi_calc_checksum((uint8_t *)ep_table, sizeof *ep_table) ||\n>          acpi_calc_checksum((uint8_t *)ep_table + 0x10,\n>                             sizeof *ep_table - 0x10)) {\n> @@ -537,7 +539,7 @@ static void test_smbios_entry_point(test_data *data)\n>          int i;\n> \n>          for (i = 0; i < sizeof sig - 1; ++i) {\n> -            sig[i] = readb(off + i);\n> +            sig[i] = qtest_readb(data->qts, off + i);\n>          }\n> \n>          if (!memcmp(sig, \"_SM_\", sizeof sig)) {\n> @@ -580,9 +582,9 @@ static void test_smbios_structs(test_data *data)\n>      for (i = 0; i < ep_table->number_of_structures; i++) {\n> \n>          /* grab type and formatted area length from struct header */\n> -        type = readb(addr);\n> +        type = qtest_readb(data->qts, addr);\n>          g_assert_cmpuint(type, <=, SMBIOS_MAX_TYPE);\n> -        len = readb(addr + 1);\n> +        len = qtest_readb(data->qts, addr + 1);\n> \n>          /* single-instance structs must not have been encountered before */\n>          if (smbios_single_instance(type)) {\n> @@ -594,7 +596,7 @@ static void test_smbios_structs(test_data *data)\n>          prv = crt = 1;\n>          while (prv || crt) {\n>              prv = crt;\n> -            crt = readb(addr + len);\n> +            crt = qtest_readb(data->qts, addr + len);\n>              len++;\n>          }\n> \n> @@ -631,9 +633,9 @@ static void test_acpi_one(const char *params, test_data *data)\n>                             data->machine, \"kvm:tcg\",\n>                             params ? params : \"\", disk);\n> \n> -    qtest_start(args);\n> +    data->qts = qtest_init(args);\n> \n> -    boot_sector_test(global_qtest);\n> +    boot_sector_test(data->qts);\n> \n>      test_acpi_rsdp_address(data);\n>      test_acpi_rsdp_table(data);\n> @@ -654,7 +656,7 @@ static void test_acpi_one(const char *params, test_data *data)\n>      test_smbios_entry_point(data);\n>      test_smbios_structs(data);\n> \n> -    qtest_quit(global_qtest);\n> +    qtest_quit(data->qts);\n>      g_free(args);\n>  }\n> \n> -- \n> 2.13.5\n>","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-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mst@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 3xpcdJ0bMlz9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 22:51:15 +1000 (AEST)","from localhost ([::1]:45309 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 1dqIkb-0004K5-96\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 08:51:13 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50695)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mst@redhat.com>) id 1dqIig-0003F7-NK\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 08:49:16 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mst@redhat.com>) id 1dqIib-0001WJ-Pj\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 08:49:14 -0400","from mx1.redhat.com ([209.132.183.28]:39444)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mst@redhat.com>) id 1dqIib-0001Va-Gz\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 08:49:09 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\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 887C681DFA\n\tfor <qemu-devel@nongnu.org>; Fri,  8 Sep 2017 12:49:08 +0000 (UTC)","from redhat.com (ovpn-120-144.rdu2.redhat.com [10.10.120.144])\n\tby smtp.corp.redhat.com (Postfix) with SMTP id 4F21D614C0;\n\tFri,  8 Sep 2017 12:49:07 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 887C681DFA","Date":"Fri, 8 Sep 2017 15:49:06 +0300","From":"\"Michael S. Tsirkin\" <mst@redhat.com>","To":"Eric Blake <eblake@redhat.com>","Message-ID":"<20170908154901-mutt-send-email-mst@kernel.org>","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-25-eblake@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170901180340.30009-25-eblake@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tFri, 08 Sep 2017 12:49:08 +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":"Re: [Qemu-devel] [PATCH v6 24/29] bios-tables-test: Drop dependence\n\ton global_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, qemu-devel@nongnu.org, armbru@redhat.com,\n\tIgor Mammedov <imammedo@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>"}}]