Skip to content

Commit 220c01a

Browse files
jmberg-intelMiriam-Rachel
authored andcommitted
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
1 parent 1feda9a commit 220c01a

File tree

1 file changed

+19
-0
lines changed
  • drivers/net/wireless/intel/iwlwifi/tests

1 file changed

+19
-0
lines changed

drivers/net/wireless/intel/iwlwifi/tests/devinfo.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ static void devinfo_no_cfg_dups(struct kunit *test)
9999
}
100100
}
101101

102+
static void devinfo_no_name_dups(struct kunit *test)
103+
{
104+
for (int i = 0; i < iwl_dev_info_table_size; i++) {
105+
for (int j = 0; j < i; j++) {
106+
if (iwl_dev_info_table[i].name == iwl_dev_info_table[j].name)
107+
continue;
108+
109+
KUNIT_EXPECT_NE_MSG(test,
110+
strcmp(iwl_dev_info_table[i].name,
111+
iwl_dev_info_table[j].name),
112+
0,
113+
"name dup: %ps/%ps",
114+
iwl_dev_info_table[i].name,
115+
iwl_dev_info_table[j].name);
116+
}
117+
}
118+
}
119+
102120
static void devinfo_check_subdev_match(struct kunit *test)
103121
{
104122
for (int i = 0; i < iwl_dev_info_table_size; i++) {
@@ -198,6 +216,7 @@ static struct kunit_case devinfo_test_cases[] = {
198216
KUNIT_CASE(devinfo_table_order),
199217
KUNIT_CASE(devinfo_names),
200218
KUNIT_CASE(devinfo_no_cfg_dups),
219+
KUNIT_CASE(devinfo_no_name_dups),
201220
KUNIT_CASE(devinfo_check_subdev_match),
202221
KUNIT_CASE(devinfo_check_killer_subdev),
203222
KUNIT_CASE(devinfo_pci_ids),

0 commit comments

Comments
 (0)