Skip to content

Commit b991962

Browse files
wentongwunashif
authored andcommitted
tests: adjust stack size for qemu_x86 and mps2_an385's coverage test
for SDK 0.10.0, it consumes more stack size when coverage enabled on qemu_x86 and mps2_an385 platform, adjust stack size for most of the test cases, otherwise there will be stack overflow. Fixes: #14500. Signed-off-by: Wentong Wu <[email protected]>
1 parent 1214736 commit b991962

File tree

23 files changed

+38
-34
lines changed

23 files changed

+38
-34
lines changed

boards/arm/mps2_an385/mps2_an385_defconfig

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ CONFIG_I2C=y
3232
#Enable MPU
3333
CONFIG_ARCH_HAS_USERSPACE=y
3434
CONFIG_ARM_MPU=y
35-
CONFIG_MAIN_STACK_SIZE=2048
36-
CONFIG_IDLE_STACK_SIZE=2048
37-
CONFIG_PRIVILEGED_STACK_SIZE=1024
38-
CONFIG_TEST_EXTRA_STACKSIZE=1024
35+
CONFIG_MAIN_STACK_SIZE=8192
36+
CONFIG_IDLE_STACK_SIZE=8192
37+
CONFIG_PRIVILEGED_STACK_SIZE=8192
38+
CONFIG_TEST_EXTRA_STACKSIZE=4096
39+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
40+
CONFIG_OFFLOAD_WORKQUEUE_STACK_SIZE=4096
41+
CONFIG_ZTEST_STACKSIZE=4096

kernel/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ config MAIN_STACK_SIZE
159159

160160
config IDLE_STACK_SIZE
161161
int "Size of stack for idle thread"
162-
default 512 if COVERAGE_GCOV
162+
default 2048 if COVERAGE_GCOV
163163
default 1024 if XTENSA
164164
default 512 if RISCV32
165165
default 320 if ARC || (ARM && CPU_HAS_FPU)

subsys/testsuite/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ config TEST_SHELL
2323

2424
config TEST_EXTRA_STACKSIZE
2525
int "Test function extra thread stack size"
26-
default 1024 if COVERAGE_GCOV
26+
default 2048 if COVERAGE_GCOV
2727
default 768 if XTENSA
2828
default 0
2929
help

tests/kernel/critical/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ static struct k_work_q offload_work_q;
4242
static K_THREAD_STACK_DEFINE(offload_work_q_stack,
4343
CONFIG_OFFLOAD_WORKQUEUE_STACK_SIZE);
4444

45-
#define STACK_SIZE 1024
45+
#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
46+
4647
static K_THREAD_STACK_DEFINE(stack1, STACK_SIZE);
4748
static K_THREAD_STACK_DEFINE(stack2, STACK_SIZE);
4849

tests/kernel/fifo/fifo_timeout/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct timeout_order_data timeout_order_data_mult_fifo[] = {
7676
};
7777

7878
#define TIMEOUT_ORDER_NUM_THREADS ARRAY_SIZE(timeout_order_data_mult_fifo)
79-
#define TSTACK_SIZE 1024
79+
#define TSTACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
8080
#define FIFO_THREAD_PRIO -5
8181

8282
static K_THREAD_STACK_ARRAY_DEFINE(ttstack,

tests/kernel/fifo/fifo_usage/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <ztest.h>
3636
#include <irq_offload.h>
3737

38-
#define STACK_SIZE 1024
38+
#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
3939
#define LIST_LEN 4
4040

4141
struct fdata_t {

tests/kernel/lifo/lifo_usage/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "lifo_usage.h"
99
#include <kernel.h>
1010

11-
#define STACK_SIZE 1024
11+
#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
1212
#define LIST_LEN 2
1313

1414
struct k_lifo lifo, plifo;
@@ -64,7 +64,7 @@ struct timeout_order_data timeout_order_data_mult_lifo[] = {
6464

6565
#define NUM_SCRATCH_LIFO_PACKETS 20
6666
#define TIMEOUT_ORDER_NUM_THREADS ARRAY_SIZE(timeout_order_data_mult_lifo)
67-
#define TSTACK_SIZE 1024
67+
#define TSTACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
6868
#define LIFO_THREAD_PRIO -5
6969

7070
struct scratch_lifo_packet scratch_lifo_packets[NUM_SCRATCH_LIFO_PACKETS];

tests/kernel/obj_tracing/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
extern void test_obj_tracing(void);
1212

13-
#define STSIZE 1024
13+
#define STSIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
1414
#define N_PHILOSOPHERS 5
1515

1616
#define TOTAL_TEST_NUMBER 2

tests/kernel/pipe/pipe_api/src/test_pipe_contexts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <ztest.h>
88

9-
#define STACK_SIZE 1024
9+
#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
1010
#define PIPE_LEN 16
1111
#define BYTES_TO_WRITE 4
1212
#define BYTES_TO_READ BYTES_TO_WRITE

tests/kernel/poll/src/test_poll.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ static struct k_poll_signal wait_signal =
114114
struct fifo_msg wait_msg = { NULL, FIFO_MSG_VALUE };
115115

116116
static struct k_thread poll_wait_helper_thread;
117-
static K_THREAD_STACK_DEFINE(poll_wait_helper_stack, KB(1));
117+
static K_THREAD_STACK_DEFINE(poll_wait_helper_stack,
118+
KB(1) + CONFIG_TEST_EXTRA_STACKSIZE);
118119

119120
#define TAG_0 10
120121
#define TAG_1 11
@@ -429,7 +430,8 @@ void test_poll_cancel_main_high_prio(void)
429430
static K_SEM_DEFINE(multi_sem, 0, 1);
430431

431432
static struct k_thread multi_thread_lowprio;
432-
static K_THREAD_STACK_DEFINE(multi_stack_lowprio, KB(1));
433+
static K_THREAD_STACK_DEFINE(multi_stack_lowprio,
434+
KB(1) + CONFIG_TEST_EXTRA_STACKSIZE);
433435

434436
static void multi_lowprio(void *p1, void *p2, void *p3)
435437
{
@@ -449,7 +451,7 @@ static void multi_lowprio(void *p1, void *p2, void *p3)
449451
static K_SEM_DEFINE(multi_reply, 0, 1);
450452

451453
static struct k_thread multi_thread;
452-
static K_THREAD_STACK_DEFINE(multi_stack, KB(1));
454+
static K_THREAD_STACK_DEFINE(multi_stack, KB(1) + CONFIG_TEST_EXTRA_STACKSIZE);
453455

454456
static void multi(void *p1, void *p2, void *p3)
455457
{
@@ -526,7 +528,7 @@ void test_poll_multi(void)
526528
}
527529

528530
static struct k_thread signal_thread;
529-
static K_THREAD_STACK_DEFINE(signal_stack, KB(1));
531+
static K_THREAD_STACK_DEFINE(signal_stack, KB(1) + CONFIG_TEST_EXTRA_STACKSIZE);
530532
static struct k_poll_signal signal;
531533

532534
static void threadstate(void *p1, void *p2, void *p3)

0 commit comments

Comments
 (0)