diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-05-07 08:41:15 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-05-12 01:07:17 +0300 |
commit | 256eab48e70c0eaf5b1b9af83c0588491986c7de (patch) | |
tree | 31f258d11a2de49f180040ebc7f74100c331993c /tools/testing/selftests/bpf/prog_tests/skeleton.c | |
parent | fdbf5ddeb855a80831af2e5bb9db9218926e6789 (diff) | |
download | linux-256eab48e70c0eaf5b1b9af83c0588491986c7de.tar.xz |
selftests/bpf: Stop using static variables for passing data to/from user-space
In preparation of skipping emitting static variables in BPF skeletons, switch
all current selftests uses of static variables to pass data between BPF and
user-space to use global variables.
All non-read-only `static volatile` variables become just plain global
variables by dropping `static volatile` part.
Read-only `static volatile const` variables, though, still require `volatile`
modifier, otherwise compiler will ignore whatever values are set from
user-space.
Few static linker tests are using name-conflicting static variables to
validate that static linker still properly handles static variables and
doesn't trip up on name conflicts.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210507054119.270888-4-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/skeleton.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/skeleton.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/skeleton.c b/tools/testing/selftests/bpf/prog_tests/skeleton.c index fe87b77af459..f6f130c99b8c 100644 --- a/tools/testing/selftests/bpf/prog_tests/skeleton.c +++ b/tools/testing/selftests/bpf/prog_tests/skeleton.c @@ -82,10 +82,8 @@ void test_skeleton(void) CHECK(data->out2 != 2, "res2", "got %lld != exp %d\n", data->out2, 2); CHECK(bss->out3 != 3, "res3", "got %d != exp %d\n", (int)bss->out3, 3); CHECK(bss->out4 != 4, "res4", "got %lld != exp %d\n", bss->out4, 4); - CHECK(bss->handler_out5.a != 5, "res5", "got %d != exp %d\n", - bss->handler_out5.a, 5); - CHECK(bss->handler_out5.b != 6, "res6", "got %lld != exp %d\n", - bss->handler_out5.b, 6); + CHECK(bss->out5.a != 5, "res5", "got %d != exp %d\n", bss->out5.a, 5); + CHECK(bss->out5.b != 6, "res6", "got %lld != exp %d\n", bss->out5.b, 6); CHECK(bss->out6 != 14, "res7", "got %d != exp %d\n", bss->out6, 14); CHECK(bss->bpf_syscall != kcfg->CONFIG_BPF_SYSCALL, "ext1", |