|
@@ -35,6 +35,7 @@ static int test__bpf_parsing(void *obj_buf __maybe_unused,
|
|
static struct {
|
|
static struct {
|
|
const char *source;
|
|
const char *source;
|
|
const char *desc;
|
|
const char *desc;
|
|
|
|
+ bool should_load_fail;
|
|
} bpf_source_table[__LLVM_TESTCASE_MAX] = {
|
|
} bpf_source_table[__LLVM_TESTCASE_MAX] = {
|
|
[LLVM_TESTCASE_BASE] = {
|
|
[LLVM_TESTCASE_BASE] = {
|
|
.source = test_llvm__bpf_base_prog,
|
|
.source = test_llvm__bpf_base_prog,
|
|
@@ -48,14 +49,19 @@ static struct {
|
|
.source = test_llvm__bpf_test_prologue_prog,
|
|
.source = test_llvm__bpf_test_prologue_prog,
|
|
.desc = "Compile source for BPF prologue generation test",
|
|
.desc = "Compile source for BPF prologue generation test",
|
|
},
|
|
},
|
|
|
|
+ [LLVM_TESTCASE_BPF_RELOCATION] = {
|
|
|
|
+ .source = test_llvm__bpf_test_relocation,
|
|
|
|
+ .desc = "Compile source for BPF relocation test",
|
|
|
|
+ .should_load_fail = true,
|
|
|
|
+ },
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
int
|
|
int
|
|
test_llvm__fetch_bpf_obj(void **p_obj_buf,
|
|
test_llvm__fetch_bpf_obj(void **p_obj_buf,
|
|
size_t *p_obj_buf_sz,
|
|
size_t *p_obj_buf_sz,
|
|
enum test_llvm__testcase idx,
|
|
enum test_llvm__testcase idx,
|
|
- bool force)
|
|
|
|
|
|
+ bool force,
|
|
|
|
+ bool *should_load_fail)
|
|
{
|
|
{
|
|
const char *source;
|
|
const char *source;
|
|
const char *desc;
|
|
const char *desc;
|
|
@@ -68,6 +74,8 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,
|
|
|
|
|
|
source = bpf_source_table[idx].source;
|
|
source = bpf_source_table[idx].source;
|
|
desc = bpf_source_table[idx].desc;
|
|
desc = bpf_source_table[idx].desc;
|
|
|
|
+ if (should_load_fail)
|
|
|
|
+ *should_load_fail = bpf_source_table[idx].should_load_fail;
|
|
|
|
|
|
perf_config(perf_config_cb, NULL);
|
|
perf_config(perf_config_cb, NULL);
|
|
|
|
|
|
@@ -136,14 +144,15 @@ int test__llvm(int subtest)
|
|
int ret;
|
|
int ret;
|
|
void *obj_buf = NULL;
|
|
void *obj_buf = NULL;
|
|
size_t obj_buf_sz = 0;
|
|
size_t obj_buf_sz = 0;
|
|
|
|
+ bool should_load_fail = false;
|
|
|
|
|
|
if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX))
|
|
if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX))
|
|
return TEST_FAIL;
|
|
return TEST_FAIL;
|
|
|
|
|
|
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
|
|
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
|
|
- subtest, false);
|
|
|
|
|
|
+ subtest, false, &should_load_fail);
|
|
|
|
|
|
- if (ret == TEST_OK) {
|
|
|
|
|
|
+ if (ret == TEST_OK && !should_load_fail) {
|
|
ret = test__bpf_parsing(obj_buf, obj_buf_sz);
|
|
ret = test__bpf_parsing(obj_buf, obj_buf_sz);
|
|
if (ret != TEST_OK) {
|
|
if (ret != TEST_OK) {
|
|
pr_debug("Failed to parse test case '%s'\n",
|
|
pr_debug("Failed to parse test case '%s'\n",
|