Also, avoid using CO-RE features, as lskel doesn't support CO-RE, yet. Include both light and libbpf skeleton in same file to test both of them together. In c48e51c8b07a ("bpf: selftests: Add selftests for module kfunc support"), I added support for generating both lskel and libbpf skel for a BPF object, however the name parameter for bpftool caused collisions when included in same file together. This meant that every test needed a separate file for a libbpf/light skeleton separation instead of subtests. Change that by appending a "_lskel" suffix to the name for files using light skeleton, and convert all existing users. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211028063501.2239335-7-memxor@gmail.com
29 lines
668 B
C
29 lines
668 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright (c) 2021 Facebook */
|
|
|
|
#include <test_progs.h>
|
|
|
|
#include "trace_vprintk.lskel.h"
|
|
|
|
void test_verif_stats(void)
|
|
{
|
|
__u32 len = sizeof(struct bpf_prog_info);
|
|
struct trace_vprintk_lskel *skel;
|
|
struct bpf_prog_info info = {};
|
|
int err;
|
|
|
|
skel = trace_vprintk_lskel__open_and_load();
|
|
if (!ASSERT_OK_PTR(skel, "trace_vprintk__open_and_load"))
|
|
goto cleanup;
|
|
|
|
err = bpf_obj_get_info_by_fd(skel->progs.sys_enter.prog_fd, &info, &len);
|
|
if (!ASSERT_OK(err, "bpf_obj_get_info_by_fd"))
|
|
goto cleanup;
|
|
|
|
if (!ASSERT_GT(info.verified_insns, 0, "verified_insns"))
|
|
goto cleanup;
|
|
|
|
cleanup:
|
|
trace_vprintk_lskel__destroy(skel);
|
|
}
|