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

4841a6
From 485bf2eb8edabd4553d995d5e32224df1e510aa2 Mon Sep 17 00:00:00 2001
4841a6
From: Jon Maloy <jmaloy@redhat.com>
4841a6
Date: Wed, 30 Mar 2022 14:52:34 -0400
4841a6
Subject: [PATCH 17/18] tests: acpi: test short OEM_ID/OEM_TABLE_ID values in
60061b
 test_oem_fields()
60061b
4841a6
RH-Author: Jon Maloy <jmaloy@redhat.com>
4841a6
RH-MergeRequest: 141: acpi: fix QEMU crash when started with SLIC table
4841a6
RH-Commit: [9/10] 31339223fb6c6cc32185b9fdaac76f2709b17ad6 (jmaloy/qemu-kvm)
4841a6
RH-Bugzilla: 2062611
4841a6
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
4841a6
4841a6
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2062611
4841a6
Upstream: Merged
4841a6
4841a6
commit 408ca92634770de5eac7965ed97c6260e770f2e7
4841a6
Author: Igor Mammedov <imammedo@redhat.com>
4841a6
Date:   Fri Jan 14 09:26:41 2022 -0500
4841a6
4841a6
    tests: acpi: test short OEM_ID/OEM_TABLE_ID values in test_oem_fields()
4841a6
4841a6
    Previous patch [1] added explicit whitespace padding to OEM_ID/OEM_TABLE_ID
4841a6
    values used in test_oem_fields() testcase to avoid false positive and
4841a6
    bisection issues when QEMU is switched to \0' padding. As result
4841a6
    testcase ceased to test values that were shorter than max possible
4841a6
    length values.
4841a6
4841a6
    Update testcase to make sure that it's testing shorter IDs like it
4841a6
    used to before [2].
4841a6
4841a6
    1) "tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for  test_oem_fields() test"
4841a6
    2) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
4841a6
4841a6
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
4841a6
    Message-Id: <20220114142641.1727679-1-imammedo@redhat.com>
4841a6
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4841a6
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
4841a6
60061b
(cherry picked from commit 408ca92634770de5eac7965ed97c6260e770f2e7)
4841a6
Signed-off-by: Jon Maloy <jmaloy@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