lib: tests: Add test for atomic_t

Implement the test which covers some of the functions from the
`riscv_atomic.h` header file. The test contains 9 test cases:

1) atomic read/write test
2) add/return test
3) sub/return test
4) cmpxchg test
5) atomic_xchg test
6) atomic_raw_set_bit test
7) atomic_raw_clear_bit test
8) atomic_set_bit test
9) atomic_clear_bit test

Some of the test cases operate on the `test_atomic` variable. It gets
initialized in the suite init function.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Ivan Orlov
2024-04-23 16:52:44 +01:00
committed by Anup Patel
parent f6243d9ce5
commit 7bdf41ad1e
2 changed files with 146 additions and 0 deletions

View File

@@ -6,3 +6,6 @@ libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.o
carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += console_test_suite
libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_console_test.o
carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += atomic_test_suite
libsbi-objs-$(CONFIG_SBIUNIT) += tests/riscv_atomic_test.o