tests: No thread-shared/synchronized data on stack (coherence)

CONFIG_KERNEL_COHERENCE forbids synchronized data on the stack: no
spinlocks, IPC primitives, or things that contain them.  Application
code obviously doesn't have to follow these inconvenient rules, but
our test code needs to run on platforms with incoherent stack memory.

Make these things static.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-03-02 15:11:01 -08:00 committed by Anas Nashif
commit 589c781506
4 changed files with 7 additions and 7 deletions

View file

@ -144,7 +144,7 @@ void test_spinlock_bounce(void)
void test_spinlock_mutual_exclusion(void) void test_spinlock_mutual_exclusion(void)
{ {
k_spinlock_key_t key; k_spinlock_key_t key;
struct k_spinlock lock_runtime; static struct k_spinlock lock_runtime;
unsigned int irq_key; unsigned int irq_key;
(void)memset(&lock_runtime, 0, sizeof(lock_runtime)); (void)memset(&lock_runtime, 0, sizeof(lock_runtime));

View file

@ -1054,7 +1054,7 @@ static void test_cancel_or_release(void)
static void test_sync_basic(void) static void test_sync_basic(void)
{ {
struct onoff_sync_service srv = {}; static struct onoff_sync_service srv = {};
k_spinlock_key_t key; k_spinlock_key_t key;
int res = 5; int res = 5;
int rc; int rc;
@ -1131,7 +1131,7 @@ static void test_sync_basic(void)
static void test_sync_error(void) static void test_sync_error(void)
{ {
struct onoff_sync_service srv = {}; static struct onoff_sync_service srv = {};
k_spinlock_key_t key; k_spinlock_key_t key;
int res = -EPERM; int res = -EPERM;
int rc; int rc;

View file

@ -845,7 +845,7 @@ void test_ringbuffer_equal_bufs(void)
void test_ringbuffer_performance(void) void test_ringbuffer_performance(void)
{ {
uint8_t buf[16]; uint8_t buf[16];
struct ring_buf rbuf; static struct ring_buf rbuf;
uint8_t indata[16]; uint8_t indata[16];
uint8_t outdata[16]; uint8_t outdata[16];
uint8_t *ptr; uint8_t *ptr;

View file

@ -121,7 +121,7 @@ static void test_net_buf_1(void)
static void test_net_buf_2(void) static void test_net_buf_2(void)
{ {
struct net_buf *frag, *head; struct net_buf *frag, *head;
struct k_fifo fifo; static struct k_fifo fifo;
int i; int i;
head = net_buf_alloc_len(&bufs_pool, 74, K_NO_WAIT); head = net_buf_alloc_len(&bufs_pool, 74, K_NO_WAIT);
@ -169,8 +169,8 @@ static void test_net_buf_3(void)
{ {
static struct k_thread test_3_thread_data; static struct k_thread test_3_thread_data;
struct net_buf *frag, *head; struct net_buf *frag, *head;
struct k_fifo fifo; static struct k_fifo fifo;
struct k_sem sema; static struct k_sem sema;
int i; int i;
head = net_buf_alloc_len(&bufs_pool, 74, K_NO_WAIT); head = net_buf_alloc_len(&bufs_pool, 74, K_NO_WAIT);