1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
3 #include "test_stack_var_off.skel.h"
5 /* Test read and writes to the stack performed with offsets that are not
8 void test_stack_var_off(void)
11 struct test_stack_var_off *skel;
13 skel = test_stack_var_off__open_and_load();
14 if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
17 /* Give pid to bpf prog so it doesn't trigger for anyone else. */
18 skel->bss->test_pid = getpid();
19 /* Initialize the probe's input. */
20 skel->bss->input[0] = 2;
21 skel->bss->input[1] = 42; /* This will be returned in probe_res. */
23 if (!ASSERT_OK(test_stack_var_off__attach(skel), "skel_attach"))
29 if (CHECK(skel->bss->probe_res != 42, "check_probe_res",
30 "wrong probe res: %d\n", skel->bss->probe_res))
34 test_stack_var_off__destroy(skel);