Skip to content

Commit f64a873

Browse files
committed
tests: posix: rwlocks: ensure test is not skipped
Commit 7e8ee25 moved the tests for the POSIX_RW_LOCKS Option Group from the tests/posix/common testsuite to its own dedicated testsuite. However, there was a copy-paste error. Previously, tests would have been run only once when dynamic threads were enabled, and then skipped when dynamic threads were disabled, since that follows the posix programming model better. However, dynamic threads were never actually enabled after moving to the new testsuite. So all tests were effectively skipped. Add the necessary options to prj.conf in order to ensure that there are sufficient dynamic threads available to run the testsuite. Signed-off-by: Chris Friedt <[email protected]>
1 parent 90cd350 commit f64a873

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

tests/posix/rwlocks/prj.conf

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ CONFIG_ZTEST=y
33

44
CONFIG_POSIX_AEP_CHOICE_BASE=y
55
CONFIG_POSIX_READER_WRITER_LOCKS=y
6+
7+
CONFIG_DYNAMIC_THREAD=y
8+
CONFIG_DYNAMIC_THREAD_POOL_SIZE=3
9+
CONFIG_THREAD_STACK_INFO=y

tests/posix/rwlocks/src/main.c

+4-13
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ ZTEST(posix_rw_locks, test_rw_lock)
8585
usleep(USEC_PER_MSEC);
8686
LOG_DBG("Parent thread acquiring WR lock again");
8787

88-
time.tv_sec = 2;
89-
time.tv_nsec = 0;
88+
zassert_ok(clock_gettime(CLOCK_REALTIME, &time));
89+
time.tv_sec += 2;
90+
9091
ret = pthread_rwlock_timedwrlock(&rwlock, &time);
9192
if (ret) {
9293
zassert_ok(pthread_rwlock_wrlock(&rwlock), "Failed to acquire write lock");
@@ -144,14 +145,4 @@ ZTEST(posix_rw_locks, test_pthread_rwlockattr_setpshared)
144145
test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_SHARED);
145146
}
146147

147-
static void before(void *arg)
148-
{
149-
ARG_UNUSED(arg);
150-
151-
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
152-
/* skip redundant testing if there is no thread pool / heap allocation */
153-
ztest_test_skip();
154-
}
155-
}
156-
157-
ZTEST_SUITE(posix_rw_locks, NULL, NULL, before, NULL, NULL);
148+
ZTEST_SUITE(posix_rw_locks, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)