wifi: iwlwifi: tests: check for duplicate name strings

We don't need the same name multiple times in the binary,
add a check for that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250502155404.9adf2790122e.Ia85152c072c7944f0b80e819cf59a51d6adeb49a@changeid
This commit is contained in:
Johannes Berg
2025-05-02 15:56:26 +03:00
committed by Miri Korenblit
parent 1feda9a23e
commit 220c01a6fd

View File

@@ -99,6 +99,24 @@ static void devinfo_no_cfg_dups(struct kunit *test)
}
}
static void devinfo_no_name_dups(struct kunit *test)
{
for (int i = 0; i < iwl_dev_info_table_size; i++) {
for (int j = 0; j < i; j++) {
if (iwl_dev_info_table[i].name == iwl_dev_info_table[j].name)
continue;
KUNIT_EXPECT_NE_MSG(test,
strcmp(iwl_dev_info_table[i].name,
iwl_dev_info_table[j].name),
0,
"name dup: %ps/%ps",
iwl_dev_info_table[i].name,
iwl_dev_info_table[j].name);
}
}
}
static void devinfo_check_subdev_match(struct kunit *test)
{
for (int i = 0; i < iwl_dev_info_table_size; i++) {
@@ -198,6 +216,7 @@ static struct kunit_case devinfo_test_cases[] = {
KUNIT_CASE(devinfo_table_order),
KUNIT_CASE(devinfo_names),
KUNIT_CASE(devinfo_no_cfg_dups),
KUNIT_CASE(devinfo_no_name_dups),
KUNIT_CASE(devinfo_check_subdev_match),
KUNIT_CASE(devinfo_check_killer_subdev),
KUNIT_CASE(devinfo_pci_ids),