Skip to content

Commit 5ca0f28

Browse files
Christopher Friedtcfriedt
authored andcommitted
tests: posix: common: dedicated config for static thread stacks
The testsuite has been shifted to use dynamic thread stacks (either statically allocated via a pool, or dynamically allocated via the heap). However, we definitely still need coverage for manually specified thread stacks - but lets avoid duplicating tests unnecessarily. Signed-off-by: Christopher Friedt <[email protected]>
1 parent 5eb0bbe commit 5ca0f28

File tree

9 files changed

+95
-8
lines changed

9 files changed

+95
-8
lines changed

tests/posix/common/src/key.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,14 @@ ZTEST(key, test_correct_key_is_deleted)
144144
}
145145
}
146146

147-
ZTEST_SUITE(key, NULL, NULL, NULL, NULL, NULL);
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(key, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/mqueue.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,14 @@ ZTEST(mqueue, test_mqueue_notify_errors)
276276
zassert_ok(mq_unlink(queue), "Unable to unlink queue");
277277
}
278278

279-
ZTEST_SUITE(mqueue, NULL, NULL, NULL, NULL, NULL);
279+
static void before(void *arg)
280+
{
281+
ARG_UNUSED(arg);
282+
283+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
284+
/* skip redundant testing if there is no thread pool / heap allocation */
285+
ztest_test_skip();
286+
}
287+
}
288+
289+
ZTEST_SUITE(mqueue, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/mutex.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,14 @@ ZTEST(mutex, test_mutex_timedlock)
195195
zassert_ok(pthread_mutex_destroy(&mutex));
196196
}
197197

198-
ZTEST_SUITE(mutex, NULL, NULL, NULL, NULL, NULL);
198+
static void before(void *arg)
199+
{
200+
ARG_UNUSED(arg);
201+
202+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
203+
/* skip redundant testing if there is no thread pool / heap allocation */
204+
ztest_test_skip();
205+
}
206+
}
207+
208+
ZTEST_SUITE(mutex, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/pthread.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,14 @@ ZTEST(pthread, test_pthread_cleanup)
461461
zassert_ok(pthread_join(th, NULL));
462462
}
463463

464-
ZTEST_SUITE(pthread, NULL, NULL, NULL, NULL, NULL);
464+
static void before(void *arg)
465+
{
466+
ARG_UNUSED(arg);
467+
468+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
469+
/* skip redundant testing if there is no thread pool / heap allocation */
470+
ztest_test_skip();
471+
}
472+
}
473+
474+
ZTEST_SUITE(pthread, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/rwlock.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,14 @@ ZTEST(rwlock, test_rw_lock)
117117
zassert_ok(pthread_rwlock_destroy(&rwlock), "Failed to destroy rwlock");
118118
}
119119

120-
ZTEST_SUITE(rwlock, NULL, NULL, NULL, NULL, NULL);
120+
static void before(void *arg)
121+
{
122+
ARG_UNUSED(arg);
123+
124+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
125+
/* skip redundant testing if there is no thread pool / heap allocation */
126+
ztest_test_skip();
127+
}
128+
}
129+
130+
ZTEST_SUITE(rwlock, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/semaphore.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,14 @@ ZTEST(semaphore, test_named_semaphore)
311311
zassert_equal(nsem_get_list_len(), 0);
312312
}
313313

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

tests/posix/common/src/signal.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,14 @@ ZTEST(signal, test_sigprocmask)
320320
}
321321
}
322322

323-
ZTEST_SUITE(signal, NULL, NULL, NULL, NULL, NULL);
323+
static void before(void *arg)
324+
{
325+
ARG_UNUSED(arg);
326+
327+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
328+
/* skip redundant testing if there is no thread pool / heap allocation */
329+
ztest_test_skip();
330+
}
331+
}
332+
333+
ZTEST_SUITE(signal, NULL, NULL, before, NULL, NULL);

tests/posix/common/src/timer.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,14 @@ static void after(void *arg)
132132
}
133133
}
134134

135-
ZTEST_SUITE(timer, NULL, NULL, NULL, after, NULL);
135+
static void before(void *arg)
136+
{
137+
ARG_UNUSED(arg);
138+
139+
if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) {
140+
/* skip redundant testing if there is no thread pool / heap allocation */
141+
ztest_test_skip();
142+
}
143+
}
144+
145+
ZTEST_SUITE(timer, NULL, NULL, before, after, NULL);

tests/posix/common/testcase.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,10 @@ tests:
9797
- CONFIG_THREAD_STACK_INFO=y
9898
- CONFIG_DYNAMIC_THREAD_POOL_SIZE=5
9999
- CONFIG_HEAP_MEM_POOL_SIZE=16384
100+
portability.posix.common.static_stack:
101+
integration_platforms:
102+
- qemu_x86
103+
- qemu_riscv64
104+
extra_configs:
105+
- CONFIG_DYNAMIC_THREAD=n
106+
- CONFIG_THREAD_STACK_INFO=n

0 commit comments

Comments
 (0)