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

60061b
From 466d5a7fca84f2932a0b3262f9c62b42d6fb300e Mon Sep 17 00:00:00 2001
60061b
From: Igor Mammedov <imammedo@redhat.com>
60061b
Date: Fri, 14 Jan 2022 09:26:41 -0500
60061b
Subject: [PATCH 11/12] tests: acpi: test short OEM_ID/OEM_TABLE_ID values in
60061b
 test_oem_fields()
60061b
60061b
RH-Author: Igor Mammedov <imammedo@redhat.com>
60061b
RH-MergeRequest: 129: acpi: fix QEMU crash when started with SLIC table
60061b
RH-Commit: [9/10] 9daf8f8c63f513372f81268016885b71f5f89cf3
60061b
RH-Bugzilla: 2059311
60061b
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
60061b
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
60061b
RH-Acked-by: MST <None>
60061b
60061b
Previous patch [1] added explicit whitespace padding to OEM_ID/OEM_TABLE_ID
60061b
values used in test_oem_fields() testcase to avoid false positive and
60061b
bisection issues when QEMU is switched to \0' padding. As result
60061b
testcase ceased to test values that were shorter than max possible
60061b
length values.
60061b
60061b
Update testcase to make sure that it's testing shorter IDs like it
60061b
used to before [2].
60061b
60061b
1) "tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for  test_oem_fields() test"
60061b
2) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
60061b
60061b
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
60061b
Message-Id: <20220114142641.1727679-1-imammedo@redhat.com>
60061b
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
60061b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
60061b
(cherry picked from commit 408ca92634770de5eac7965ed97c6260e770f2e7)
60061b
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
60061b
---
60061b
 tests/qtest/bios-tables-test.c | 12 ++++++------
60061b
 1 file changed, 6 insertions(+), 6 deletions(-)
60061b
60061b
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
60061b
index 348fdbd202..515a647490 100644
60061b
--- a/tests/qtest/bios-tables-test.c
60061b
+++ b/tests/qtest/bios-tables-test.c
60061b
@@ -71,10 +71,10 @@
60061b
 
60061b
 #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML"
60061b
 
60061b
-#define OEM_ID             "TEST  "
60061b
-#define OEM_TABLE_ID       "OEM     "
60061b
-#define OEM_TEST_ARGS      "-machine x-oem-id='" OEM_ID "',x-oem-table-id='" \
60061b
-                           OEM_TABLE_ID "'"
60061b
+#define OEM_ID             "TEST"
60061b
+#define OEM_TABLE_ID       "OEM"
60061b
+#define OEM_TEST_ARGS      "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \
60061b
+                           OEM_TABLE_ID
60061b
 
60061b
 typedef struct {
60061b
     bool tcg_only;
60061b
@@ -1495,8 +1495,8 @@ static void test_oem_fields(test_data *data)
60061b
             continue;
60061b
         }
60061b
 
60061b
-        g_assert(memcmp(sdt->aml + 10, OEM_ID, 6) == 0);
60061b
-        g_assert(memcmp(sdt->aml + 16, OEM_TABLE_ID, 8) == 0);
60061b
+        g_assert(strncmp((char *)sdt->aml + 10, OEM_ID, 6) == 0);
60061b
+        g_assert(strncmp((char *)sdt->aml + 16, OEM_TABLE_ID, 8) == 0);
60061b
     }
60061b
 }
60061b
 
60061b
-- 
60061b
2.27.0
60061b