Skip to content

Commit 0937b1f

Browse files
committed
tests: Include Get Message Type Support behaviour in VDM tests
Perform a Get Message Type Support command in the VDM registration tests, to ensure we're returning 0x7e / 0x7f in the sets correctly, and add a case for both IANA and PCI types being registered. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
1 parent 7448d19 commit 0937b1f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/test_mctpd.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,11 @@ async def test_register_vdm_type_support_pcie_only(dbus, mctpd, routed_ep):
13051305
v_type = asyncdbus.Variant('q', 0xABCD)
13061306
await mctp.call_register_vdm_type_support(0x00, v_type, 0x0001)
13071307

1308+
# Verify Get Message Type Support response includes PCI VDM type
1309+
cmd = MCTPControlCommand(True, 0, 0x05, bytes([0x00]))
1310+
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
1311+
assert rsp.hex(' ') == '00 05 00 02 00 7e'
1312+
13081313
# Verify PCIe VDM (selector 0)
13091314
cmd = MCTPControlCommand(True, 0, 0x06, bytes([0x00]))
13101315
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
@@ -1324,11 +1329,46 @@ async def test_register_vdm_type_support_iana_only(dbus, mctpd, routed_ep):
13241329
v_type = asyncdbus.Variant('u', 0x1234ABCD)
13251330
await mctp.call_register_vdm_type_support(0x01, v_type, 0x5678)
13261331

1332+
# Verify Get Message Type Support response includes IANA VDM type
1333+
cmd = MCTPControlCommand(True, 0, 0x05, bytes([0x00]))
1334+
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
1335+
assert rsp.hex(' ') == '00 05 00 02 00 7f'
1336+
13271337
# Verify IANA VDM (selector 0)
13281338
cmd = MCTPControlCommand(True, 0, 0x06, bytes([0x00]))
13291339
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
13301340
assert rsp.hex(' ') == '00 06 00 ff 01 12 34 ab cd 56 78'
13311341

1342+
""" Test RegisterVDMTypeSupport when both IANA and PCI types are registered """
1343+
async def test_register_vdm_type_support_both(dbus, mctpd, routed_ep):
1344+
ep = routed_ep
1345+
mctp = await mctpd_mctp_base_iface_obj(dbus)
1346+
1347+
# Register IANA VDM: format=0x01, VID=0x1234ABCD, command_set=0x5678
1348+
v_type = asyncdbus.Variant('u', 0x1234ABCD)
1349+
await mctp.call_register_vdm_type_support(0x01, v_type, 0x5678)
1350+
1351+
# Register PCI VDM: format=0x00, VID=0xABCD, command_set=0x5678
1352+
v_type = asyncdbus.Variant('q', 0xABCD)
1353+
await mctp.call_register_vdm_type_support(0x00, v_type, 0x5678)
1354+
1355+
# Verify Get Message Type Support response includes both VDM types
1356+
cmd = MCTPControlCommand(True, 0, 0x05, bytes([0x00]))
1357+
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
1358+
assert rsp.hex(' ') == '00 05 00 03 00 7e 7f'
1359+
1360+
# we assume ordering of IANA vs PCI here, but current mctpd will
1361+
# preserve that.
1362+
# Verify IANA VDM (selector 0)
1363+
cmd = MCTPControlCommand(True, 0, 0x06, bytes([0x00]))
1364+
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
1365+
assert rsp.hex(' ') == '00 06 00 01 01 12 34 ab cd 56 78'
1366+
1367+
# Verify PCI VDM (selector 1)
1368+
cmd = MCTPControlCommand(True, 0, 0x06, bytes([0x01]))
1369+
rsp = await ep.send_control(mctpd.network.mctp_socket, cmd)
1370+
assert rsp.hex(' ') == '00 06 00 ff 00 ab cd 56 78'
1371+
13321372
""" Test RegisterVDMTypeSupport with dbus disconnect """
13331373
async def test_register_vdm_type_support_dbus_disconnect(mctpd, routed_ep):
13341374
ep = routed_ep

0 commit comments

Comments
 (0)