1 #include <libpldm/transport.h> 2 3 #include "array.h" 4 #include "transport/test.h" 5 6 #include <gtest/gtest.h> 7 8 TEST(Transport, send_recv_unwanted) 9 { 10 uint8_t req[] = {0x81, 0x00, 0x01, 0x01}; 11 uint8_t resp[] = {0x02, 0x00, 0x01, 0x00}; 12 const struct pldm_transport_test_descriptor seq[] = { 13 { 14 .type = PLDM_TRANSPORT_TEST_ELEMENT_MSG_SEND, 15 .send_msg = 16 { 17 .dst = 1, 18 .msg = req, 19 .len = sizeof(req), 20 }, 21 }, 22 { 23 .type = PLDM_TRANSPORT_TEST_ELEMENT_LATENCY, 24 .latency = 25 { 26 .it_interval = {0, 0}, 27 .it_value = {1, 0}, 28 }, 29 }, 30 { 31 .type = PLDM_TRANSPORT_TEST_ELEMENT_MSG_RECV, 32 .recv_msg = 33 { 34 .src = 2, 35 .msg = resp, 36 .len = sizeof(resp), 37 }, 38 }, 39 { 40 .type = PLDM_TRANSPORT_TEST_ELEMENT_LATENCY, 41 .latency = 42 { 43 .it_interval = {0, 0}, 44 .it_value = {4, 0}, 45 }, 46 }, 47 }; 48 struct pldm_transport_test* test = NULL; 49 struct pldm_transport* ctx; 50 size_t len; 51 void* msg; 52 int rc; 53 54 EXPECT_EQ(pldm_transport_test_init(&test, seq, ARRAY_SIZE(seq)), 0); 55 ctx = pldm_transport_test_core(test); 56 rc = pldm_transport_send_recv_msg(ctx, 1, req, sizeof(req), &msg, &len); 57 EXPECT_EQ(rc, PLDM_REQUESTER_RECV_FAIL); 58 pldm_transport_test_destroy(test); 59 } 60