1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
3 #include <test_progs.h>
4 #include <network_helpers.h>
5 
6 #include "jit_probe_mem.skel.h"
7 
8 void test_jit_probe_mem(void)
9 {
10 	LIBBPF_OPTS(bpf_test_run_opts, opts,
11 		.data_in = &pkt_v4,
12 		.data_size_in = sizeof(pkt_v4),
13 		.repeat = 1,
14 	);
15 	struct jit_probe_mem *skel;
16 	int ret;
17 
18 	skel = jit_probe_mem__open_and_load();
19 	if (!ASSERT_OK_PTR(skel, "jit_probe_mem__open_and_load"))
20 		return;
21 
22 	ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.test_jit_probe_mem), &opts);
23 	ASSERT_OK(ret, "jit_probe_mem ret");
24 	ASSERT_OK(opts.retval, "jit_probe_mem opts.retval");
25 	ASSERT_EQ(skel->data->total_sum, 192, "jit_probe_mem total_sum");
26 
27 	jit_probe_mem__destroy(skel);
28 }
29