From 6fdda8ac4d59d5edfac42994e614c7cfddd0def2 Mon Sep 17 00:00:00 2001 From: Igor Sugak Date: Mon, 23 Feb 2015 17:45:25 -0800 Subject: [PATCH] rocksdb: changes to support 'make analyze' in Jenkins Summary: * Updated Makefile to exit `make analyze` with status 1 if scan-build detected any bugs. * scan-build automatically detects which c++ compiler to use, and some times is uses wrong ones (from $CPP). Added implicit parameters to use $CC and $CXX. * Added `scan_build_report` directory to .gitignore file. * Added `scan_build_report` directory to clean target. Test Plan: Run `make analyze` and verify that exit status is 1, if there are scan-build bugs detected. Run `make clean` and verify that files in `scan_build_report` directory are deleted. After running `make analyze; git status` and verify that no untracked files in `scan_build_report` directory. Reviewers: meyering, sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D33831 --- .gitignore | 2 ++ Makefile | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b59adcbe5..1cea8c20f 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ java/crossbuild/.vagrant .vagrant/ java/**.asc java/javadoc + +scan_build_report/ diff --git a/Makefile b/Makefile index d8ba31c92..bf53b5747 100644 --- a/Makefile +++ b/Makefile @@ -358,9 +358,11 @@ valgrind_check: all $(PROGRAMS) $(TESTS) echo $$t $$((etime - stime)) >> $(VALGRIND_DIR)/valgrind_tests_times; \ done -analyze: - $(MAKE) clean - $(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) -o $(CURDIR)/scan_build_report $(MAKE) all -j32 +analyze: clean + $(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) \ + --use-c++=$(CXX) --use-cc=$(CC) --status-bugs \ + -o $(CURDIR)/scan_build_report \ + $(MAKE) dbg unity.cc: $(shell (export ROCKSDB_ROOT="$(CURDIR)"; "$(CURDIR)/build_tools/unity" "$(CURDIR)/unity.cc")) @@ -369,11 +371,12 @@ unity: unity.o $(AM_LINK) clean: - -rm -f $(PROGRAMS) $(TESTS) $(LIBRARY) $(SHARED) make_config.mk unity.cc - -rm -rf ios-x86/* ios-arm/* - -find . -name "*.[oda]" -exec rm {} \; - -find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; - -rm -rf bzip2* snappy* zlib* + rm -f $(PROGRAMS) $(TESTS) $(LIBRARY) $(SHARED) make_config.mk unity.cc + rm -rf ios-x86 ios-arm scan_build_report + find . -name "*.[oda]" -exec rm {} \; + find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; + rm -rf bzip2* snappy* zlib* + tags: ctags * -R cscope -b `find . -name '*.cc'` `find . -name '*.h'`