Binding for PCIe transport, starting point
Beginning of PCIe VDM binding implementation for aspeed AST2600.
Only stubs for initialization routines, api and callbacks.
This implementation depends on AST600 mctp driver (work in progress).
We don't plan to extend this implementation to other HW platforms.
Tests initialization routine with assert checks of crucial parameters.
Change-Id: I885ce82d68345bdcf06f99005c40ea2f7bdcbd4b
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
diff --git a/tests/test_astpcie.c b/tests/test_astpcie.c
new file mode 100644
index 0000000..476d4d2
--- /dev/null
+++ b/tests/test_astpcie.c
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
+
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "libmctp-astpcie.h"
+#include "libmctp-log.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "astpcie.h"
+
+#define TEST_EID 10
+
+int main(void)
+{
+ int res;
+ struct mctp *mctp;
+ struct mctp_binding *binding;
+ struct mctp_binding_astpcie *pcie;
+
+ mctp_set_log_stdio(MCTP_LOG_DEBUG);
+
+ mctp = mctp_init();
+ assert(mctp);
+
+ pcie = mctp_binding_astpcie_init();
+ assert(pcie);
+
+ binding = mctp_binding_astpcie_core(pcie);
+ assert(binding);
+
+ assert(strcmp(pcie->binding.name, "astpcie") == 0);
+ assert(pcie->binding.version == 1);
+ assert(pcie->binding.tx != NULL);
+ assert(pcie->binding.start != NULL);
+
+ res = mctp_register_bus(mctp, &pcie->binding, TEST_EID);
+ assert(res == 0);
+
+ /* cleanup */
+ mctp_binding_astpcie_free(pcie);
+ __mctp_free(mctp);
+
+ return 0;
+}