Skip to content

Commit 9535a69

Browse files
cfriedtkartben
authored andcommitted
tests: posix: semaphores: ensure test is not skipped
Commit f7633a5 moved the tests for the POSIX_SEMAPHORES 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 a08240b commit 9535a69

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

tests/posix/semaphores/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_SEMAPHORES=y
6+
7+
CONFIG_DYNAMIC_THREAD=y
8+
CONFIG_DYNAMIC_THREAD_POOL_SIZE=2
9+
CONFIG_THREAD_STACK_INFO=y

tests/posix/semaphores/src/main.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#define WAIT_TIME_MS 100
1717
BUILD_ASSERT(WAIT_TIME_MS > 0, "WAIT_TIME_MS must be posistive");
1818

19+
/* based on the current structure of this unit test */
20+
BUILD_ASSERT(CONFIG_DYNAMIC_THREAD_POOL_SIZE >= 2, "CONFIG_DYNAMIC_THREAD_POOL_SIZE must be >= 2");
21+
1922
static void *child_func(void *p1)
2023
{
2124
sem_t *sem = (sem_t *)p1;
@@ -312,14 +315,4 @@ ZTEST(posix_semaphores, test_named_semaphore)
312315
zassert_equal(nsem_get_list_len(), 0);
313316
}
314317

315-
static void before(void *arg)
316-
{
317-
ARG_UNUSED(arg);
318-
319-
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
320-
/* skip redundant testing if there is no thread pool / heap allocation */
321-
ztest_test_skip();
322-
}
323-
}
324-
325-
ZTEST_SUITE(posix_semaphores, NULL, NULL, before, NULL, NULL);
318+
ZTEST_SUITE(posix_semaphores, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)