#include <kunit/test.h>
#include "utils.h"
struct mctp_test_route { … };
static int mctp_test_route_output(struct mctp_route *rt, struct sk_buff *skb)
{ … }
static struct mctp_test_route *mctp_route_test_alloc(void)
{ … }
static struct mctp_test_route *mctp_test_create_route(struct net *net,
struct mctp_dev *dev,
mctp_eid_t eid,
unsigned int mtu)
{ … }
static void mctp_test_route_destroy(struct kunit *test,
struct mctp_test_route *rt)
{ … }
static void mctp_test_skb_set_dev(struct sk_buff *skb,
struct mctp_test_dev *dev)
{ … }
static struct sk_buff *mctp_test_create_skb(const struct mctp_hdr *hdr,
unsigned int data_len)
{ … }
static struct sk_buff *__mctp_test_create_skb_data(const struct mctp_hdr *hdr,
const void *data,
size_t data_len)
{ … }
#define mctp_test_create_skb_data(h, d) …
struct mctp_frag_test { … };
static void mctp_test_fragment(struct kunit *test)
{ … }
static const struct mctp_frag_test mctp_frag_tests[] = …;
static void mctp_frag_test_to_desc(const struct mctp_frag_test *t, char *desc)
{ … }
KUNIT_ARRAY_PARAM(mctp_frag, mctp_frag_tests, mctp_frag_test_to_desc);
struct mctp_rx_input_test { … };
static void mctp_test_rx_input(struct kunit *test)
{ … }
#define RX_HDR(_ver, _src, _dest, _fst) …
static const struct mctp_rx_input_test mctp_rx_input_tests[] = …;
static void mctp_rx_input_test_to_desc(const struct mctp_rx_input_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(mctp_rx_input, mctp_rx_input_tests,
mctp_rx_input_test_to_desc);
static void __mctp_route_test_init(struct kunit *test,
struct mctp_test_dev **devp,
struct mctp_test_route **rtp,
struct socket **sockp,
unsigned int netid)
{ … }
static void __mctp_route_test_fini(struct kunit *test,
struct mctp_test_dev *dev,
struct mctp_test_route *rt,
struct socket *sock)
{ … }
struct mctp_route_input_sk_test { … };
static void mctp_test_route_input_sk(struct kunit *test)
{ … }
#define FL_S …
#define FL_E …
#define FL_TO …
#define FL_T(t) …
static const struct mctp_route_input_sk_test mctp_route_input_sk_tests[] = …;
static void mctp_route_input_sk_to_desc(const struct mctp_route_input_sk_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(mctp_route_input_sk, mctp_route_input_sk_tests,
mctp_route_input_sk_to_desc);
struct mctp_route_input_sk_reasm_test { … };
static void mctp_test_route_input_sk_reasm(struct kunit *test)
{ … }
#define RX_FRAG(f, s) …
static const struct mctp_route_input_sk_reasm_test mctp_route_input_sk_reasm_tests[] = …;
static void mctp_route_input_sk_reasm_to_desc(
const struct mctp_route_input_sk_reasm_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(mctp_route_input_sk_reasm, mctp_route_input_sk_reasm_tests,
mctp_route_input_sk_reasm_to_desc);
struct mctp_route_input_sk_keys_test { … };
static void mctp_test_route_input_sk_keys(struct kunit *test)
{ … }
static const struct mctp_route_input_sk_keys_test mctp_route_input_sk_keys_tests[] = …;
static void mctp_route_input_sk_keys_to_desc(
const struct mctp_route_input_sk_keys_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(mctp_route_input_sk_keys, mctp_route_input_sk_keys_tests,
mctp_route_input_sk_keys_to_desc);
struct test_net { … };
static void
mctp_test_route_input_multiple_nets_bind_init(struct kunit *test,
struct test_net *t)
{ … }
static void
mctp_test_route_input_multiple_nets_bind_fini(struct kunit *test,
struct test_net *t)
{ … }
static void mctp_test_route_input_multiple_nets_bind(struct kunit *test)
{ … }
static void
mctp_test_route_input_multiple_nets_key_init(struct kunit *test,
struct test_net *t)
{ … }
static void
mctp_test_route_input_multiple_nets_key_fini(struct kunit *test,
struct test_net *t)
{ … }
static void mctp_test_route_input_multiple_nets_key(struct kunit *test)
{ … }
#if IS_ENABLED(CONFIG_MCTP_FLOWS)
static void mctp_test_flow_init(struct kunit *test,
struct mctp_test_dev **devp,
struct mctp_test_route **rtp,
struct socket **sock,
struct sk_buff **skbp,
unsigned int len)
{ … }
static void mctp_test_flow_fini(struct kunit *test,
struct mctp_test_dev *dev,
struct mctp_test_route *rt,
struct socket *sock)
{ … }
static void mctp_test_packet_flow(struct kunit *test)
{ … }
static void mctp_test_fragment_flow(struct kunit *test)
{ … }
#else
static void mctp_test_packet_flow(struct kunit *test)
{
kunit_skip(test, "Requires CONFIG_MCTP_FLOWS=y");
}
static void mctp_test_fragment_flow(struct kunit *test)
{
kunit_skip(test, "Requires CONFIG_MCTP_FLOWS=y");
}
#endif
static void mctp_test_route_output_key_create(struct kunit *test)
{ … }
static struct kunit_case mctp_test_cases[] = …;
static struct kunit_suite mctp_test_suite = …;
kunit_test_suite(…) …;