diff options
author | 2025-05-02 15:56:30 +0300 | |
---|---|---|
committer | 2025-05-07 06:07:11 +0300 | |
commit | 0b897fbd900e12a08baa3d1a0457944046a882ea (patch) | |
tree | 42f975318748f6ad8345cc576d942a6288c1e39d /drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c | |
parent | wifi: iwlwifi: pcie: don't call itself indirectly (diff) | |
download | wireguard-linux-0b897fbd900e12a08baa3d1a0457944046a882ea.tar.xz wireguard-linux-0b897fbd900e12a08baa3d1a0457944046a882ea.zip |
wifi: iwlwifi: mvm: add command order checks to kunit
We can test this with kunit instead of having the runtime
checks, add a test here to remove the runtime check next.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250502155404.581b60b0833f.I624fb3efc3fa0b155a5da69d7efc39207f133331@changeid
Diffstat (limited to '')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c b/drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c new file mode 100644 index 000000000000..1fee0320c756 --- /dev/null +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * KUnit tests for channel helper functions + * + * Copyright (C) 2025 Intel Corporation + */ +#include <kunit/test.h> + +#include <iwl-trans.h> +#include "../mvm.h" + +MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); + +static void test_hcmd_names_sorted(struct kunit *test) +{ + for (int i = 0; i < iwl_mvm_groups_size; i++) { + const struct iwl_hcmd_arr *arr = &iwl_mvm_groups[i]; + + if (!arr->arr) + continue; + + for (int j = 0; j < arr->size - 1; j++) + KUNIT_EXPECT_LE(test, arr->arr[j].cmd_id, + arr->arr[j + 1].cmd_id); + } +} + +static struct kunit_case hcmd_names_cases[] = { + KUNIT_CASE(test_hcmd_names_sorted), + {}, +}; + +static struct kunit_suite hcmd_names = { + .name = "iwlmvm-hcmd-names", + .test_cases = hcmd_names_cases, +}; + +kunit_test_suite(hcmd_names); |