[PATCH 22/30] smb/client: introduce KUnit test to check sort result of mapping_table_ERRDOS array

chenxiaosong.chenxiaosong@linux.dev posted 30 patches 1 week, 4 days ago
[PATCH 22/30] smb/client: introduce KUnit test to check sort result of mapping_table_ERRDOS array
Posted by chenxiaosong.chenxiaosong@linux.dev 1 week, 4 days ago
From: ChenXiaoSong <chenxiaosong@kylinos.cn>

The KUnit test are executed when cifs.ko is loaded.

The mapping_table_ERRDOS_check_sort() checks whether the array is properly
sorted.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/client/netmisc_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/smb/client/netmisc_test.c b/fs/smb/client/netmisc_test.c
index 195c889af7be..caa0892ec119 100644
--- a/fs/smb/client/netmisc_test.c
+++ b/fs/smb/client/netmisc_test.c
@@ -32,6 +32,8 @@ static void __array ## _check_sort(struct kunit *test)			\
 DEFINE_CHECK_SORT_FUNC(ntstatus_to_dos_map, ntstatus_to_dos_num, ntstatus);
 /* nt_errs_check_sort */
 DEFINE_CHECK_SORT_FUNC(nt_errs, nt_err_num, nt_errcode);
+/* mapping_table_ERRDOS_check_sort */
+DEFINE_CHECK_SORT_FUNC(mapping_table_ERRDOS, errdos_num, smb_err);
 
 #define DEFINE_CHECK_SEARCH_FUNC(__struct_name, __field,		\
 				 __array, __num)			\
@@ -78,6 +80,7 @@ static struct kunit_case maperror_test_cases[] = {
 	/* check sort */
 	KUNIT_CASE(ntstatus_to_dos_map_check_sort),
 	KUNIT_CASE(nt_errs_check_sort),
+	KUNIT_CASE(mapping_table_ERRDOS_check_sort),
 	/* check search */
 	KUNIT_CASE(ntstatus_to_dos_map_check_search),
 	KUNIT_CASE(nt_errs_check_search),
-- 
2.43.0