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