File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
tests/kernel/mem_protect/mem_protect/src Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1366,3 +1366,32 @@ void test_kobject_perm_error(void)
1366
1366
k_thread_join (tid , K_FOREVER );
1367
1367
}
1368
1368
}
1369
+
1370
+ extern const char * otype_to_str (enum k_objects otype );
1371
+
1372
+ /**
1373
+ * @brief Test get all kernel object list
1374
+ *
1375
+ * @details Get all of the kernel object in kobject list.
1376
+ *
1377
+ * @ingroup kernel_memprotect_tests
1378
+ */
1379
+ void test_all_kobjects_str (void )
1380
+ {
1381
+ enum k_objects otype = K_OBJ_ANY ;
1382
+ const char * c ;
1383
+ int cmp ;
1384
+
1385
+ do {
1386
+ c = otype_to_str (otype );
1387
+ cmp = strcmp (c , "?" );
1388
+ if (otype != K_OBJ_LAST ) {
1389
+ zassert_true (cmp != 0 ,
1390
+ "otype %d unexpectedly maps to last entry \"?\"" , otype );
1391
+ } else {
1392
+ zassert_true (cmp == 0 ,
1393
+ "otype %d does not map to last entry \"?\"" , otype );
1394
+ }
1395
+ otype ++ ;
1396
+ } while (otype <= K_OBJ_LAST );
1397
+ }
Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ void test_main(void)
86
86
ztest_unit_test (test_thread_alloc_out_of_idx ),
87
87
ztest_unit_test (test_kobj_create_out_of_memory ),
88
88
ztest_unit_test (test_kobject_perm_error ),
89
- ztest_unit_test (test_kobject_free_error )
89
+ ztest_unit_test (test_kobject_free_error ),
90
+ ztest_unit_test (test_all_kobjects_str )
90
91
);
91
92
92
93
ztest_run_test_suite (memory_protection_test_suite );
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ extern void test_kobj_create_out_of_memory(void);
70
70
extern void test_thread_alloc_out_of_idx (void );
71
71
extern void test_alloc_kobjects (void );
72
72
extern void test_kobject_perm_error (void );
73
+ extern void test_all_kobjects_str (void );
73
74
74
75
75
76
/* Flag needed to figure out if the fault was expected or not. */
You can’t perform that action at this time.
0 commit comments