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
This commit is contained in:
Igor Sugak 2015-02-23 17:45:25 -08:00
parent 96d989f70d
commit 6fdda8ac4d
2 changed files with 13 additions and 8 deletions

2
.gitignore vendored
View File

@ -48,3 +48,5 @@ java/crossbuild/.vagrant
.vagrant/ .vagrant/
java/**.asc java/**.asc
java/javadoc java/javadoc
scan_build_report/

View File

@ -358,9 +358,11 @@ valgrind_check: all $(PROGRAMS) $(TESTS)
echo $$t $$((etime - stime)) >> $(VALGRIND_DIR)/valgrind_tests_times; \ echo $$t $$((etime - stime)) >> $(VALGRIND_DIR)/valgrind_tests_times; \
done done
analyze: analyze: clean
$(MAKE) clean $(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) \
$(CLANG_SCAN_BUILD) --use-analyzer=$(CLANG_ANALYZER) -o $(CURDIR)/scan_build_report $(MAKE) all -j32 --use-c++=$(CXX) --use-cc=$(CC) --status-bugs \
-o $(CURDIR)/scan_build_report \
$(MAKE) dbg
unity.cc: unity.cc:
$(shell (export ROCKSDB_ROOT="$(CURDIR)"; "$(CURDIR)/build_tools/unity" "$(CURDIR)/unity.cc")) $(shell (export ROCKSDB_ROOT="$(CURDIR)"; "$(CURDIR)/build_tools/unity" "$(CURDIR)/unity.cc"))
@ -369,11 +371,12 @@ unity: unity.o
$(AM_LINK) $(AM_LINK)
clean: clean:
-rm -f $(PROGRAMS) $(TESTS) $(LIBRARY) $(SHARED) make_config.mk unity.cc rm -f $(PROGRAMS) $(TESTS) $(LIBRARY) $(SHARED) make_config.mk unity.cc
-rm -rf ios-x86/* ios-arm/* rm -rf ios-x86 ios-arm scan_build_report
-find . -name "*.[oda]" -exec rm {} \; find . -name "*.[oda]" -exec rm {} \;
-find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \;
-rm -rf bzip2* snappy* zlib* rm -rf bzip2* snappy* zlib*
tags: tags:
ctags * -R ctags * -R
cscope -b `find . -name '*.cc'` `find . -name '*.h'` cscope -b `find . -name '*.cc'` `find . -name '*.h'`