From: tip-bot for Wang Nan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, namhyung@kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com, jolsa@kernel.org,
wangnan0@huawei.com, acme@redhat.com, mingo@kernel.org,
lizefan@huawei.com
Subject: [tip:perf/urgent] perf test: Enhance the LLVM tests: add kbuild test
Date: Sat, 7 Nov 2015 23:34:20 -0800 [thread overview]
Message-ID: <tip-7af3f3d55b80cce40ad94b6b8e173dccedaf25e6@git.kernel.org> (raw)
In-Reply-To: <1446817783-86722-7-git-send-email-wangnan0@huawei.com>
Commit-ID: 7af3f3d55b80cce40ad94b6b8e173dccedaf25e6
Gitweb: http://git.kernel.org/tip/7af3f3d55b80cce40ad94b6b8e173dccedaf25e6
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Fri, 6 Nov 2015 13:49:42 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 6 Nov 2015 17:49:50 -0300
perf test: Enhance the LLVM tests: add kbuild test
This patch adds a kbuild testcase to check whether kernel headers can be
correctly found.
For example:
# mv /lib/modules/4.3.0-rc5{,.bak}
# perf test LLVM
38: Test LLVM searching and compiling : Skip
# perf test -v LLVM
...
<stdin>:11:10: fatal error: 'uapi/linux/fs.h' file not found
#include <uapi/linux/fs.h>
^
1 error generated.
ERROR: unable to compile -
Hint: Check error message shown above.
Hint: You can also pre-compile it into .o using:
clang -target bpf -O2 -c -
with proper -I and -D options.
Failed to compile test case: 'Test kbuild searching'
test child finished with -2
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1446817783-86722-7-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/Build | 9 ++++++++-
tools/perf/tests/bpf-script-test-kbuild.c | 21 +++++++++++++++++++++
tools/perf/tests/llvm.c | 4 ++++
tools/perf/tests/llvm.h | 2 ++
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 6c095b3..a47b211 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -31,7 +31,7 @@ perf-y += sample-parsing.o
perf-y += parse-no-sample-id-all.o
perf-y += kmod-path.o
perf-y += thread-map.o
-perf-y += llvm.o llvm-src-base.o
+perf-y += llvm.o llvm-src-base.o llvm-src-kbuild.o
perf-y += topology.o
$(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
@@ -41,6 +41,13 @@ $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
$(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@
$(Q)echo ';' >> $@
+$(OUTPUT)tests/llvm-src-kbuild.c: tests/bpf-script-test-kbuild.c
+ $(call rule_mkdir)
+ $(Q)echo '#include <tests/llvm.h>' > $@
+ $(Q)echo 'const char test_llvm__bpf_test_kbuild_prog[] =' >> $@
+ $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@
+ $(Q)echo ';' >> $@
+
ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
endif
diff --git a/tools/perf/tests/bpf-script-test-kbuild.c b/tools/perf/tests/bpf-script-test-kbuild.c
new file mode 100644
index 0000000..3626924
--- /dev/null
+++ b/tools/perf/tests/bpf-script-test-kbuild.c
@@ -0,0 +1,21 @@
+/*
+ * bpf-script-test-kbuild.c
+ * Test include from kernel header
+ */
+#ifndef LINUX_VERSION_CODE
+# error Need LINUX_VERSION_CODE
+# error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
+#endif
+#define SEC(NAME) __attribute__((section(NAME), used))
+
+#include <uapi/linux/fs.h>
+#include <uapi/asm/ptrace.h>
+
+SEC("func=vfs_llseek")
+int bpf_func__vfs_llseek(void *ctx)
+{
+ return 0;
+}
+
+char _license[] SEC("license") = "GPL";
+int _version SEC("version") = LINUX_VERSION_CODE;
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 05683c5..bc4cf50 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -40,6 +40,10 @@ static struct {
.source = test_llvm__bpf_base_prog,
.desc = "Basic BPF llvm compiling test",
},
+ [LLVM_TESTCASE_KBUILD] = {
+ .source = test_llvm__bpf_test_kbuild_prog,
+ .desc = "Test kbuild searching",
+ },
};
diff --git a/tools/perf/tests/llvm.h b/tools/perf/tests/llvm.h
index bd63cee..d91d8f4 100644
--- a/tools/perf/tests/llvm.h
+++ b/tools/perf/tests/llvm.h
@@ -5,9 +5,11 @@
#include <stdbool.h> /* for bool */
extern const char test_llvm__bpf_base_prog[];
+extern const char test_llvm__bpf_test_kbuild_prog[];
enum test_llvm__testcase {
LLVM_TESTCASE_BASE,
+ LLVM_TESTCASE_KBUILD,
__LLVM_TESTCASE_MAX,
};
next prev parent reply other threads:[~2015-11-08 7:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 13:49 [PATCH v2 0/7] perf tools: improve BPF related error delivering and testing Wang Nan
2015-11-06 13:49 ` [PATCH v2 1/7] bpf tools: Improve libbpf error reporting Wang Nan
2015-11-06 14:06 ` Arnaldo Carvalho de Melo
2015-11-08 7:32 ` [tip:perf/urgent] " tip-bot for Wang Nan
2015-11-06 13:49 ` [PATCH v2 2/7] bpf tools: Add new API bpf_object__get_kversion() Wang Nan
2015-11-08 7:32 ` [tip:perf/urgent] bpf tools: Add new API bpf_object__get_kversion () tip-bot for Wang Nan
2015-11-06 13:49 ` [PATCH v2 3/7] perf tools: Make fetch_kernel_version() public available Wang Nan
2015-11-06 13:55 ` [PATCH v2 3/7 fix] " Wang Nan
2015-11-08 7:33 ` [tip:perf/urgent] perf tools: Make fetch_kernel_version() publicly available tip-bot for Wang Nan
2015-11-06 13:49 ` [PATCH v2 4/7] perf tools: Improve BPF related error messages output Wang Nan
2015-11-06 13:58 ` [PATCH v2 4/7 fix] " Wang Nan
2015-11-08 7:33 ` [tip:perf/urgent] perf bpf: Improve BPF related error messages tip-bot for Wang Nan
2015-11-06 13:49 ` [PATCH v2 5/7] perf test: Enforce LLVM test: update basic BPF test program Wang Nan
2015-11-08 7:34 ` [tip:perf/urgent] perf test: Enhance the " tip-bot for Wang Nan
2015-11-06 13:49 ` [PATCH v2 6/7] perf test: Enforce LLVM test: add kbuild test Wang Nan
2015-11-08 7:34 ` tip-bot for Wang Nan [this message]
2015-11-06 13:49 ` [PATCH v2 7/7] perf test: Add 'perf test BPF' Wang Nan
2015-11-08 7:34 ` [tip:perf/urgent] " tip-bot for Wang Nan
2015-11-06 19:20 ` [PATCH v2 0/7] perf tools: improve BPF related error delivering and testing Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-7af3f3d55b80cce40ad94b6b8e173dccedaf25e6@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox