Skip to content

Commit 89dd0ef

Browse files
cfriedtkartben
authored andcommitted
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 <cfriedt@tenstorrent.com>
1 parent 706770b commit 89dd0ef

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

tests/posix/rwlocks/prj.conf

Lines changed: 4 additions & 0 deletions
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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <zephyr/ztest.h>
1212

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

1516
LOG_MODULE_REGISTER(posix_rwlock_test);
1617

@@ -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)