mirror of https://gitee.com/openkylin/linux.git
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 <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210513233643.194711-1-andrii@kernel.org
This commit is contained in:
parent
3f2870989f
commit
9e9b451593
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue