kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: pbonzini@redhat.com, imammedo@redhat.com
Cc: gleb@kernel.org, mtosatti@redhat.com, stefanha@redhat.com,
	mst@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	dan.j.williams@intel.com, kvm@vger.kernel.org,
	qemu-devel@nongnu.org,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: [PATCH v2 01/11] tests: acpi: test multiple SSDT tables
Date: Wed, 13 Jan 2016 02:50:00 +0800	[thread overview]
Message-ID: <1452624610-46945-2-git-send-email-guangrong.xiao@linux.intel.com> (raw)
In-Reply-To: <1452624610-46945-1-git-send-email-guangrong.xiao@linux.intel.com>

Currently, only one SSDT with default oem-table-id can be tested,
this patch extents it to test all SSDT tables

Other tables except the default one will be named as SSDT-$oem-table-id

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
---
 tests/bios-tables-test.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 75ec330..fc01cce 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -18,6 +18,7 @@
 #include "libqtest.h"
 #include "qemu/compiler.h"
 #include "hw/acpi/acpi-defs.h"
+#include "hw/acpi/aml-build.h"
 #include "hw/smbios/smbios.h"
 #include "qemu/bitmap.h"
 
@@ -379,6 +380,33 @@ static void test_acpi_tables(test_data *data)
     }
 }
 
+static gchar *get_sdt_aml_file_name(test_data *data, AcpiSdtTable *sdt,
+                                    bool skip_variant)
+{
+    gchar *aml_file, *def_oem_table_id, *oem_table_id, *sig_oem;
+    uint32_t signature = cpu_to_le32(sdt->header.signature);
+    const char *ext = data->variant && !skip_variant ? data->variant : "";
+
+    def_oem_table_id = g_strdup_printf("%s%s", ACPI_BUILD_APPNAME4,
+                                       (gchar *)&signature);
+    oem_table_id = g_strndup((char *)sdt->header.oem_table_id,
+                             sizeof(sdt->header.oem_table_id));
+
+    if (strcmp(oem_table_id, def_oem_table_id)) {
+        sig_oem = g_strdup_printf("%.4s-%s", (gchar *)&signature,
+                                  oem_table_id);
+    } else {
+        sig_oem = g_strdup_printf("%.4s", (gchar *)&signature);
+    }
+
+    aml_file = g_strdup_printf("%s/%s/%s%s", data_dir, data->machine,
+                               sig_oem, ext);
+    g_free(sig_oem);
+    g_free(oem_table_id);
+    g_free(def_oem_table_id);
+    return aml_file;
+}
+
 static void dump_aml_files(test_data *data, bool rebuild)
 {
     AcpiSdtTable *sdt;
@@ -389,14 +417,11 @@ static void dump_aml_files(test_data *data, bool rebuild)
     int i;
 
     for (i = 0; i < data->tables->len; ++i) {
-        const char *ext = data->variant ? data->variant : "";
         sdt = &g_array_index(data->tables, AcpiSdtTable, i);
         g_assert(sdt->aml);
 
         if (rebuild) {
-            uint32_t signature = cpu_to_le32(sdt->header.signature);
-            aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
-                                       (gchar *)&signature, ext);
+            aml_file = get_sdt_aml_file_name(data, sdt, false);
             fd = g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT,
                         S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
         } else {
@@ -508,22 +533,18 @@ static GArray *load_expected_aml(test_data *data)
     GArray *exp_tables = g_array_new(false, true, sizeof(AcpiSdtTable));
     for (i = 0; i < data->tables->len; ++i) {
         AcpiSdtTable exp_sdt;
-        uint32_t signature;
-        const char *ext = data->variant ? data->variant : "";
+        bool skip_variant = false;
 
         sdt = &g_array_index(data->tables, AcpiSdtTable, i);
 
         memset(&exp_sdt, 0, sizeof(exp_sdt));
         exp_sdt.header.signature = sdt->header.signature;
 
-        signature = cpu_to_le32(sdt->header.signature);
-
 try_again:
-        aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
-                                   (gchar *)&signature, ext);
+        aml_file = get_sdt_aml_file_name(data, sdt, skip_variant);
         if (data->variant && !g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
             g_free(aml_file);
-            ext = "";
+            skip_variant = true;
             goto try_again;
         }
         exp_sdt.aml_file = aml_file;
-- 
1.8.3.1


  reply	other threads:[~2016-01-12 18:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 18:49 [PATCH v2 00/11] NVDIMM ACPI: introduce the framework of QEMU emulated Xiao Guangrong
2016-01-12 18:50 ` Xiao Guangrong [this message]
2016-01-12 18:50 ` [PATCH v2 02/11] tests: acpi: test NVDIMM tables Xiao Guangrong
2016-02-04 16:20   ` Michael S. Tsirkin
2016-02-14  5:36     ` Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 03/11] acpi: add aml_create_field() Xiao Guangrong
2016-02-08 10:47   ` Igor Mammedov
2016-02-14  5:41     ` Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 04/11] acpi: add aml_concatenate() Xiao Guangrong
2016-02-08 10:51   ` Igor Mammedov
2016-02-14  5:52     ` Xiao Guangrong
2016-02-14  5:55       ` Xiao Guangrong
2016-02-15  9:02         ` Igor Mammedov
2016-02-15 10:32           ` Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 05/11] acpi: allow using object as offset for OperationRegion Xiao Guangrong
2016-02-08 10:57   ` Igor Mammedov
2016-01-12 18:50 ` [PATCH v2 06/11] nvdimm acpi: initialize the resource used by NVDIMM ACPI Xiao Guangrong
2016-02-04 16:22   ` Michael S. Tsirkin
2016-02-08 11:03   ` Igor Mammedov
2016-02-14  5:57     ` Xiao Guangrong
2016-02-15  9:11       ` [Qemu-devel] " Igor Mammedov
2016-02-15  9:18         ` Michael S. Tsirkin
2016-02-15 10:13           ` Xiao Guangrong
2016-02-15 10:30             ` Michael S. Tsirkin
2016-02-15 10:47             ` Igor Mammedov
2016-02-15 11:22               ` Xiao Guangrong
2016-02-15 11:45               ` Michael S. Tsirkin
2016-02-15 13:32                 ` Igor Mammedov
2016-02-15 15:53                   ` Xiao Guangrong
2016-02-15 17:24                     ` Igor Mammedov
2016-02-15 18:35                       ` Xiao Guangrong
2016-02-16 11:00                         ` Igor Mammedov
2016-02-17  2:04                           ` Xiao Guangrong
2016-02-17 17:26                             ` Michael S. Tsirkin
2016-02-18  4:03                               ` Xiao Guangrong
2016-02-18 10:05                                 ` Igor Mammedov
2016-02-19  8:08                                   ` [Qemu-devel] " Michael S. Tsirkin
2016-02-19  8:43                                     ` Dan Williams
2016-02-22 10:30                                       ` Xiao Guangrong
2016-02-22 10:34                                     ` Xiao Guangrong
2016-02-18 10:20                                 ` Michael S. Tsirkin
2016-02-15 11:36             ` Michael S. Tsirkin
2016-01-12 18:50 ` [PATCH v2 07/11] nvdimm acpi: introduce patched dsm memory Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 08/11] nvdimm acpi: let qemu handle _DSM method Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 09/11] nvdimm acpi: emulate dsm method Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 10/11] nvdimm acpi: add _CRS Xiao Guangrong
2016-01-12 18:50 ` [PATCH v2 11/11] tests: acpi: update nvdimm ssdt table Xiao Guangrong
2016-01-20  2:21 ` [PATCH v2 00/11] NVDIMM ACPI: introduce the framework of QEMU emulated Xiao Guangrong
2016-01-28  4:42   ` Xiao Guangrong
2016-02-04 16:24 ` Michael S. Tsirkin
2016-02-14  5:38   ` [Qemu-devel] " Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452624610-46945-2-git-send-email-guangrong.xiao@linux.intel.com \
    --to=guangrong.xiao@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=gleb@kernel.org \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).