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(in case of 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>/

v1->v2:
* Change the output directory to tests/clang-analyzer-results
* Remove '-j' make option, This might potentially hang some system
  while spawning infinite jobs.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com>
---
 Makefile.am | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 8cb8523..d0e6166 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)/tests/clang-analyzer-results" || exit 1; \
+         scan-build -o $(srcdir)/tests/clang-analyzer-results 
--use-analyzer=/usr/bin/clang \
+               make || exit 1; \
+       else \
+         echo -e "Unable to find clang/scan-build, Install 
clang,clang-analyzer packages"; \
+       fi
+.PHONY: clang-analyze
+
 dist-hook: $(DIST_HOOKS)
 all-local: $(ALL_LOCAL)
 clean-local: $(CLEAN_LOCAL)
-- 
2.4.11

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to