diff mbox

perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set

Message ID 20170620183203.2517-1-wangnan0@huawei.com
State Accepted
Commit 9b57fb7e35957c6838f89f4ed7e3f8433a4bbfc5
Headers show

Commit Message

Wang Nan June 20, 2017, 6:32 p.m. UTC
'if' is defined to complex code when CONFIG_PROFILE_ALL_BRANCHES is
selected, which cause a 'perf test LLVM' failure like:

 $ ./perf test LLVM
 35: LLVM search and compile                    :
 35.1: Basic BPF llvm compile                    : Ok
 35.2: kbuild searching                          : Ok
 35.3: Compile source for BPF prologue generation: FAILED!
 35.4: Compile source for BPF relocation         : Skip

The only affected test case is bpf-script-test-prologue.c
because it uses kernel headers and has 'if' inside.

This patch undefines 'if' to make it passes perf test.

Signed-off-by: Wang Nan <wangnan0@huawei.com>

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Li Zefan <lizefan@huawei.com>
---
 tools/perf/tests/bpf-script-test-prologue.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.9.3
diff mbox

Patch

diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c
index 7230e62..b4ebc75 100644
--- a/tools/perf/tests/bpf-script-test-prologue.c
+++ b/tools/perf/tests/bpf-script-test-prologue.c
@@ -10,6 +10,15 @@ 
 
 #include <uapi/linux/fs.h>
 
+/*
+ * If CONFIG_PROFILE_ALL_BRANCHES is selected,
+ * 'if' is redefined after include kernel header.
+ * Recover 'if' for BPF object code.
+ */
+#ifdef if
+# undef if
+#endif
+
 #define FMODE_READ		0x1
 #define FMODE_WRITE		0x2