Skip to content

Commit 4713575

Browse files
Mazen NEIFERAndrew Boie
authored andcommitted
tests: Introduced new config option to add extra stack size for tests.
This option is added in order to support Xtensa, which needs more stack than other architecture. This allows having a centralized way to change stack requirements for all tests. This extra stack size is eaqual to 0 for most architectures, except Xtensa which requires additional 768 bytes for each stack. Change-Id: Ie5dcae1dfd29018d36ef35dae22dc4c1a2ecdc14 Signed-off-by: Mazen NEIFER <[email protected]>
1 parent 555c606 commit 4713575

File tree

16 files changed

+22
-17
lines changed

16 files changed

+22
-17
lines changed

tests/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ menu Testing
88

99
source "tests/ztest/Kconfig"
1010

11+
config TEST_EXTRA_STACKSIZE
12+
int "Test function thread stack size"
13+
default 0
14+
default 768 if XTENSA
15+
1116
endmenu

tests/kernel/context/src/context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <board.h>
3131
#endif
3232

33-
#define THREAD_STACKSIZE 384
33+
#define THREAD_STACKSIZE (384 + CONFIG_TEST_EXTRA_STACKSIZE)
3434
#define THREAD_PRIORITY 4
3535

3636
#define THREAD_SELF_CMD 0

tests/kernel/fifo/test_fifo_api/src/test_fifo_contexts.c

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

1919
#include "test_fifo.h"
2020

21-
#define STACK_SIZE 512
21+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
2222
#define LIST_LEN 2
2323
/**TESTPOINT: init via K_FIFO_DEFINE*/
2424
K_FIFO_DEFINE(kfifo);

tests/kernel/fifo/test_fifo_api/src/test_fifo_loop.c

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

2929
#include "test_fifo.h"
3030

31-
#define STACK_SIZE 512
31+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
3232
#define LIST_LEN 4
3333
#define LOOPS 32
3434

tests/kernel/lifo/test_lifo_api/src/test_lifo_contexts.c

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

2020
#include "test_lifo.h"
2121

22-
#define STACK_SIZE 512
22+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
2323
#define LIST_LEN 2
2424
/**TESTPOINT: init via K_LIFO_DEFINE*/
2525
K_LIFO_DEFINE(klifo);

tests/kernel/lifo/test_lifo_api/src/test_lifo_loop.c

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

2929
#include "test_lifo.h"
3030

31-
#define STACK_SIZE 512
31+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
3232
#define LIST_LEN 4
3333
#define LOOPS 32
3434

tests/kernel/mbox/mbox_api/src/test_mbox_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <ztest.h>
2424

2525
#define TIMEOUT 100
26-
#define STACK_SIZE 512
26+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
2727
#define MAIL_LEN 64
2828

2929

tests/kernel/mem_pool/test_mpool_threadsafe/src/test_mpool_threadsafe.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 <atomic.h>
3737
#define THREAD_NUM 4
38-
#define STACK_SIZE 512
38+
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
3939
#define POOL_NUM 2
4040
#define TIMEOUT 200
4141
#define BLK_SIZE_MIN 4

tests/kernel/threads_customdata/cdata_api/src/test_customdata_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#ifdef CONFIG_RISCV32
1212
#define STACK_SIZE 512
1313
#else
14-
#define STACK_SIZE 256
14+
#define STACK_SIZE (256 + CONFIG_TEST_EXTRA_STACKSIZE)
1515
#endif
1616

1717
/*local variables*/

tests/kernel/threads_lifecycle/lifecycle_api/src/test_threads_cancel_abort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
#include <ztest.h>
1414

15-
#define STACK_SIZE 256
15+
#define STACK_SIZE (256 + CONFIG_TEST_EXTRA_STACKSIZE)
1616
static char __noinit __stack tstack[STACK_SIZE];
1717
static int execute_flag;
1818

0 commit comments

Comments
 (0)