RTEMS | can: add spcan03/spcan04 stress tests and virtual hardware abort IOCTL (!1224)

MITHILESH MATTAPALLI (@mithileshm) gitlab at rtems.org
Wed Apr 29 03:33:09 UTC 2026



MITHILESH MATTAPALLI created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1224

Project:Branches: mithileshm/rtems:virtual-can-driver to rtems/rtos/rtems:main
Author:   MITHILESH MATTAPALLI



## Summary

This merge request ports the standalone CTU CAN FD virtual test applications into the native RTEMS `testsuites/sptests` directory and upgrades the virtual CAN driver to support hardware fault simulation.

**Key Changes:**

1. **Virtual Driver Upgrades (`can-virtual.c`):**
   - Implemented the `virtual_can_priv` structure to support hardware error injection.
   - Added custom IOCTL `RTEMS_CAN_IOC_VIRT_ABORT` to simulate TX hardware aborts and act as a garbage collector, freeing the slot safely under `rtems_mutex_lock`.
2. **Automated Stress Tests (`spcan03` & `spcan04`):**
   - `spcan03.c`: Migrated from `can_1w`. Tests 1-way concurrent TX stress and injects hardware aborts via IOCTL to validate virtual queue thread safety.
   - `spcan04.c`: Migrated from `can_2w`. Tests 2-way concurrent read/write and evaluates loopback filtering.
3. **Configuration & Filtering Adjustments:**
   - **Memory Footprint:** Removed YAML POSIX/architecture exclusions. Globally set `-DRTEMS_CAN_FIFO_SIZE=4` in `cppflags` to support minimal memory-constrained targets natively.
   - **RX Filters:** Modified `spcan04.c` to open two separate file descriptors (`fd1`, `fd2`) to ensure threads can natively read each other's looped-back frames, bypassing local delivery restrictions.

## Generative AI

<!--If you have used AI please use the "AI Contribution" template otherwise leave this blank see our fulls statement at https://www.rtems.org/generative-ai/-->

<!--Default settings, if it is a dropdown it will set after submission-->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1224
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260429/a368cc28/attachment.htm>


More information about the bugs mailing list