Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
Macros | |
#define | FAIL_ALLOC_MSG_FMT "sys_bitarray_alloc with region size %i allocated incorrectly" |
#define | FAIL_ALLOC_RET_MSG_FMT "sys_bitarray_alloc with region size %i returned incorrect result" |
#define | FAIL_ALLOC_OFFSET_MSG_FMT "sys_bitarray_alloc with region size %i gave incorrect offset" |
#define | FAIL_FREE_MSG_FMT "sys_bitarray_free with region size %i and offset %i failed" |
#define | FREE 0U |
#define | CONSTRUCTOR_VALUE 1 |
Functions | |
ZTEST_USER (atomic, test_atomic) | |
Verify atomic functionalities. | |
void | atomic_handler (void *p1, void *p2, void *p3) |
ZTEST (atomic, test_threads_access_atomic) | |
Verify atomic operation with threads. | |
ZTEST (atomic, test_atomic_overflow) | |
Checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner. | |
void * | common_setup (void) |
ZTEST_SUITE (atomic, NULL, common_setup, NULL, NULL, NULL) | |
static bool | cmp_u32_arrays (uint32_t *a1, uint32_t *a2, size_t sz) |
void | validate_bitarray_define (sys_bitarray_t *ba, size_t num_bits) |
ZTEST (bitarray, test_bitarray_declare) | |
Test defining of bitarrays. | |
bool | bitarray_bundles_is_zero (sys_bitarray_t *ba) |
ZTEST (bitarray, test_bitarray_set_clear) | |
Test bitarrays set and clear. | |
void | alloc_and_free_predefined (void) |
static size_t | count_bits (uint32_t val) |
size_t | get_bitarray_popcnt (sys_bitarray_t *ba) |
void | alloc_and_free_loop (int divisor) |
void | alloc_and_free_interval (void) |
ZTEST (bitarray, test_bitarray_alloc_free) | |
Test bitarrays allocation and free. | |
ZTEST (bitarray, test_bitarray_popcount_region) | |
ZTEST (bitarray, test_bitarray_xor) | |
ZTEST (bitarray, test_bitarray_find_nth_set) | |
ZTEST (bitarray, test_bitarray_region_set_clear) | |
ZTEST (bitarray, test_ffs) | |
Test find MSB and LSB operations. | |
ZTEST_SUITE (bitarray, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (bitfield, test_bitfield) | |
Test bitfield operations. | |
ZTEST_SUITE (bitfield, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (byteorder, test_byteorder_memcpy_swap) | |
Test swapping for memory contents. | |
ZTEST (byteorder, test_byteorder_mem_swap) | |
Test sys_mem_swap() functionality. | |
ZTEST (byteorder, test_sys_get_be64) | |
Test sys_get_be64() functionality. | |
ZTEST (byteorder, test_sys_put_be64) | |
Test sys_put_be64() functionality. | |
ZTEST (byteorder, test_sys_get_be40) | |
Test sys_get_be40() functionality. | |
ZTEST (byteorder, test_sys_put_be40) | |
Test sys_put_be40() functionality. | |
ZTEST (byteorder, test_sys_get_be48) | |
Test sys_get_be48() functionality. | |
ZTEST (byteorder, test_sys_put_be48) | |
Test sys_put_be48() functionality. | |
ZTEST (byteorder, test_sys_get_be32) | |
Test sys_get_be32() functionality. | |
ZTEST (byteorder, test_sys_put_be32) | |
Test sys_put_be32() functionality. | |
ZTEST (byteorder, test_sys_get_be24) | |
Test sys_get_be24() functionality. | |
ZTEST (byteorder, test_sys_put_be24) | |
Test sys_put_be24() functionality. | |
ZTEST (byteorder, test_sys_get_be16) | |
Test sys_get_be16() functionality. | |
ZTEST (byteorder, test_sys_put_be16) | |
Test sys_put_be16() functionality. | |
ZTEST (byteorder, test_sys_get_le16) | |
Test sys_get_le16() functionality. | |
ZTEST (byteorder, test_sys_put_le16) | |
Test sys_put_le16() functionality. | |
ZTEST (byteorder, test_sys_get_le24) | |
Test sys_get_le24() functionality. | |
ZTEST (byteorder, test_sys_put_le24) | |
Test sys_put_le24() functionality. | |
ZTEST (byteorder, test_sys_get_le32) | |
Test sys_get_le32() functionality. | |
ZTEST (byteorder, test_sys_put_le32) | |
Test sys_put_le32() functionality. | |
ZTEST (byteorder, test_sys_get_le40) | |
Test sys_get_le40() functionality. | |
ZTEST (byteorder, test_sys_put_le40) | |
Test sys_put_le40() functionality. | |
ZTEST (byteorder, test_sys_get_le48) | |
Test sys_get_le48() functionality. | |
ZTEST (byteorder, test_sys_put_le48) | |
Test sys_put_le48() functionality. | |
ZTEST (byteorder, test_sys_get_le64) | |
Test sys_get_le64() functionality. | |
ZTEST (byteorder, test_sys_put_le64) | |
Test sys_put_le64() functionality. | |
ZTEST (byteorder, test_sys_uint16_to_array) | |
Test sys_uint16_to_array() functionality. | |
ZTEST (byteorder, test_sys_uint32_to_array) | |
Test sys_uint32_to_array() functionality. | |
ZTEST (byteorder, test_sys_uint64_to_array) | |
Test sys_uint64_to_array() functionality. | |
ZTEST_SUITE (byteorder, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST_USER (clock, test_clock_uptime) | |
Test clock uptime APIs functionality. | |
ZTEST (clock, test_clock_cycle_32) | |
Test 32-bit clock cycle functionality. | |
ZTEST (clock, test_clock_cycle_64) | |
Test 64-bit clock cycle functionality. | |
static void | duration_expire (struct k_timer *timer) |
static void | stop_expire (struct k_timer *timer) |
static void | init_data_count (void) |
ZTEST (clock, test_ms_time_duration) | |
Test millisecond time duration. | |
ZTEST_SUITE (clock, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (constructor, test_constructor) | |
ZTEST_SUITE (constructor, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (common, test_version) | |
Test sys_kernel_version_get() functionality. | |
ZTEST (multilib, test_multilib) | |
Test if correct multilib is selected. | |
ZTEST_SUITE (multilib, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (printk, test_printk) | |
Test printk() functionality. | |
ZTEST_SUITE (printk, NULL, common_setup, NULL, NULL, NULL) | |
ZTEST (common_1cpu, test_timeout_order) | |
Test timeout ordering. | |
ZTEST_SUITE (common_1cpu, NULL, common_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL) | |
ZTEST (fatal_exception, test_fatal) | |
Test the kernel fatal error handling works correctly. | |
ZTEST (fatal_no_mt, test_fatal) | |
Test the kernel fatal error handling works correctly. | |
ZTEST (smp, test_fatal_on_smp) | |
Test fatal error can be triggered on different core. | |
ZTEST (smp, test_workq_on_smp) | |
Test system workq run on different core. | |
Variables | |
static int | constructor_value |
Test if constructors work. | |
#define CONSTRUCTOR_VALUE 1 |
#include <tests/kernel/common/src/constructor.c>
#define FAIL_ALLOC_MSG_FMT "sys_bitarray_alloc with region size %i allocated incorrectly" |
#include <tests/kernel/common/src/bitarray.c>
#define FAIL_ALLOC_OFFSET_MSG_FMT "sys_bitarray_alloc with region size %i gave incorrect offset" |
#include <tests/kernel/common/src/bitarray.c>
#define FAIL_ALLOC_RET_MSG_FMT "sys_bitarray_alloc with region size %i returned incorrect result" |
#include <tests/kernel/common/src/bitarray.c>
#define FAIL_FREE_MSG_FMT "sys_bitarray_free with region size %i and offset %i failed" |
#include <tests/kernel/common/src/bitarray.c>
#define FREE 0U |
#include <tests/kernel/common/src/bitarray.c>
void alloc_and_free_interval | ( | void | ) |
#include <tests/kernel/common/src/bitarray.c>
void alloc_and_free_loop | ( | int | divisor | ) |
#include <tests/kernel/common/src/bitarray.c>
void alloc_and_free_predefined | ( | void | ) |
#include <tests/kernel/common/src/bitarray.c>
void atomic_handler | ( | void * | p1, |
void * | p2, | ||
void * | p3 | ||
) |
#include <tests/kernel/common/src/atomic.c>
bool bitarray_bundles_is_zero | ( | sys_bitarray_t * | ba | ) |
#include <tests/kernel/common/src/bitarray.c>
#include <tests/kernel/common/src/bitarray.c>
|
extern |
#include <tests/kernel/common/src/atomic.c>
#include <tests/kernel/common/src/bitarray.c>
|
static |
#include <tests/kernel/common/src/clock.c>
size_t get_bitarray_popcnt | ( | sys_bitarray_t * | ba | ) |
#include <tests/kernel/common/src/bitarray.c>
|
static |
#include <tests/kernel/common/src/clock.c>
|
static |
#include <tests/kernel/common/src/clock.c>
void validate_bitarray_define | ( | sys_bitarray_t * | ba, |
size_t | num_bits | ||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST | ( | atomic | , |
test_atomic_overflow | |||
) |
#include <tests/kernel/common/src/atomic.c>
Checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner.
According to C standard the value of a signed variable is undefined in case of overflow. This test checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner. This allows us to increment an atomic variable in a non-atomic manner (as long as it is logically safe) and expect its value to match the result of the similar atomic increment.
ZTEST | ( | atomic | , |
test_threads_access_atomic | |||
) |
#include <tests/kernel/common/src/atomic.c>
Verify atomic operation with threads.
Creat two preempt threads with equal priority to atomically access the same atomic value. Because these preempt threads are of equal priority, so enable time slice to make them scheduled. The thread will execute for some time. In this time, the two sub threads will be scheduled separately according to the time slice.
ZTEST | ( | bitarray | , |
test_bitarray_alloc_free | |||
) |
#include <tests/kernel/common/src/bitarray.c>
Test bitarrays allocation and free.
ZTEST | ( | bitarray | , |
test_bitarray_declare | |||
) |
#include <tests/kernel/common/src/bitarray.c>
Test defining of bitarrays.
ZTEST | ( | bitarray | , |
test_bitarray_find_nth_set | |||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST | ( | bitarray | , |
test_bitarray_popcount_region | |||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST | ( | bitarray | , |
test_bitarray_region_set_clear | |||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST | ( | bitarray | , |
test_bitarray_set_clear | |||
) |
#include <tests/kernel/common/src/bitarray.c>
Test bitarrays set and clear.
ZTEST | ( | bitarray | , |
test_bitarray_xor | |||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST | ( | bitarray | , |
test_ffs | |||
) |
#include <tests/kernel/common/src/bitarray.c>
Test find MSB and LSB operations.
Verify the functions that find out the most significant bit and least significant bit work as expected.
ZTEST | ( | bitfield | , |
test_bitfield | |||
) |
#include <tests/kernel/common/src/bitfield.c>
Test bitfield operations.
ZTEST | ( | byteorder | , |
test_byteorder_mem_swap | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_mem_swap() functionality.
Test if sys_mem_swap() reverses the contents
ZTEST | ( | byteorder | , |
test_byteorder_memcpy_swap | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test swapping for memory contents.
Verify the functionality provided by sys_memcpy_swap()
ZTEST | ( | byteorder | , |
test_sys_get_be16 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be16() functionality.
Test if sys_get_be16() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_be24 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be24() functionality.
Test if sys_get_be24() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_be32 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be32() functionality.
Test if sys_get_be32() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_be40 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be40() functionality.
Test if sys_get_be40() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_be48 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be48() functionality.
Test if sys_get_be48() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_be64 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_be64() functionality.
Test if sys_get_be64() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le16 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le16() functionality.
Test if sys_get_le16() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le24 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le24() functionality.
Test if sys_get_le24() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le32 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le32() functionality.
Test if sys_get_le32() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le40 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le40() functionality.
Test if sys_get_le40() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le48 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le48() functionality.
Test if sys_get_le48() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_get_le64 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_get_le64() functionality.
Test if sys_get_le64() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be16 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be16() functionality.
Test if sys_put_be16() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be24 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be24() functionality.
Test if sys_put_be24() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be32 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be32() functionality.
Test if sys_put_be32() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be40 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be40() functionality.
Test if sys_put_be40() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be48 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be48() functionality.
Test if sys_put_be48() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_be64 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_be64() functionality.
Test if sys_put_be64() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le16 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le16() functionality.
Test if sys_put_le16() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le24 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le24() functionality.
Test if sys_put_le24() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le32 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le32() functionality.
Test if sys_put_le32() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le40 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le40() functionality.
Test if sys_put_le40() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le48 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le48() functionality.
Test if sys_put_le48() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_put_le64 | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_put_le64() functionality.
Test if sys_put_le64() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_uint16_to_array | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_uint16_to_array() functionality.
Test if sys_uint16_to_array() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_uint32_to_array | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_uint32_to_array() functionality.
Test if sys_uint32_to_array() correctly handles endianness.
ZTEST | ( | byteorder | , |
test_sys_uint64_to_array | |||
) |
#include <tests/kernel/common/src/byteorder.c>
Test sys_uint64_to_array() functionality.
Test if sys_uint64_to_array() correctly handles endianness.
ZTEST | ( | clock | , |
test_clock_cycle_32 | |||
) |
#include <tests/kernel/common/src/clock.c>
Test 32-bit clock cycle functionality.
Test Objective:
Testing techniques
Prerequisite Condition:
Input Specifications:
Expected Test Result:
Pass/Fail criteria:
Test Procedure:
Assumptions and Constraints
TESTPOINT: cycle elapse
TESTPOINT: cycle/uptime cross check
ZTEST | ( | clock | , |
test_clock_cycle_64 | |||
) |
#include <tests/kernel/common/src/clock.c>
Test 64-bit clock cycle functionality.
ZTEST | ( | clock | , |
test_ms_time_duration | |||
) |
#include <tests/kernel/common/src/clock.c>
Test millisecond time duration.
initialize a timer, then providing time duration in millisecond, and check the duration time whether correct.
TESTPOINT: waiting time less than duration and check the count
TESTPOINT: proving duration in millisecond
TESTPOINT: waiting time more than duration and check the count
cleanup environment
ZTEST | ( | common | , |
test_version | |||
) |
#include <tests/kernel/common/src/main.c>
Test sys_kernel_version_get() functionality.
ZTEST | ( | common_1cpu | , |
test_timeout_order | |||
) |
#include <tests/kernel/common/src/timeout_order.c>
Test timeout ordering.
Timeouts, when expiring on the same tick, should be handled in the same order they were queued.
ZTEST | ( | constructor | , |
test_constructor | |||
) |
#include <tests/kernel/common/src/constructor.c>
ZTEST | ( | fatal_exception | , |
test_fatal | |||
) |
#include <tests/kernel/fatal/exception/src/main.c>
Test the kernel fatal error handling works correctly.
Manually trigger the crash with various ways and check that the kernel is handling that properly or not. Also the crash reason should match. Check for stack sentinel feature by overflowing the thread's stack and check for the exception.
ZTEST | ( | fatal_no_mt | , |
test_fatal | |||
) |
#include <tests/kernel/fatal/no-multithreading/src/main.c>
Test the kernel fatal error handling works correctly.
Manually trigger the crash with various ways and check that the kernel is handling that properly or not. Also the crash reason should match.
ZTEST | ( | multilib | , |
test_multilib | |||
) |
#include <tests/kernel/common/src/multilib.c>
Test if correct multilib is selected.
ZTEST | ( | printk | , |
test_printk | |||
) |
#include <tests/kernel/common/src/printk.c>
Test printk() functionality.
ZTEST | ( | smp | , |
test_fatal_on_smp | |||
) |
#include <tests/kernel/smp/src/main.c>
Test fatal error can be triggered on different core.
When CONFIG_SMP is enabled, on some multiprocessor platforms, exception can be triggered on different core at the same time.
ZTEST | ( | smp | , |
test_workq_on_smp | |||
) |
#include <tests/kernel/smp/src/main.c>
Test system workq run on different core.
When macro CONFIG_SMP is enabled, workq can be run on different core.
ZTEST_SUITE | ( | atomic | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/atomic.c>
ZTEST_SUITE | ( | bitarray | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/bitarray.c>
ZTEST_SUITE | ( | bitfield | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/bitfield.c>
ZTEST_SUITE | ( | byteorder | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/byteorder.c>
ZTEST_SUITE | ( | clock | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/clock.c>
ZTEST_SUITE | ( | common_1cpu | , |
NULL | , | ||
common_setup | , | ||
ztest_simple_1cpu_before | , | ||
ztest_simple_1cpu_after | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/timeout_order.c>
ZTEST_SUITE | ( | constructor | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/constructor.c>
ZTEST_SUITE | ( | multilib | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/multilib.c>
ZTEST_SUITE | ( | printk | , |
NULL | , | ||
common_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
#include <tests/kernel/common/src/printk.c>
ZTEST_USER | ( | atomic | , |
test_atomic | |||
) |
#include <tests/kernel/common/src/atomic.c>
Verify atomic functionalities.
Test Objective:
Test techniques:
Prerequisite Conditions:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail Criteria:
Assumptions and Constraints:
ZTEST_USER | ( | clock | , |
test_clock_uptime | |||
) |
#include <tests/kernel/common/src/clock.c>
Test clock uptime APIs functionality.
TESTPOINT: uptime elapse
TESTPOINT: uptime elapse lower 32-bit
TESTPOINT: uptime straddled ms boundary
TESTPOINT: uptime delta
|
static |
#include <tests/kernel/common/src/constructor.c>
Test if constructors work.