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