1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
3 #include <test_progs.h>
4 #include <network_helpers.h>
5 #include "skb_pkt_end.skel.h"
7 static int sanity_run(struct bpf_program
*prog
)
9 __u32 duration
, retval
;
12 prog_fd
= bpf_program__fd(prog
);
13 err
= bpf_prog_test_run(prog_fd
, 1, &pkt_v4
, sizeof(pkt_v4
),
14 NULL
, NULL
, &retval
, &duration
);
15 if (CHECK(err
|| retval
!= 123, "test_run",
16 "err %d errno %d retval %d duration %d\n",
17 err
, errno
, retval
, duration
))
22 void test_test_skb_pkt_end(void)
24 struct skb_pkt_end
*skb_pkt_end_skel
= NULL
;
28 skb_pkt_end_skel
= skb_pkt_end__open_and_load();
29 if (CHECK(!skb_pkt_end_skel
, "skb_pkt_end_skel_load", "skb_pkt_end skeleton failed\n"))
32 err
= skb_pkt_end__attach(skb_pkt_end_skel
);
33 if (CHECK(err
, "skb_pkt_end_attach", "skb_pkt_end attach failed: %d\n", err
))
36 if (sanity_run(skb_pkt_end_skel
->progs
.main_prog
))
40 skb_pkt_end__destroy(skb_pkt_end_skel
);