[ovs-dev] [PATCH] Makefile.am: Add clang static analysis support

Bodireddy, Bhanuprakash bhanuprakash.bodireddy at intel.com
Mon Jun 27 19:16:06 UTC 2016


>-----Original Message-----
>From: William Tu [mailto:u9012063 at gmail.com]
>Sent: Monday, June 27, 2016 6:57 PM
>To: Bodireddy, Bhanuprakash <bhanuprakash.bodireddy at intel.com>
>Cc: <dev at openvswitch.org> <dev at openvswitch.org>
>Subject: Re: [ovs-dev] [PATCH] Makefile.am: Add clang static analysis support
>
>This is pretty cool. I tested it and have some comments.
>
>On Mon, Jun 27, 2016 at 9:11 AM, Bhanuprakash Bodireddy
><bhanuprakash.bodireddy at intel.com> wrote:
>> Clang Static Analyzer is a source code analysis tool to find bugs.
>> This patch adds make target to trigger static analysis using below commands.
>>
>> ./boot.sh
>> ./configure --with-dpdk(for configuring DPDK datapath) make
>> clang-analyze scan-view --host=<ip address> --port <PORT>
>>   $OVS_DIR>/clang-analyzer-results/yyyy-mm-dd-114251-1027-1>
>> --allow-all-hosts
>>
>> Results can be viewed on browser: http://<ip address>:<PORT>/
>>
>> Signed-off-by: Bhanuprakash Bodireddy
>> <bhanuprakash.bodireddy at intel.com>
>> ---
>>  Makefile.am | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/Makefile.am b/Makefile.am index 8cb8523..ac96be6 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -400,6 +400,16 @@ ovsext_clean: datapath-windows/ovsext.sln  endif
>>  .PHONY: ovsext
>>
>> +clang-analyze: clean
>> +       @if which clang scan-build > /dev/null 2>&1; then \
>> +         $(MKDIR_P) "$(srcdir)/clang-analyzer-results" || exit 1; \
>> +         scan-build -o $(srcdir)/clang-analyzer-results
>> +--use-analyzer=/usr/bin/clang \
>
>Since we have valgrind/helgrind results under tests dir, maybe output to
>''$(srcdir)/tests/clang-analyzer-results".

I agree to this. I will do this in v2 patch.

>
>> +               make -j || exit 1; \
>
>"make -j" creates lots of jobs and hangs my system. Maybe just use 'make'
>and let people to optimize if they want.

Thanks for testing and pointing this out. I had intentionally used 'make -j' to speed up the analysis and tested it on my target with 28 cores.
I shall update the patch to remove '-j' flag to prevent potential hangs.

>
>Regards,
>William


More information about the dev mailing list