Description
Describe the bug
This PR #86383 Convert SPI Loopback test to ZTEST
and introduce in particular the use of zassume_false
and zassume_true
.
While running the test on STM32 boards, we realized that the project test report was failed yet there is no testsuite failed.
It could be that twister considers assumption failed
is the same as assertion failed
when report tests status.
In twister.json :
"name":"tests/drivers/spi/spi_loopback/drivers.spi.stm32_spi_dma.loopback",
"arch":"arm",
"platform":"nucleo_h743zi/stm32h743xx",
"path":"tests/drivers/spi/spi_loopback",
"run_id":"1b3142779eb930bec9ba2678bd9e3394",
"runnable":true,
"retries":0,
"toolchain":"zephyr",
"status":"failed",
"log":"*** Booting Zephyr OS build v4.1.0-rc2-103-g2cf6b7ee643f ***\r\nSPI test on buffers TX/RX 0x240040a0/0x24004080, frame size = 8, DMA enabled (without CONFIG_NOCACHE_MEMORY)\r\nRunning TESTSUITE spi_extra_api_features\r\n===================================================================\r\nSTART - test_spi_lock_release\r\n PASS - test_spi_lock_release in 0.001 seconds\r\n===================================================================\r\nTESTSUITE spi_extra_api_features succeeded\r\nRunning TESTSUITE spi_extra_api_features\r\n===================================================================\r\nSTART - test_spi_lock_release\r\n PASS - test_spi_lock_release in 0.001 seconds\r\n===================================================================\r\nTESTSUITE spi_extra_api_features succeeded\r\nRunning TESTSUITE spi_loopback\r\n===================================================================\r\nTesting loopback spec: SLOW\r\nSTART - test_spi_complete_large_transfers\r\n PASS - test_spi_complete_large_transfers in 0.141 seconds\r\n===================================================================\r\nSTART - test_spi_complete_loop\r\n PASS - test_spi_complete_loop in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_complete_multiple\r\n PASS - test_spi_complete_multiple in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_null_tx_buf\r\n PASS - test_spi_null_tx_buf in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_rx_bigger_than_tx\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:274: spi_loopback_test_spi_rx_bigger_than_tx: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true\r\n\r\n SKIP - test_spi_rx_bigger_than_tx in 0.019 seconds\r\n===================================================================\r\nSTART - test_spi_rx_every_4\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:251: spi_loopback_test_spi_rx_every_4: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true\r\n\r\n SKIP - test_spi_rx_every_4 in 0.018 seconds\r\n===================================================================\r\nSTART - test_spi_rx_half_end\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:232: spi_loopback_test_spi_rx_half_end: IS_ENABLED(CONFIG_SPI_STM32_DMA) is true\r\n\r\n SKIP - test_spi_rx_half_end in 0.015 seconds\r\n===================================================================\r\nSTART - test_spi_rx_half_start\r\n PASS - test_spi_rx_half_start in 0.001 seconds\r\n===================================================================\r\nTESTSUITE spi_loopback succeeded\r\nRunning TESTSUITE spi_loopback\r\n===================================================================\r\nTesting loopback spec: FAST\r\nSTART - test_spi_complete_large_transfers\r\n PASS - test_spi_complete_large_transfers in 0.005 seconds\r\n===================================================================\r\nSTART - test_spi_complete_loop\r\n PASS - test_spi_complete_loop in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_complete_multiple\r\n PASS - test_spi_complete_multiple in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_null_tx_buf\r\n PASS - test_spi_null_tx_buf in 0.001 seconds\r\n===================================================================\r\nSTART - test_spi_rx_bigger_than_tx\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:274: spi_loopback_test_spi_rx_bigger_than_tx: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true\r\n\r\n SKIP - test_spi_rx_bigger_than_tx in 0.019 seconds\r\n===================================================================\r\nSTART - test_spi_rx_every_4\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:251: spi_loopback_test_spi_rx_every_4: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true\r\n\r\n SKIP - test_spi_rx_every_4 in 0.018 seconds\r\n===================================================================\r\nSTART - test_spi_rx_half_end\r\n\r\n Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:232: spi_loopback_test_spi_rx_half_end: IS_ENABLED(CONFIG_SPI_STM32_DMA) is true\r\n\r\n SKIP - test_spi_rx_half_end in 0.015 seconds\r\n===================================================================\r\nSTART - test_spi_rx_half_start\r\n PASS - test_spi_rx_half_start in 0.001 seconds\r\n===================================================================\r\nTESTSUITE spi_loopback succeeded\r\n\r\n------ TESTSUITE SUMMARY START ------\r\n\r\nSUITE PASS - 100.00% [spi_extra_api_features]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.001 seconds\r\n - PASS - [spi_extra_api_features.test_spi_lock_release] duration = 0.001 seconds\r\n\r\nSUITE PASS - 100.00% [spi_loopback]: pass = 5, fail = 0, skip = 3, total = 8 duration = 0.197 seconds\r\n - PASS - [spi_loopback.test_spi_complete_large_transfers] duration = 0.141 seconds\r\n - PASS - [spi_loopback.test_spi_complete_loop] duration = 0.001 seconds\r\n - PASS - [spi_loopback.test_spi_complete_multiple] duration = 0.001 seconds\r\n - PASS - [spi_loopback.test_spi_null_tx_buf] duration = 0.001 seconds\r\n - SKIP - [spi_loopback.test_spi_rx_bigger_than_tx] duration = 0.019 seconds\r\n - SKIP - [spi_loopback.test_spi_rx_every_4] duration = 0.018 seconds\r\n - SKIP - [spi_loopback.test_spi_rx_half_end] duration = 0.015 seconds\r\n - PASS - [spi_loopback.test_spi_rx_half_start] duration = 0.001 seconds\r\n\r\n------ TESTSUITE SUMMARY END ------\r\n\r\n===================================================================\r\nRunID: 1b3142779eb930bec9ba2678bd9e3394\r\nPROJECT EXECUTION FAILED\r\n",
"reason":"Failed harness:'Testsuite failed'",
"execution_time":"2.66",
"build_time":"91.59",
To Reproduce
Steps to reproduce the behavior:
- Go to your zephyr directory
- Have board compatible with test
- ./scripts/twister --device-testing --device-serial /dev/ttyACM0 -p nucleo_h743zi -T tests/drivers/spi/spi_loopback --fixture spi_loopback
- See handler.log and twister.json files
Expected behavior
In the twister.json file, for an "assumption failed" in log, we should have "status":"skipped"
or "status":"passed"
Logs and console output
We can see in console :
===================================================================
START - test_spi_null_tx_buf
PASS - test_spi_null_tx_buf in 0.001 seconds
===================================================================
START - test_spi_rx_bigger_than_tx
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:274: spi_loopback_test_spi_rx_bigger_than_tx: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true
SKIP - test_spi_rx_bigger_than_tx in 0.019 seconds
===================================================================
START - test_spi_rx_every_4
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:251: spi_loopback_test_spi_rx_every_4: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true
SKIP - test_spi_rx_every_4 in 0.018 seconds
===================================================================
START - test_spi_rx_half_end
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:232: spi_loopback_test_spi_rx_half_end: IS_ENABLED(CONFIG_SPI_STM32_DMA) is true
SKIP - test_spi_rx_half_end in 0.015 seconds
===================================================================
START - test_spi_rx_half_start
PASS - test_spi_rx_half_start in 0.001 seconds
===================================================================
TESTSUITE spi_loopback succeeded
Running TESTSUITE spi_loopback
===================================================================
Testing loopback spec: FAST
START - test_spi_complete_large_transfers
PASS - test_spi_complete_large_transfers in 0.005 seconds
===================================================================
START - test_spi_complete_loop
PASS - test_spi_complete_loop in 0.001 seconds
===================================================================
START - test_spi_complete_multiple
PASS - test_spi_complete_multiple in 0.001 seconds
===================================================================
START - test_spi_null_tx_buf
PASS - test_spi_null_tx_buf in 0.001 seconds
===================================================================
START - test_spi_rx_bigger_than_tx
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:274: spi_loopback_test_spi_rx_bigger_than_tx: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true
SKIP - test_spi_rx_bigger_than_tx in 0.019 seconds
===================================================================
START - test_spi_rx_every_4
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:251: spi_loopback_test_spi_rx_every_4: IS_ENABLED(CONFIG_SPI_STM32_DMA) || IS_ENABLED(CONFIG_DSPI_MCUX_EDMA) is true
SKIP - test_spi_rx_every_4 in 0.018 seconds
===================================================================
START - test_spi_rx_half_end
Assumption failed at WEST_TOPDIR/zephyr/tests/drivers/spi/spi_loopback/src/spi.c:232: spi_loopback_test_spi_rx_half_end: IS_ENABLED(CONFIG_SPI_STM32_DMA) is true
SKIP - test_spi_rx_half_end in 0.015 seconds
===================================================================
START - test_spi_rx_half_start
PASS - test_spi_rx_half_start in 0.001 seconds
===================================================================
TESTSUITE spi_loopback succeeded
------ TESTSUITE SUMMARY START ------
SUITE PASS - 100.00% [spi_extra_api_features]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.001 seconds
- PASS - [spi_extra_api_features.test_spi_lock_release] duration = 0.001 seconds
SUITE PASS - 100.00% [spi_loopback]: pass = 5, fail = 0, skip = 3, total = 8 duration = 0.197 seconds
- PASS - [spi_loopback.test_spi_complete_large_transfers] duration = 0.141 seconds
- PASS - [spi_loopback.test_spi_complete_loop] duration = 0.001 seconds
- PASS - [spi_loopback.test_spi_complete_multiple] duration = 0.001 seconds
- PASS - [spi_loopback.test_spi_null_tx_buf] duration = 0.001 seconds
- SKIP - [spi_loopback.test_spi_rx_bigger_than_tx] duration = 0.019 seconds
- SKIP - [spi_loopback.test_spi_rx_every_4] duration = 0.018 seconds
- SKIP - [spi_loopback.test_spi_rx_half_end] duration = 0.015 seconds
- PASS - [spi_loopback.test_spi_rx_half_start] duration = 0.001 seconds
------ TESTSUITE SUMMARY END ------
===================================================================
RunID: 1b3142779eb930bec9ba2678bd9e3394
PROJECT EXECUTION **FAILED**
Impact
The test is reported as failed without it actually being the case
Environment (please complete the following information):
- OS: Ubuntu 22.04 LTS
- Toolchain Zephyr SDK 0.17.0