Skip to content

Commit

Permalink
github: workflow: python: Add CAN interface testing
Browse files Browse the repository at this point in the history
Added steps to set up a virtual CAN (vcan0) interface in the CI environment.
Included tests for the CAN interface using the `python_bindings_example_server`
and `python_bindings_example_client`examples.

Ensured the CAN interface is correctly configured with `modprobe vcan`and `ip
link add dev vcan0 type vcan`.

This change enables automated testing of the CAN interface within the CI
pipeline, improving test coverage for CAN-related functionality.

Signed-off-by: Gaetan Perrot <[email protected]>
  • Loading branch information
moonlight83340 committed Aug 27, 2024
1 parent 64d03cd commit 149a50a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/build-test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
- name: Setup packages on Linux
run: |
sudo apt-get update
sudo apt-get install libzmq3-dev libsocketcan-dev socat
sudo apt-get install libzmq3-dev libsocketcan-dev socat iproute2
sudo apt-get install linux-modules-extra-$(uname -r)
- name: Setup build system packages on Linux
run: |
Expand Down Expand Up @@ -70,3 +71,19 @@ jobs:
PYTHONPATH=builddir python3 examples/python_bindings_example_server.py -k /tmp/pty2 -a 1 -R "0/0 KISS" &
PYTHONPATH=builddir python3 examples/python_bindings_example_client.py -k /tmp/pty1 -a 2 -s 1 -R "0/0 KISS"
pkill socat
- name: Setup vcan0
run: |
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
echo "Waiting for vcan0 to be up..."
while ! ip -br link show vcan0 | grep -q "UP"; do
sleep 0.1
done
echo "vcan0 is up"
- name: Run CAN Python binding Test
run: |
PYTHONPATH=builddir python3 examples/python_bindings_example_server.py -c vcan0 -a 1 -R "0/0 CAN" &
PYTHONPATH=builddir python3 examples/python_bindings_example_client.py -c vcan0 -a 2 -s 1 -R "0/0 CAN"

0 comments on commit 149a50a

Please sign in to comment.