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

495e37
From 80fdb82bab21ab0d094795287ce903d0d48974fc Mon Sep 17 00:00:00 2001
495e37
From: Igor Mammedov <imammedo@redhat.com>
495e37
Date: Wed, 12 Jan 2022 08:03:29 -0500
495e37
Subject: [PATCH 09/14] tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for
495e37
 test_oem_fields() test
495e37
495e37
RH-Author: Igor Mammedov <imammedo@redhat.com>
495e37
RH-MergeRequest: 130: acpi: fix QEMU crash when started with SLIC table
495e37
RH-Commit: [5/10] 7d55865be1e1574605734c2663bac233e87b8134
495e37
RH-Bugzilla: 2043531
495e37
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
495e37
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
RH-Acked-by: MST <None>
495e37
495e37
The next commit will revert OEM fields padding with whitespace to
495e37
padding with '\0' as it was before [1]. As result test_oem_fields() will
495e37
fail due to unexpectedly smaller ID sizes read from QEMU ACPI tables.
495e37
495e37
Pad OEM_ID/OEM_TABLE_ID manually with spaces so that values the test
495e37
puts on QEMU CLI and expected values match.
495e37
495e37
1) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
495e37
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
495e37
Message-Id: <20220112130332.1648664-2-imammedo@redhat.com>
495e37
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
495e37
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
495e37
(cherry picked from commit a849522f726767022203ef2b6c395ea19facb866)
495e37
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
495e37
---
495e37
 tests/qtest/bios-tables-test.c | 15 ++++++---------
495e37
 1 file changed, 6 insertions(+), 9 deletions(-)
495e37
495e37
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
495e37
index 088609c196..cfccfd4408 100644
495e37
--- a/tests/qtest/bios-tables-test.c
495e37
+++ b/tests/qtest/bios-tables-test.c
495e37
@@ -71,9 +71,10 @@
495e37
 
495e37
 #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML"
495e37
 
495e37
-#define OEM_ID             "TEST"
495e37
-#define OEM_TABLE_ID       "OEM"
495e37
-#define OEM_TEST_ARGS      "-machine x-oem-id="OEM_ID",x-oem-table-id="OEM_TABLE_ID
495e37
+#define OEM_ID             "TEST  "
495e37
+#define OEM_TABLE_ID       "OEM     "
495e37
+#define OEM_TEST_ARGS      "-machine x-oem-id='" OEM_ID "',x-oem-table-id='" \
495e37
+                           OEM_TABLE_ID "'"
495e37
 
495e37
 typedef struct {
495e37
     bool tcg_only;
495e37
@@ -1482,11 +1483,7 @@ static void test_acpi_q35_slic(void)
495e37
 static void test_oem_fields(test_data *data)
495e37
 {
495e37
     int i;
495e37
-    char oem_id[6];
495e37
-    char oem_table_id[8];
495e37
 
495e37
-    strpadcpy(oem_id, sizeof oem_id, OEM_ID, ' ');
495e37
-    strpadcpy(oem_table_id, sizeof oem_table_id, OEM_TABLE_ID, ' ');
495e37
     for (i = 0; i < data->tables->len; ++i) {
495e37
         AcpiSdtTable *sdt;
495e37
 
495e37
@@ -1496,8 +1493,8 @@ static void test_oem_fields(test_data *data)
495e37
             continue;
495e37
         }
495e37
 
495e37
-        g_assert(memcmp(sdt->aml + 10, oem_id, 6) == 0);
495e37
-        g_assert(memcmp(sdt->aml + 16, oem_table_id, 8) == 0);
495e37
+        g_assert(memcmp(sdt->aml + 10, OEM_ID, 6) == 0);
495e37
+        g_assert(memcmp(sdt->aml + 16, OEM_TABLE_ID, 8) == 0);
495e37
     }
495e37
 }
495e37
 
495e37
-- 
495e37
2.31.1
495e37