thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-tests-acpi-test-short-OEM_ID-OEM_TABLE_ID-values-in-.patch

495e37
From d08941e96003ea6bd26d73b4270912670e39e1bc Mon Sep 17 00:00:00 2001
495e37
From: Igor Mammedov <imammedo@redhat.com>
495e37
Date: Fri, 14 Jan 2022 09:26:41 -0500
495e37
Subject: [PATCH 13/14] tests: acpi: test short OEM_ID/OEM_TABLE_ID values in
495e37
 test_oem_fields()
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: [9/10] f1f9991d5d7ef5afb2f98f4fa81aeb3e3cf32d8f
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
Previous patch [1] added explicit whitespace padding to OEM_ID/OEM_TABLE_ID
495e37
values used in test_oem_fields() testcase to avoid false positive and
495e37
bisection issues when QEMU is switched to \0' padding. As result
495e37
testcase ceased to test values that were shorter than max possible
495e37
length values.
495e37
495e37
Update testcase to make sure that it's testing shorter IDs like it
495e37
used to before [2].
495e37
495e37
1) "tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for  test_oem_fields() test"
495e37
2) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
495e37
495e37
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
495e37
Message-Id: <20220114142641.1727679-1-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 408ca92634770de5eac7965ed97c6260e770f2e7)
495e37
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
495e37
---
495e37
 tests/qtest/bios-tables-test.c | 12 ++++++------
495e37
 1 file changed, 6 insertions(+), 6 deletions(-)
495e37
495e37
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
495e37
index cfccfd4408..0dd9a0a55b 100644
495e37
--- a/tests/qtest/bios-tables-test.c
495e37
+++ b/tests/qtest/bios-tables-test.c
495e37
@@ -71,10 +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='" \
495e37
-                           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
@@ -1493,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(strncmp((char *)sdt->aml + 10, OEM_ID, 6) == 0);
495e37
+        g_assert(strncmp((char *)sdt->aml + 16, OEM_TABLE_ID, 8) == 0);
495e37
     }
495e37
 }
495e37
 
495e37
-- 
495e37
2.31.1
495e37