Skip to content

Commit 0214260

Browse files
seyoungjeongaescolar
authored andcommitted
tests: posix: threads_base: suppress SonarCloud false positives
Add NOSONAR annotations on intentional double-lock test cases: - mutex.c: recursive mutex test that intentionally locks twice - pthread.c: trylock failure test that intentionally attempts a second lock to verify trylock returns non-zero when already held Signed-off-by: Seyoung Jeong <seyoungjeong@gmail.com>
1 parent 2563fc7 commit 0214260

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tests/subsys/portability/posix/threads_base/src/mutex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void *normal_mutex_entry(void *p1)
3838
static void *recursive_mutex_entry(void *p1)
3939
{
4040
zassert_false(pthread_mutex_lock(&mutex), "mutex is not taken");
41-
zassert_false(pthread_mutex_lock(&mutex), "mutex is not taken 2nd time");
41+
zassert_false(pthread_mutex_lock(&mutex), "mutex is not taken 2nd time"); /* NOSONAR */
4242
TC_PRINT("recursive mutex lock is taken\n");
4343
zassert_false(pthread_mutex_unlock(&mutex), "mutex is not unlocked");
4444
zassert_false(pthread_mutex_unlock(&mutex), "mutex is not unlocked");

tests/subsys/portability/posix/threads_base/src/pthread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void *thread_top_exec(void *p1)
7171
*/
7272
pthread_mutex_lock(&lock);
7373

74-
if (!pthread_mutex_trylock(&lock)) {
74+
if (!pthread_mutex_trylock(&lock)) { /* NOSONAR */
7575
printk("pthread_mutex_trylock inexplicably succeeded\n");
7676
bounce_failed = 1;
7777
}

0 commit comments

Comments
 (0)