Skip to content

Commit

Permalink
test this
Browse files Browse the repository at this point in the history
  • Loading branch information
bongbui321 committed Oct 1, 2024
1 parent 78b49ab commit dfab445
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions tests/usbprotocol/test_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,6 @@ def test_comms_reset_tx(self):
assert m == test_msg, "message buffer should contain valid test messages"


def test_can_send_usb(self):
lpp.set_safety_hooks(Panda.SAFETY_ALLOUTPUT, 0)

for bus in range(3):
with self.subTest(bus=bus):
for _ in range(100):
msgs = random_can_messages(200, bus=bus)
packed = pack_can_buffer(msgs)

# Simulate USB bulk chunks
for buf in packed:
for i in range(0, len(buf), CHUNK_SIZE):
chunk_len = min(CHUNK_SIZE, len(buf) - i)
lpp.comms_can_write(buf[i:i+chunk_len], chunk_len)

# Check that they ended up in the right buffers
queue_msgs = []
pkt = libpanda_py.ffi.new('CANPacket_t *')
while lpp.can_pop(TX_QUEUES[bus], pkt):
queue_msgs.append(unpackage_can_msg(pkt))

self.assertEqual(len(queue_msgs), len(msgs))
self.assertEqual(queue_msgs, msgs)

def test_can_receive_usb(self):
msgs = random_can_messages(50000)
packets = [libpanda_py.make_CANPacket(m[0], m[2], m[1]) for m in msgs]
Expand Down

0 comments on commit dfab445

Please sign in to comment.