3 #include <bpf/libbpf.h> 11 #ifdef HAVE_LIBBPF_SUPPORT 14 struct bpf_object *obj;
16 obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, NULL);
17 if (libbpf_get_error(obj))
19 bpf_object__close(obj);
24 size_t obj_buf_sz __maybe_unused)
38 .desc =
"Basic BPF llvm compile",
42 .desc =
"kbuild searching",
46 .desc =
"Compile source for BPF prologue generation",
50 .desc =
"Compile source for BPF relocation",
51 .should_load_fail =
true,
64 const char *tmpl_old, *clang_opt_old;
65 char *tmpl_new = NULL, *clang_opt_new = NULL;
83 pr_debug(
"No clang and no verbosive, skip this test\n");
104 err = asprintf(&tmpl_new,
"echo '%s' | %s%s", source,
106 old_verbose ?
"" :
" 2>/dev/null");
132 pr_debug(
"Failed to compile test case: '%s'\n", desc);
139 void *obj_buf = NULL;
140 size_t obj_buf_sz = 0;
147 subtest,
false, &should_load_fail);
149 if (ret ==
TEST_OK && !should_load_fail) {
152 pr_debug(
"Failed to parse test case '%s'\n",
const char * clang_bpf_cmd_template
const char test_llvm__bpf_base_prog[]
const char test_llvm__bpf_test_prologue_prog[]
static int test__bpf_parsing(void *obj_buf __maybe_unused, size_t obj_buf_sz __maybe_unused)
#define pr_debug(fmt,...)
const char * test__llvm_subtest_get_desc(int subtest)
int test__llvm_subtest_get_nr(void)
const char test_llvm__bpf_test_kbuild_prog[]
int test__llvm(struct test *test __maybe_unused, int subtest)
const char test_llvm__bpf_test_relocation[]
int test_llvm__fetch_bpf_obj(void **p_obj_buf, size_t *p_obj_buf_sz, enum test_llvm__testcase idx, bool force, bool *should_load_fail)
static struct @29 bpf_source_table[__LLVM_TESTCASE_MAX]
int llvm__compile_bpf(const char *path, void **p_obj_buf, size_t *p_obj_buf_sz)
int llvm__search_clang(void)