Testing
The repository ships standalone test programs that share the same build system as the main application. Each one replaces the controller with a small driver that exercises one subsystem in isolation.
Pass at most one of the flags below; if more than one is passed, only the last takes effect.
zephyr-fvp and zephyr-s32z support all test flags. freertos-posix
supports unit, DDS publisher, DDS subscriber, and CAN output tests.
freertos-s32z2 does not support test build flags.
Unit test (node + DDS round-trip)
$ ./build.sh --unit-test
Builds actuation_module/test/unit_test.cpp. The test creates a DDS
publisher and subscriber on the same topic, drives a node timer, and checks
that messages arrive and callbacks fire as expected. Useful as a smoke test
after changes to include/common/node/ or include/common/dds/.
DDS publisher only
$ ./build.sh --dds-publisher
Builds actuation_module/test/dds_pub.cpp. The firmware creates a DDS
writer and publishes sample messages in a loop. Pair with a DDS subscriber
on another machine (for example ddsperf) to validate discovery and
network path.
DDS subscriber only
$ ./build.sh --dds-subscriber
Builds actuation_module/test/dds_sub.cpp. The firmware creates a DDS
reader and logs every message it receives. Pair with an external publisher
to validate the inbound path.
CAN output
$ ./build.sh --can-output-test
Builds actuation_module/test/can_output_test.cpp. The test validates the
control-command encoder and on freertos-posix the in-memory mock backend
(PLATFORM_FREERTOS_CAN_MOCK). Runtime SocketCAN is
not used in this test; set SAFETY_ISLAND_CAN_IFACE on the main binary
instead. See demo/can_carla_bridge/README.md.
SocketCAN vcan roundtrip (needs CAP_NET_ADMIN):
$ ./build.sh --platform freertos-posix --can-output-test --control-output DDS_AND_CAN
$ ./actuation_module/test/run-vcan-roundtrip.sh
The C++ sender emits one classic batch and one CAN-FD frame; the Python
decoder receives and checks both. The script exits 77 locally if vcan0 cannot be created. GitHub
Actions runs this in a separate FreeRTOS POSIX vcan job with
--cap-add=NET_ADMIN and fails if the module is absent.
Python decoder golden vectors and UDP tunnel pack/unpack (no vcan,
no python-can, no CARLA):
$ python3 demo/can_carla_bridge/test_decoder.py
$ python3 demo/can_carla_bridge/test_bridge.py
$ python3 demo/can_tunnel_bridge/test_datagram.py
The closed-loop deployment contract check runs in Open AD Kit PR #146:
$ python3 deployments/safety-island-carla-simulation/test_contract.py
UDP gateway → vcan0 (needs CAP_NET_ADMIN):
$ ./actuation_module/test/run-udp-tunnel-roundtrip.sh
Zephyr FVP TAP UDP tunnel (needs tun, CAP_NET_ADMIN, and FVP):
$ ./build.sh --platform zephyr-fvp --network tap --can-output-test \
--control-output CAN_ONLY -d build/zephyr-fvp-tap-can
$ ./actuation_module/test/run-fvp-tap-tunnel.sh build/zephyr-fvp-tap-can
Native FVP --can-output-test without --network tap stays on
zephyr,can-loopback.
DDS loopback
$ ./build.sh --dds-loopback-test
Builds actuation_module/test/dds_loopback_test.cpp for Zephyr targets.
Rosbag replay
$ ./build.sh --platform freertos-posix
$ .github/scripts/run-freertos-posix-replay-ci.sh
Runs the FreeRTOS POSIX controller against the recorded follower inputs in
actuation_module/test/rosbag_test/rosbag and records the control_cmd
it publishes. The check passes when the steering follows
test_control_cmd_outputs/autoware_original_control_cmd.yaml, what
Autoware’s own follower produced for the same bag, and when the controller
latches SI_STOP and publishes only the stop command once the bag ends and
its inputs stop arriving. It needs ROS 2 and the Autoware message packages, so
run it inside the devcontainer. CI runs it as the last phase of the FreeRTOS
POSIX job.
Running tests
Zephyr test binaries are produced at
build/<platform>/zephyr/zephyr.elf (zephyr-fvp or zephyr-s32z,
or the directory passed with -d) and are deployed in exactly the same
way as the main application:
AVH: upload via
./avh.py— see Arm Virtual Hardware deployment.S32Z: flash via
west flash— see NXP S32Z270DC2 (real HW).Local FVP: boot the ELF with a locally installed Arm FVP simulator.
freertos-posix test binaries are produced as
build/freertos-posix/actuation_freertos unless -d selects another build
directory. Run them directly on the host, for example:
$ ./build.sh --platform freertos-posix --can-output-test
$ ./build/freertos-posix/actuation_freertos
Clean between builds if switching flags:
$ ./build.sh -c