Skip to content

Commit

Permalink
selftests/bpf: Validate skeleton gen handles skipped fields
Browse files Browse the repository at this point in the history
Adjust static_linked selftests to test a mix of global and static variables
and their handling of bpftool's skeleton generation code.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210513233643.194711-1-andrii@kernel.org
  • Loading branch information
Andrii Nakryiko authored and Alexei Starovoitov committed May 14, 2021
1 parent 3f28709 commit 9e9b451
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/prog_tests/static_linked.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void test_static_linked(void)
/* trigger */
usleep(1);

ASSERT_EQ(skel->bss->var1, 1 * 2 + 2 + 3, "var1");
ASSERT_EQ(skel->bss->var2, 4 * 3 + 5 + 6, "var2");
ASSERT_EQ(skel->data->var1, 1 * 2 + 2 + 3, "var1");
ASSERT_EQ(skel->data->var2, 4 * 3 + 5 + 6, "var2");

cleanup:
test_static_linked__destroy(skel);
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/linked_maps1.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int BPF_PROG(handler_exit1)
val = bpf_map_lookup_elem(&map_weak, &key);
if (val)
output_weak1 = *val;

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/test_static_linked1.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/* 8-byte aligned .data */
static volatile long static_var1 = 2;
static volatile int static_var2 = 3;
int var1 = 0;
int var1 = -1;
/* 4-byte aligned .rodata */
const volatile int rovar1;

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/test_static_linked2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/* 4-byte aligned .data */
static volatile int static_var1 = 5;
static volatile int static_var2 = 6;
int var2 = 0;
int var2 = -1;
/* 8-byte aligned .rodata */
const volatile long rovar2;

Expand Down

0 comments on commit 9e9b451

Please sign in to comment.