tests: drivers: uart: uart_elementary: Fix 'config_mismatch' test case
UART error may be reported with random timing from either UART in configuration mismatch case. The test case is now aligned to such behaviour. Signed-off-by: Bartosz Miller <bartosz.miller@nordicsemi.no>
This commit is contained in:
parent
5919bd988b
commit
3147243c8f
2 changed files with 16 additions and 7 deletions
|
@ -40,6 +40,7 @@ static volatile uint8_t uart_error_counter;
|
||||||
static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX);
|
static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX);
|
||||||
static uint8_t test_buffer_aux[TEST_BUFFER_LEN];
|
static uint8_t test_buffer_aux[TEST_BUFFER_LEN];
|
||||||
static volatile uint8_t aux_uart_error;
|
static volatile uint8_t aux_uart_error;
|
||||||
|
static volatile uint8_t aux_uart_error_counter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,12 +111,9 @@ static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, vo
|
||||||
|
|
||||||
uart_irq_update(dev);
|
uart_irq_update(dev);
|
||||||
err = uart_err_check(dev);
|
err = uart_err_check(dev);
|
||||||
#if !defined(CONFIG_COVERAGE)
|
if (err != 0) {
|
||||||
/* This assetion will fail with coverge enabled
|
aux_uart_error_counter++;
|
||||||
* When in coverage mode it has no impact on test case execution
|
}
|
||||||
*/
|
|
||||||
zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err);
|
|
||||||
#endif /* CONFIG_COVERAGE */
|
|
||||||
while (uart_irq_is_pending(dev)) {
|
while (uart_irq_is_pending(dev)) {
|
||||||
if (uart_irq_rx_ready(dev)) {
|
if (uart_irq_rx_ready(dev)) {
|
||||||
uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux);
|
uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux);
|
||||||
|
@ -290,7 +288,10 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission)
|
||||||
uart_irq_err_disable(uart_dev_aux);
|
uart_irq_err_disable(uart_dev_aux);
|
||||||
|
|
||||||
#if defined(CONFIG_SETUP_MISMATCH_TEST)
|
#if defined(CONFIG_SETUP_MISMATCH_TEST)
|
||||||
zassert_not_equal(uart_error_counter, 0);
|
TC_PRINT("Mismatched configuration test\n");
|
||||||
|
zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0,
|
||||||
|
"UART configuration mismatch error not detected");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
for (int index = 0; index < TEST_BUFFER_LEN; index++) {
|
for (int index = 0; index < TEST_BUFFER_LEN; index++) {
|
||||||
zassert_equal(test_buffer[index], test_pattern[index],
|
zassert_equal(test_buffer[index], test_pattern[index],
|
||||||
|
|
|
@ -33,3 +33,11 @@ tests:
|
||||||
extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay"
|
extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay"
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_DUAL_UART_TEST=y
|
- CONFIG_DUAL_UART_TEST=y
|
||||||
|
drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l:
|
||||||
|
filter: CONFIG_SERIAL_SUPPORT_INTERRUPT
|
||||||
|
platform_allow:
|
||||||
|
- nrf54l15pdk/nrf54l15/cpuapp
|
||||||
|
extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay"
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_DUAL_UART_TEST=y
|
||||||
|
- CONFIG_SETUP_MISMATCH_TEST=y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue