While working on adding J1939 socket support, I discovered that one of the SocketCAN tests had been broken 3 years ago, but the breakage somehow went unnoticed until I ran the test locally. I would have expected for this to come up fairly quickly in the Buildbot, which leads me to believe that these tests are currently not run.
Here’s the relevant snippet from the test:
# class SocketCANTest(unittest.TestCase):
# ...
def setUp(self):
self.s = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
self.addCleanup(self.s.close)
try:
self.s.bind((self.interface,))
except OSError:
self.skipTest('network interface `%s` does not exist' %
self.interface)
# ...
From what I understand, the Buildbot cluster runs after commits are merged (or on some set schedule). As these SocketCAN tests rely on a network interface being available, they’re presumably always skipped (since the test skips them if a vcan device isn’t found, as SocketCAN isn’t available on every platform).
Setting up a virtual SocketCAN interface doesn’t need any additional hardware on Linux, as drivers were mainlined and are present after Linux 2.6.25+:
# Load the vcan kernel module
sudo modprobe vcan
# Add a vcan device called vcan0
sudo ip link add dev vcan0 type vcan
# Set up the vcan0 device
sudo ip link set up vcan0
Are the SocketCAN tests actually being run on the Buildbot cluster? If not, are there any technical reasons why a vcan
interface can’t be set up such that these could run? It would be nice to have these tests protected under Buildbot as well to prevent these test breakages in the future.