register checkers in monocore mode

Summary:
Most of the diff adds a way to run an existing test with different infer
options.

Also, do not run the Python script when capturing "analyze".

fixes https://github.com/facebook/infer/issues/518

Reviewed By: jberdine

Differential Revision: D4333762

fbshipit-source-id: 642acff
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent c51c4a21ae
commit bcac924e7f

@ -15,7 +15,7 @@ endif
BUILD_SYSTEMS_TESTS = \ BUILD_SYSTEMS_TESTS = \
assembly ck_analytics ck_imports clang_multiple_files clang_translation clang_unknown_ext \ assembly ck_analytics ck_imports clang_multiple_files clang_translation clang_unknown_ext \
delete_results_dir fail_on_issue gradle javac linters make project_root_rel reactive \ delete_results_dir fail_on_issue gradle j1 javac linters make project_root_rel reactive \
utf8_in_procname utf8_in_pwd waf utf8_in_procname utf8_in_pwd waf
ifneq ($(ANT),no) ifneq ($(ANT),no)
BUILD_SYSTEMS_TESTS += ant BUILD_SYSTEMS_TESTS += ant

@ -125,5 +125,5 @@ CLANG_DEPS = $(addprefix $(PYTHON_LIB_DIR)/, \
JAVA_MODELS_JAR = $(LIB_DIR)/java/models.jar JAVA_MODELS_JAR = $(LIB_DIR)/java/models.jar
define silent_on_success define silent_on_success
$(1) >/dev/null 2>/dev/null || ($(1) && exit 1) $(1) >/dev/null 2>/dev/null || (echo $(1); $(1) && exit 1)
endef endef

@ -93,6 +93,7 @@ let print_stdout_legend () => {
}; };
let main makefile => { let main makefile => {
RegisterCheckers.register ();
BuiltinDefn.init (); BuiltinDefn.init ();
switch Config.modified_targets { switch Config.modified_targets {
| Some file => MergeCapture.modified_file file | Some file => MergeCapture.modified_file file

@ -47,6 +47,5 @@ let () = {
Printexc.record_backtrace true Printexc.record_backtrace true
}; };
print_prolog (); print_prolog ();
RegisterCheckers.register ();
InferAnalyze.main Config.makefile_cmdline InferAnalyze.main Config.makefile_cmdline
}; };

@ -151,6 +151,8 @@ let capture_with_compilation_database db_files =
let capture build_cmd = function let capture build_cmd = function
| Analyze when not (List.is_empty !Config.clang_compilation_db_files) -> | Analyze when not (List.is_empty !Config.clang_compilation_db_files) ->
capture_with_compilation_database !Config.clang_compilation_db_files capture_with_compilation_database !Config.clang_compilation_db_files
| Analyze ->
()
| Buck when Config.use_compilation_database <> None -> | Buck when Config.use_compilation_database <> None ->
L.stdout "Capturing using Buck's compilation database...@\n"; L.stdout "Capturing using Buck's compilation database...@\n";
let json_cdb = CaptureCompilationDatabase.get_compilation_database_files_buck () in let json_cdb = CaptureCompilationDatabase.get_compilation_database_files_buck () in

@ -11,22 +11,23 @@ include $(ROOT_DIR)/Makefile.config
default: compile default: compile
issues.exp.test: infer-out/report.json $(INFERPRINT_BIN) issues.exp.test$(TEST_SUFFIX): infer-out$(TEST_SUFFIX)/report.json $(INFERPRINT_BIN)
$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< $(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
.PHONY: compile .PHONY: compile
compile: $(OBJECTS) compile: $(OBJECTS)
.PHONY: analyze .PHONY: analyze
analyze: infer-out/report.json analyze: infer-out$(TEST_SUFFIX)/report.json
.PHONY: print .PHONY: print
print: issues.exp.test print: issues.exp.test$(TEST_SUFFIX)
.PHONY: test .PHONY: test
test: issues.exp.test test: issues.exp.test$(TEST_SUFFIX)
diff -u issues.exp issues.exp.test diff -u issues.exp issues.exp.test$(TEST_SUFFIX)
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf codetoanalyze issues.exp.test infer-out $(OBJECTS) $(CLEAN_EXTRA) $(REMOVE_DIR) codetoanalyze issues.exp.test$(TEST_SUFFIX) infer-out$(TEST_SUFFIX) \
$(OBJECTS) $(CLEAN_EXTRA)

@ -0,0 +1,12 @@
# Copyright (c) 2016 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
default: compile
.PHONY: print test clean
print test clean:
INFER_ARGS=-j^1 $(MAKE) -C ../../codetoanalyze/cpp/checkers TEST_SUFFIX=-j1 $@

@ -14,7 +14,10 @@ OBJECTS = $(foreach source,$(SOURCES),$(basename $(source)).o)
include $(TESTS_DIR)/base.make include $(TESTS_DIR)/base.make
include $(TESTS_DIR)/clang-base.make include $(TESTS_DIR)/clang-base.make
infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(HEADERS) infer-out$(TEST_SUFFIX)/report.json: $(CLANG_DEPS) $(SOURCES) $(HEADERS)
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) --check-duplicate-symbols $(INFER_OPTIONS) -a $(ANALYZER) -- clang $(CLANG_OPTIONS) $(SOURCES) 2>duplicates.txt) $(INFER_BIN) --results-dir $(@D) --check-duplicate-symbols \
$(INFER_OPTIONS) -a $(ANALYZER) -- \
clang $(CLANG_OPTIONS) $(SOURCES) 2> \
>(tee duplicates.txt))
grep "DUPLICATE_SYMBOLS" duplicates.txt; test $$? -ne 0 grep "DUPLICATE_SYMBOLS" duplicates.txt; test $$? -ne 0

Loading…
Cancel
Save