Skip to content

Commit 9e9b451

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
selftests/bpf: Validate skeleton gen handles skipped fields
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 <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 3f28709 commit 9e9b451

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

tools/testing/selftests/bpf/prog_tests/static_linked.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ void test_static_linked(void)
2727
/* trigger */
2828
usleep(1);
2929

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

3333
cleanup:
3434
test_static_linked__destroy(skel);

tools/testing/selftests/bpf/progs/linked_maps1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int BPF_PROG(handler_exit1)
7575
val = bpf_map_lookup_elem(&map_weak, &key);
7676
if (val)
7777
output_weak1 = *val;
78-
78+
7979
return 0;
8080
}
8181

tools/testing/selftests/bpf/progs/test_static_linked1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* 8-byte aligned .data */
88
static volatile long static_var1 = 2;
99
static volatile int static_var2 = 3;
10-
int var1 = 0;
10+
int var1 = -1;
1111
/* 4-byte aligned .rodata */
1212
const volatile int rovar1;
1313

tools/testing/selftests/bpf/progs/test_static_linked2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* 4-byte aligned .data */
88
static volatile int static_var1 = 5;
99
static volatile int static_var2 = 6;
10-
int var2 = 0;
10+
int var2 = -1;
1111
/* 8-byte aligned .rodata */
1212
const volatile long rovar2;
1313

0 commit comments

Comments
 (0)