thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-tests-acpi-manually-pad-OEM_ID-OEM_TABLE_ID-for-test.patch

0727d3
From d94b3278c84cf7451489631d804a6b5cbd28a59d Mon Sep 17 00:00:00 2001
0727d3
From: Jon Maloy <jmaloy@redhat.com>
0727d3
Date: Wed, 30 Mar 2022 14:52:34 -0400
0727d3
Subject: [PATCH 13/18] tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for
0727d3
 test_oem_fields() test
0727d3
0727d3
RH-Author: Jon Maloy <jmaloy@redhat.com>
0727d3
RH-MergeRequest: 141: acpi: fix QEMU crash when started with SLIC table
0727d3
RH-Commit: [5/10] 4ec8c738acec178c2f005f189b0c2a77a7af4088 (jmaloy/qemu-kvm)
0727d3
RH-Bugzilla: 2062611
0727d3
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0727d3
0727d3
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2062611
0727d3
Upstream: Merged
0727d3
0727d3
commit a849522f726767022203ef2b6c395ea19facb866
0727d3
Author: Igor Mammedov <imammedo@redhat.com>
0727d3
Date:   Wed Jan 12 08:03:29 2022 -0500
0727d3
0727d3
    tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for test_oem_fields() test
0727d3
0727d3
    The next commit will revert OEM fields padding with whitespace to
0727d3
    padding with '\0' as it was before [1]. As result test_oem_fields() will
0727d3
    fail due to unexpectedly smaller ID sizes read from QEMU ACPI tables.
0727d3
0727d3
    Pad OEM_ID/OEM_TABLE_ID manually with spaces so that values the test
0727d3
    puts on QEMU CLI and expected values match.
0727d3
0727d3
    1) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
0727d3
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
0727d3
    Message-Id: <20220112130332.1648664-2-imammedo@redhat.com>
0727d3
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
0727d3
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0727d3
0727d3
(cherry picked from commit a849522f726767022203ef2b6c395ea19facb866)
0727d3
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
0727d3
---
0727d3
 tests/qtest/bios-tables-test.c | 15 ++++++---------
0727d3
 1 file changed, 6 insertions(+), 9 deletions(-)
0727d3
0727d3
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
0727d3
index e159b71136..348fdbd202 100644
0727d3
--- a/tests/qtest/bios-tables-test.c
0727d3
+++ b/tests/qtest/bios-tables-test.c
0727d3
@@ -71,9 +71,10 @@
0727d3
 
0727d3
 #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML"
0727d3
 
0727d3
-#define OEM_ID             "TEST"
0727d3
-#define OEM_TABLE_ID       "OEM"
0727d3
-#define OEM_TEST_ARGS      "-machine x-oem-id="OEM_ID",x-oem-table-id="OEM_TABLE_ID
0727d3
+#define OEM_ID             "TEST  "
0727d3
+#define OEM_TABLE_ID       "OEM     "
0727d3
+#define OEM_TEST_ARGS      "-machine x-oem-id='" OEM_ID "',x-oem-table-id='" \
0727d3
+                           OEM_TABLE_ID "'"
0727d3
 
0727d3
 typedef struct {
0727d3
     bool tcg_only;
0727d3
@@ -1484,11 +1485,7 @@ static void test_acpi_q35_slic(void)
0727d3
 static void test_oem_fields(test_data *data)
0727d3
 {
0727d3
     int i;
0727d3
-    char oem_id[6];
0727d3
-    char oem_table_id[8];
0727d3
 
0727d3
-    strpadcpy(oem_id, sizeof oem_id, OEM_ID, ' ');
0727d3
-    strpadcpy(oem_table_id, sizeof oem_table_id, OEM_TABLE_ID, ' ');
0727d3
     for (i = 0; i < data->tables->len; ++i) {
0727d3
         AcpiSdtTable *sdt;
0727d3
 
0727d3
@@ -1498,8 +1495,8 @@ static void test_oem_fields(test_data *data)
0727d3
             continue;
0727d3
         }
0727d3
 
0727d3
-        g_assert(memcmp(sdt->aml + 10, oem_id, 6) == 0);
0727d3
-        g_assert(memcmp(sdt->aml + 16, oem_table_id, 8) == 0);
0727d3
+        g_assert(memcmp(sdt->aml + 10, OEM_ID, 6) == 0);
0727d3
+        g_assert(memcmp(sdt->aml + 16, OEM_TABLE_ID, 8) == 0);
0727d3
     }
0727d3
 }
0727d3
 
0727d3
-- 
0727d3
2.27.0
0727d3