Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbdFSK17 (ORCPT ); Mon, 19 Jun 2017 06:27:59 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:7906 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753682AbdFSK15 (ORCPT ); Mon, 19 Jun 2017 06:27:57 -0400 From: Wang Nan To: , CC: , Wang Nan , "Arnaldo Carvalho de Melo" , Hendrik Brueckner , Alexei Starovoitov , Li Zefan Subject: [PATCH] perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set Date: Wed, 21 Jun 2017 02:32:03 +0800 Message-ID: <20170620183203.2517-1-wangnan0@huawei.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.110.60.55] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.5947A720.01D2,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 115d147b313a6642201ba20c83a86eb1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1495 Lines: 47 '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 Cc: Arnaldo Carvalho de Melo Cc: Thomas-Mich Richter Cc: Hendrik Brueckner Cc: Alexei Starovoitov Cc: Li Zefan --- tools/perf/tests/bpf-script-test-prologue.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 +/* + * 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 -- 2.9.3