transport: Introduce a transport for testing purposes

I've put the test transport header along side the source file as its
presence and implementation is an internal detail to support the test
suite. No consumers of libpldm outside its test suite should have any
need for the test transport. We can always choose to make the header
public if for some reason someone does eventually want to use it.

In addition, add a new test suite exercising the transport interfaces.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie9906bdc6a397436b91198196de04ffd6c93fc46
diff --git a/src/transport/test.h b/src/transport/test.h
new file mode 100644
index 0000000..7a01527
--- /dev/null
+++ b/src/transport/test.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
+#ifndef LIBPLDM_TRANSPORT_TEST_H
+#define LIBPLDM_TRANSPORT_TEST_H
+
+#include "libpldm/base.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/timerfd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum pldm_transport_test_element {
+	PLDM_TRANSPORT_TEST_ELEMENT_MSG_SEND,
+	PLDM_TRANSPORT_TEST_ELEMENT_MSG_RECV,
+	PLDM_TRANSPORT_TEST_ELEMENT_LATENCY,
+};
+
+struct pldm_transport_test_msg_send {
+	pldm_tid_t dst;
+	const void *msg;
+	size_t len;
+};
+
+struct pldm_transport_test_msg_recv {
+	pldm_tid_t src;
+	const void *msg;
+	size_t len;
+};
+
+struct pldm_transport_test_descriptor {
+	enum pldm_transport_test_element type;
+	union {
+		struct pldm_transport_test_msg_send send_msg;
+		struct pldm_transport_test_msg_recv recv_msg;
+		struct itimerspec latency;
+	};
+};
+
+struct pldm_transport_test;
+
+int pldm_transport_test_init(struct pldm_transport_test **ctx,
+			     const struct pldm_transport_test_descriptor *seq,
+			     size_t count);
+void pldm_transport_test_destroy(struct pldm_transport_test *ctx);
+struct pldm_transport *
+pldm_transport_test_core(struct pldm_transport_test *ctx);
+
+#if PLDM_HAS_POLL
+struct pollfd;
+int pldm_transport_test_init_pollfd(struct pldm_transport *ctx,
+				    struct pollfd *pollfd);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif