mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-09-20 15:21:42 +01:00
lib: test: disable TSA for spinlock tests
The spinlock tests deliberately use unconventional locking patterns to test edge cases. Disable thread safety analysis for them so that they don't generate false positives when the feature is enabled. Signed-off-by: Carlos López <carlos.lopezr4096@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260909162322.29778-15-carlos.lopezr4096@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
static spinlock_t test_lock = SPIN_LOCK_INITIALIZER;
|
||||
|
||||
static void spin_lock_test(struct sbiunit_test_case *test)
|
||||
NO_THREAD_SAFETY_ANALYSIS
|
||||
{
|
||||
/* We don't want to accidentally get locked */
|
||||
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock));
|
||||
@@ -16,6 +17,7 @@ static void spin_lock_test(struct sbiunit_test_case *test)
|
||||
}
|
||||
|
||||
static void spin_trylock_fail(struct sbiunit_test_case *test)
|
||||
NO_THREAD_SAFETY_ANALYSIS
|
||||
{
|
||||
/* We don't want to accidentally get locked */
|
||||
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock));
|
||||
@@ -26,6 +28,7 @@ static void spin_trylock_fail(struct sbiunit_test_case *test)
|
||||
}
|
||||
|
||||
static void spin_trylock_success(struct sbiunit_test_case *test)
|
||||
NO_THREAD_SAFETY_ANALYSIS
|
||||
{
|
||||
SBIUNIT_EXPECT(test, spin_trylock(&test_lock));
|
||||
spin_unlock(&test_lock);
|
||||
|
||||
Reference in New Issue
Block a user