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