diff options
Diffstat (limited to 'tools/perf/tests/llvm.c')
-rw-r--r-- | tools/perf/tests/llvm.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c index 06f45c1d4256..cff564fb4b66 100644 --- a/tools/perf/tests/llvm.c +++ b/tools/perf/tests/llvm.c | |||
@@ -6,12 +6,6 @@ | |||
6 | #include "tests.h" | 6 | #include "tests.h" |
7 | #include "debug.h" | 7 | #include "debug.h" |
8 | 8 | ||
9 | static int perf_config_cb(const char *var, const char *val, | ||
10 | void *arg __maybe_unused) | ||
11 | { | ||
12 | return perf_default_config(var, val, arg); | ||
13 | } | ||
14 | |||
15 | #ifdef HAVE_LIBBPF_SUPPORT | 9 | #ifdef HAVE_LIBBPF_SUPPORT |
16 | static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz) | 10 | static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz) |
17 | { | 11 | { |
@@ -35,6 +29,7 @@ static int test__bpf_parsing(void *obj_buf __maybe_unused, | |||
35 | static struct { | 29 | static struct { |
36 | const char *source; | 30 | const char *source; |
37 | const char *desc; | 31 | const char *desc; |
32 | bool should_load_fail; | ||
38 | } bpf_source_table[__LLVM_TESTCASE_MAX] = { | 33 | } bpf_source_table[__LLVM_TESTCASE_MAX] = { |
39 | [LLVM_TESTCASE_BASE] = { | 34 | [LLVM_TESTCASE_BASE] = { |
40 | .source = test_llvm__bpf_base_prog, | 35 | .source = test_llvm__bpf_base_prog, |
@@ -48,14 +43,19 @@ static struct { | |||
48 | .source = test_llvm__bpf_test_prologue_prog, | 43 | .source = test_llvm__bpf_test_prologue_prog, |
49 | .desc = "Compile source for BPF prologue generation test", | 44 | .desc = "Compile source for BPF prologue generation test", |
50 | }, | 45 | }, |
46 | [LLVM_TESTCASE_BPF_RELOCATION] = { | ||
47 | .source = test_llvm__bpf_test_relocation, | ||
48 | .desc = "Compile source for BPF relocation test", | ||
49 | .should_load_fail = true, | ||
50 | }, | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | |||
54 | int | 53 | int |
55 | test_llvm__fetch_bpf_obj(void **p_obj_buf, | 54 | test_llvm__fetch_bpf_obj(void **p_obj_buf, |
56 | size_t *p_obj_buf_sz, | 55 | size_t *p_obj_buf_sz, |
57 | enum test_llvm__testcase idx, | 56 | enum test_llvm__testcase idx, |
58 | bool force) | 57 | bool force, |
58 | bool *should_load_fail) | ||
59 | { | 59 | { |
60 | const char *source; | 60 | const char *source; |
61 | const char *desc; | 61 | const char *desc; |
@@ -68,8 +68,8 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf, | |||
68 | 68 | ||
69 | source = bpf_source_table[idx].source; | 69 | source = bpf_source_table[idx].source; |
70 | desc = bpf_source_table[idx].desc; | 70 | desc = bpf_source_table[idx].desc; |
71 | 71 | if (should_load_fail) | |
72 | perf_config(perf_config_cb, NULL); | 72 | *should_load_fail = bpf_source_table[idx].should_load_fail; |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * Skip this test if user's .perfconfig doesn't set [llvm] section | 75 | * Skip this test if user's .perfconfig doesn't set [llvm] section |
@@ -136,14 +136,15 @@ int test__llvm(int subtest) | |||
136 | int ret; | 136 | int ret; |
137 | void *obj_buf = NULL; | 137 | void *obj_buf = NULL; |
138 | size_t obj_buf_sz = 0; | 138 | size_t obj_buf_sz = 0; |
139 | bool should_load_fail = false; | ||
139 | 140 | ||
140 | if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX)) | 141 | if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX)) |
141 | return TEST_FAIL; | 142 | return TEST_FAIL; |
142 | 143 | ||
143 | ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz, | 144 | ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz, |
144 | subtest, false); | 145 | subtest, false, &should_load_fail); |
145 | 146 | ||
146 | if (ret == TEST_OK) { | 147 | if (ret == TEST_OK && !should_load_fail) { |
147 | ret = test__bpf_parsing(obj_buf, obj_buf_sz); | 148 | ret = test__bpf_parsing(obj_buf, obj_buf_sz); |
148 | if (ret != TEST_OK) { | 149 | if (ret != TEST_OK) { |
149 | pr_debug("Failed to parse test case '%s'\n", | 150 | pr_debug("Failed to parse test case '%s'\n", |