Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/posix/rwlocks/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ CONFIG_ZTEST=y

CONFIG_POSIX_AEP_CHOICE_BASE=y
CONFIG_POSIX_READER_WRITER_LOCKS=y

CONFIG_DYNAMIC_THREAD=y
CONFIG_DYNAMIC_THREAD_POOL_SIZE=3
Copy link
Member

@ycsin ycsin Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should BUILD_ASSERT(CONFIG_DYNAMIC_THREAD_POOL_SIZE >= N_THR)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

CONFIG_THREAD_STACK_INFO=y
13 changes: 2 additions & 11 deletions tests/posix/rwlocks/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <zephyr/ztest.h>

#define N_THR 3
BUILD_ASSERT(N_THR <= CONFIG_DYNAMIC_THREAD_POOL_SIZE, "Insufficient number of dynamic threads");

LOG_MODULE_REGISTER(posix_rwlock_test);

Expand Down Expand Up @@ -144,14 +145,4 @@ ZTEST(posix_rw_locks, test_pthread_rwlockattr_setpshared)
test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_SHARED);
}

static void before(void *arg)
{
ARG_UNUSED(arg);

if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
/* skip redundant testing if there is no thread pool / heap allocation */
ztest_test_skip();
}
}

ZTEST_SUITE(posix_rw_locks, NULL, NULL, before, NULL, NULL);
ZTEST_SUITE(posix_rw_locks, NULL, NULL, NULL, NULL, NULL);