Skip to content

Commit e6140f5

Browse files
aescolarnashif
authored andcommitted
tests/drivers uart_mix_fifo_poll: Allow configuring test length
This test is quite heavy and long in simulation, but its length is meant to find unlikely issues which may be triggered only very rarely. Let's provide a kconfig value to chose how long the test is, and set it to a lower value when running in simulation (in CI) to save time. Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent a6ea449 commit e6140f5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config STRESS_TEST_REPS
5+
int "Number of loops in the stress test"
6+
# For the simulated devices, which are run by default in CI, we set it to less to not spend too
7+
# much CI time
8+
default 500 if SOC_SERIES_BSIM_NRFXX
9+
default 10000
10+
help
11+
For how many loops will the stress test run. The higher this number the longer the
12+
test and therefore the higher likelihood an unlikely race/event will be triggered.
13+
14+
# Include Zephyr's Kconfig
15+
source "Kconfig"

tests/drivers/uart/uart_mix_fifo_poll/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ static void int_async_thread_func(void *p_data, void *base, void *range)
264264

265265
int idx = data->cnt & 0xF;
266266
size_t len = (idx < BUF_SIZE / 2) ? 5 : 1; /* Try various lengths */
267+
len = MIN(len, data->max - data->cnt);
267268

268269
data->cnt += len;
269270
err = uart_tx(uart_dev, &int_async_data.buf[idx],
@@ -317,7 +318,7 @@ static void init_test_data(struct test_data *data, const uint8_t *buf, int repea
317318

318319
ZTEST(uart_mix_fifo_poll, test_mixed_uart_access)
319320
{
320-
int repeat = 10000;
321+
int repeat = CONFIG_STRESS_TEST_REPS;
321322
int err;
322323
int num_of_contexts = ARRAY_SIZE(test_data);
323324

0 commit comments

Comments
 (0)