From nobody Fri Nov 7 10:32:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 154751860508178.34280242499005; Mon, 14 Jan 2019 18:16:45 -0800 (PST) Received: from localhost ([127.0.0.1]:56112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjEHU-0001T1-3b for importer@patchew.org; Mon, 14 Jan 2019 21:16:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjDjl-0007s4-QX for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:41:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjDeI-00083K-TE for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:36:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48156) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjDeI-00082h-EJ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:36:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99800369B7; Tue, 15 Jan 2019 01:36:13 +0000 (UTC) Received: from redhat.com (ovpn-124-229.rdu2.redhat.com [10.10.124.229]) by smtp.corp.redhat.com (Postfix) with SMTP id 954AC6091C; Tue, 15 Jan 2019 01:36:12 +0000 (UTC) Date: Mon, 14 Jan 2019 20:36:12 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20190115003812.11329-16-mst@redhat.com> References: <20190115003812.11329-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190115003812.11329-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Jan 2019 01:36:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/44] tests: acpi: use AcpiSdtTable::aml instead of AcpiSdtTable::header::signature X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov AcpiSdtTable::header::signature is the only remained field from AcpiTableHeader structure used by tests. Instead of using packed structure to access signature, just read it directly from table blob and remove no longer used AcpiSdtTable::header / union and keep only AcpiSdtTable::aml byte array. Signed-off-by: Igor Mammedov Acked-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/acpi-utils.h | 6 +----- tests/bios-tables-test.c | 20 +++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h index cb7183e057..ef388bbf12 100644 --- a/tests/acpi-utils.h +++ b/tests/acpi-utils.h @@ -13,15 +13,11 @@ #ifndef TEST_ACPI_UTILS_H #define TEST_ACPI_UTILS_H =20 -#include "hw/acpi/acpi-defs.h" #include "libqtest.h" =20 /* DSDT and SSDTs format */ typedef struct { - union { - AcpiTableHeader *header; - uint8_t *aml; /* aml bytecode from guest */ - }; + uint8_t *aml; /* aml bytecode from guest */ uint32_t aml_len; gchar *aml_file; gchar *asl; /* asl code generated from aml */ diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 9139decc68..0bf7164590 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -44,6 +44,11 @@ static const char *iasl =3D stringify(CONFIG_IASL); static const char *iasl; #endif =20 +static bool compare_signature(const AcpiSdtTable *sdt, const char *signatu= re) +{ + return !memcmp(sdt->aml, signature, 4); +} + static void cleanup_table_descriptor(AcpiSdtTable *table) { g_free(table->aml); @@ -130,7 +135,7 @@ static void test_acpi_fadt_table(test_data *data) uint8_t *fadt_aml =3D table.aml; uint32_t fadt_len =3D table.aml_len; =20 - ACPI_ASSERT_CMP(table.header->signature, "FACP"); + g_assert(compare_signature(&table, "FACP")); =20 /* Since DSDT/FACS isn't in RSDT, add them to ASL test list manually */ acpi_fetch_table(data->qts, &table.aml, &table.aml_len, @@ -169,7 +174,7 @@ static void dump_aml_files(test_data *data, bool rebuil= d) =20 if (rebuild) { aml_file =3D g_strdup_printf("%s/%s/%.4s%s", data_dir, data->m= achine, - (gchar *)&sdt->header->signature, e= xt); + sdt->aml, ext); fd =3D g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH); } else { @@ -187,11 +192,6 @@ static void dump_aml_files(test_data *data, bool rebui= ld) } } =20 -static bool compare_signature(AcpiSdtTable *sdt, const char *signature) -{ - return !memcmp(&sdt->header->signature, signature, 4); -} - static bool load_asl(GArray *sdts, AcpiSdtTable *sdt) { AcpiSdtTable *temp; @@ -290,7 +290,7 @@ static GArray *load_expected_aml(test_data *data) =20 try_again: aml_file =3D g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machi= ne, - (gchar *)&sdt->header->signature, ext); + sdt->aml, ext); if (getenv("V")) { fprintf(stderr, "Looking for expected file '%s'\n", aml_file); } @@ -350,14 +350,12 @@ static void test_acpi_asl(test_data *data) fprintf(stderr, "Warning! iasl couldn't parse the expected aml\n"); } else { - uint32_t signature =3D cpu_to_le32(exp_sdt->header->signat= ure); sdt->tmp_files_retain =3D true; exp_sdt->tmp_files_retain =3D true; fprintf(stderr, "acpi-test: Warning! %.4s mismatch. " "Actual [asl:%s, aml:%s], Expected [asl:%s, aml:%s= ].\n", - (gchar *)&signature, - sdt->asl_file, sdt->aml_file, + exp_sdt->aml, sdt->asl_file, sdt->aml_file, exp_sdt->asl_file, exp_sdt->aml_file); if (getenv("V")) { const char *diff_cmd =3D getenv("DIFF"); --=20 MST