Skip to content

Commit efa7077

Browse files
committed
[nrf fromlist] tests: drivers: uart: async_api: Improve variable buffer length test
Test was skipped if baudrate was too high. Test can actually reconfigure the DUT device to use lower baudrate and run the test. Initial baudrate is restored once test is completed. Upstream PR #: 106261 Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent bb3f066 commit efa7077

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/drivers/uart/uart_async_api/src/test_uart_async.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,17 +1149,23 @@ static ZTEST_BMEM uint8_t tx_buffer[VAR_LENGTH_TX_BUF_SIZE];
11491149
ZTEST_USER(uart_async_var_buf_length, test_var_buf_length)
11501150
{
11511151
struct uart_config uart_cfg;
1152+
uint32_t baudrate;
11521153

11531154
zassert_equal(uart_config_get(uart_dev, &uart_cfg), 0);
1155+
baudrate = uart_cfg.baudrate;
11541156
if (uart_cfg.baudrate > CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT) {
1155-
ztest_test_skip();
1157+
uart_cfg.baudrate = CONFIG_VAR_LENGTH_BUFFER_TEST_BUADRATE_LIMIT;
1158+
zassert_ok(uart_configure(uart_dev, &uart_cfg));
11561159
}
11571160

11581161
for (size_t buf_len = 1; buf_len < CONFIG_VAR_LENGTH_BUFFER_MAX_SIZE; ++buf_len) {
11591162
for (size_t tx_len = 1; tx_len < VAR_LENGTH_TX_BUF_SIZE; ++tx_len) {
11601163
test_uart_async_var_buf(buf_len, tx_len);
11611164
}
11621165
}
1166+
1167+
uart_cfg.baudrate = baudrate;
1168+
zassert_ok(uart_configure(uart_dev, &uart_cfg));
11631169
}
11641170

11651171
ZTEST_SUITE(uart_async_single_read, NULL, single_read_setup,

0 commit comments

Comments
 (0)