[PATCH 3/4] test: consider index parameter in acpi_find_table test
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Tue Apr 21 00:08:03 CEST 2026
* Add a duplicate table.
* Check that both instances can be found.
* Verify index bound checks.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
test/dm/acpi.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 8bec09f4e44..ba533763d96 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -783,7 +783,7 @@ static int dm_test_acpi_find_table(struct unit_test_state *uts)
struct acpi_ctx ctx;
ulong acpi_start, addr;
void *buf;
- struct acpi_table_header *table, *table1, *table2, *table3;
+ struct acpi_table_header *table, *table1, *table2, *table3, *table4;
struct acpi_rsdp *rsdp;
ulong rsdt;
ulong xsdt;
@@ -799,6 +799,7 @@ static int dm_test_acpi_find_table(struct unit_test_state *uts)
table3 = dm_test_write_test_table(&ctx, 3);
table1 = dm_test_write_test_table(&ctx, 1);
table2 = dm_test_write_test_table(&ctx, 2);
+ table4 = dm_test_write_test_table(&ctx, 1);
/* Retrieve RSDP, RSDT, XSDT */
rsdp = map_sysmem(gd_acpi_start(), 0);
@@ -812,6 +813,11 @@ static int dm_test_acpi_find_table(struct unit_test_state *uts)
table = acpi_find_table("TST1", 0);
ut_asserteq_ptr(table1, table);
ut_asserteq_strn("TST1", table->signature);
+ table = acpi_find_table("TST1", 1);
+ ut_asserteq_ptr(table4, table);
+ ut_asserteq_strn("TST1", table->signature);
+ table = acpi_find_table("TST1", 2);
+ ut_assertnull(table);
table = acpi_find_table("TST2", 0);
ut_asserteq_ptr(table2, table);
ut_asserteq_strn("TST2", table->signature);
@@ -823,6 +829,10 @@ static int dm_test_acpi_find_table(struct unit_test_state *uts)
rsdp->rsdt_address = 0;
table = acpi_find_table("TST1", 0);
ut_asserteq_ptr(table1, table);
+ table = acpi_find_table("TST1", 1);
+ ut_asserteq_ptr(table4, table);
+ table = acpi_find_table("TST1", 2);
+ ut_assertnull(table);
table = acpi_find_table("TST2", 0);
ut_asserteq_ptr(table2, table);
table = acpi_find_table("TST3", 0);
@@ -833,6 +843,10 @@ static int dm_test_acpi_find_table(struct unit_test_state *uts)
rsdp->xsdt_address = 0;
table = acpi_find_table("TST1", 0);
ut_asserteq_ptr(table1, table);
+ table = acpi_find_table("TST1", 1);
+ ut_asserteq_ptr(table4, table);
+ table = acpi_find_table("TST1", 2);
+ ut_assertnull(table);
table = acpi_find_table("TST2", 0);
ut_asserteq_ptr(table2, table);
table = acpi_find_table("TST3", 0);
--
2.53.0
More information about the U-Boot
mailing list