lib: tests: Add test for atomic_t
authorIvan Orlov <ivan.orlov0322@gmail.com>
Tue, 23 Apr 2024 15:52:44 +0000 (16:52 +0100)
committerAnup Patel <anup@brainfault.org>
Tue, 7 May 2024 05:57:29 +0000 (11:27 +0530)
commit7bdf41ad1eb189820507c7699ee6a44df086ca70
treec12e4c6f20f4d11467ccc2b0fa25e5695637e8c9
parentf6243d9ce591b3a2085feff23ab2fbe1a6d51a14
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>
lib/sbi/tests/objects.mk
lib/sbi/tests/riscv_atomic_test.c [new file with mode: 0644]