blob: 476d4d2d2dbbc057db07215e30a8034ac8559089 [file] [log] [blame]
Przemyslaw Czarnowski391795d2020-03-19 23:41:53 +01001/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2
3#define _GNU_SOURCE
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include "libmctp-astpcie.h"
10#include "libmctp-log.h"
11
12#ifdef NDEBUG
13#undef NDEBUG
14#endif
15
16#include <assert.h>
17#include <stdint.h>
18#include <stdio.h>
19#include <stdlib.h>
20#include <string.h>
21
22#include "astpcie.h"
23
24#define TEST_EID 10
25
26int main(void)
27{
28 int res;
29 struct mctp *mctp;
30 struct mctp_binding *binding;
31 struct mctp_binding_astpcie *pcie;
32
33 mctp_set_log_stdio(MCTP_LOG_DEBUG);
34
35 mctp = mctp_init();
36 assert(mctp);
37
38 pcie = mctp_binding_astpcie_init();
39 assert(pcie);
40
41 binding = mctp_binding_astpcie_core(pcie);
42 assert(binding);
43
44 assert(strcmp(pcie->binding.name, "astpcie") == 0);
45 assert(pcie->binding.version == 1);
46 assert(pcie->binding.tx != NULL);
47 assert(pcie->binding.start != NULL);
48
49 res = mctp_register_bus(mctp, &pcie->binding, TEST_EID);
50 assert(res == 0);
51
52 /* cleanup */
53 mctp_binding_astpcie_free(pcie);
54 __mctp_free(mctp);
55
56 return 0;
57}