aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-11-18 15:38:49 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-18 15:38:49 -0500
commit916d4092a1d2d7bb50630497be71ee4c4c2807fa (patch)
treeda3db47ff4efc5abc196bfb503300192cd79628d /tools
parente15bf88a44d1fcb685754b2868b1cd28927af3aa (diff)
perf test: Fix build of BPF and LLVM on older glibc libraries
$ rpm -q glibc glibc-2.12-1.166.el6_7.1.x86_64 <SNIP> CC /tmp/build/perf/tests/llvm.o cc1: warnings being treated as errors tests/llvm.c: In function ‘test_llvm__fetch_bpf_obj’: tests/llvm.c:53: error: declaration of ‘index’ shadows a global declaration /usr/include/string.h:489: error: shadowed declaration is here <SNIP> CC /tmp/build/perf/tests/bpf.o cc1: warnings being treated as errors tests/bpf.c: In function ‘__test__bpf’: tests/bpf.c:149: error: declaration of ‘index’ shadows a global declaration /usr/include/string.h:489: error: shadowed declaration is here <SNIP> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: pi3orama@163.com Cc: Wang Nan <wangnan0@huawei.com> Cc: Zefan Li <lizefan@huawei.com> Fixes: b31de018a628 ("perf test: Enhance the LLVM test: update basic BPF test program") Fixes: ba1fae431e74 ("perf test: Add 'perf test BPF'") Link: http://lkml.kernel.org/n/tip-akpo4r750oya2phxoh9e3447@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/tests/bpf.c14
-rw-r--r--tools/perf/tests/llvm.c8
2 files changed, 11 insertions, 11 deletions
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index ec16f7812c8b..6ebfdee3e2c6 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -146,7 +146,7 @@ prepare_bpf(void *obj_buf, size_t obj_buf_sz, const char *name)
146 return obj; 146 return obj;
147} 147}
148 148
149static int __test__bpf(int index) 149static int __test__bpf(int idx)
150{ 150{
151 int ret; 151 int ret;
152 void *obj_buf; 152 void *obj_buf;
@@ -154,27 +154,27 @@ static int __test__bpf(int index)
154 struct bpf_object *obj; 154 struct bpf_object *obj;
155 155
156 ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz, 156 ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
157 bpf_testcase_table[index].prog_id, 157 bpf_testcase_table[idx].prog_id,
158 true); 158 true);
159 if (ret != TEST_OK || !obj_buf || !obj_buf_sz) { 159 if (ret != TEST_OK || !obj_buf || !obj_buf_sz) {
160 pr_debug("Unable to get BPF object, %s\n", 160 pr_debug("Unable to get BPF object, %s\n",
161 bpf_testcase_table[index].msg_compile_fail); 161 bpf_testcase_table[idx].msg_compile_fail);
162 if (index == 0) 162 if (idx == 0)
163 return TEST_SKIP; 163 return TEST_SKIP;
164 else 164 else
165 return TEST_FAIL; 165 return TEST_FAIL;
166 } 166 }
167 167
168 obj = prepare_bpf(obj_buf, obj_buf_sz, 168 obj = prepare_bpf(obj_buf, obj_buf_sz,
169 bpf_testcase_table[index].name); 169 bpf_testcase_table[idx].name);
170 if (!obj) { 170 if (!obj) {
171 ret = TEST_FAIL; 171 ret = TEST_FAIL;
172 goto out; 172 goto out;
173 } 173 }
174 174
175 ret = do_test(obj, 175 ret = do_test(obj,
176 bpf_testcase_table[index].target_func, 176 bpf_testcase_table[idx].target_func,
177 bpf_testcase_table[index].expect_result); 177 bpf_testcase_table[idx].expect_result);
178out: 178out:
179 bpf__clear(); 179 bpf__clear();
180 return ret; 180 return ret;
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index bc4cf507cde5..366e38ba8b49 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -50,7 +50,7 @@ static struct {
50int 50int
51test_llvm__fetch_bpf_obj(void **p_obj_buf, 51test_llvm__fetch_bpf_obj(void **p_obj_buf,
52 size_t *p_obj_buf_sz, 52 size_t *p_obj_buf_sz,
53 enum test_llvm__testcase index, 53 enum test_llvm__testcase idx,
54 bool force) 54 bool force)
55{ 55{
56 const char *source; 56 const char *source;
@@ -59,11 +59,11 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,
59 char *tmpl_new = NULL, *clang_opt_new = NULL; 59 char *tmpl_new = NULL, *clang_opt_new = NULL;
60 int err, old_verbose, ret = TEST_FAIL; 60 int err, old_verbose, ret = TEST_FAIL;
61 61
62 if (index >= __LLVM_TESTCASE_MAX) 62 if (idx >= __LLVM_TESTCASE_MAX)
63 return TEST_FAIL; 63 return TEST_FAIL;
64 64
65 source = bpf_source_table[index].source; 65 source = bpf_source_table[idx].source;
66 desc = bpf_source_table[index].desc; 66 desc = bpf_source_table[idx].desc;
67 67
68 perf_config(perf_config_cb, NULL); 68 perf_config(perf_config_cb, NULL);
69 69