[make] make sure we always read from the right infer-out/

Summary:
Some commands (mostly `infer report`) would attempt to run the initialisation
code of infer from the default results directory instead of the one used by the
test. This is mostly harmless because we do not actually use anything from the
directory (typically, we pass `--from-json-results foo.json` and only foo.json
matters). However, this can trip the initialisation code, eg on db schema
changes.

Reviewed By: mbouaziz

Differential Revision: D6711641

fbshipit-source-id: f04b4c7
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 66b1956e9a
commit 3d7878ef25

@ -46,9 +46,9 @@ infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json
issues.exp.test: infer-out-with-index/report.json infer-out-no-index/report.json infer-out-reactive-capture/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.with-index \
--from-json-report infer-out-with-index/report.json
-o infer-out-with-index --from-json-report infer-out-with-index/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.no-index \
--from-json-report infer-out-no-index/report.json
-o infer-out-no-index --from-json-report infer-out-no-index/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.reactive-capture \
--from-json-report infer-out-reactive-capture/report.json
-o infer-out-reactive-capture --from-json-report infer-out-reactive-capture/report.json
$(QUIET)cat $@.with-index $@.no-index $@.reactive-capture > $@

@ -31,13 +31,13 @@ $(MODIFIED_FILES_FILE):
sed 's#__ABSOLUTE_PATH__#$(CURDIR)#g' '$(MODIFIED_FILES_FILE).template' > $@)
current.exp.test: $(CURRENT_REPORT)
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(<D) \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(CURRENT_DIR)/report.json \
--issues-tests current.exp.test
previous.exp.test: $(PREVIOUS_REPORT)
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(<D) \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(PREVIOUS_DIR)/report.json \
--issues-tests previous.exp.test

@ -30,7 +30,7 @@ $(OBJECTS): $(JAVA_SOURCE_FILES)
genrule: $(JSON_REPORT)
$(JSON_REPORT): $(JAVA_DEPS) $(JAVA_SOURCE_FILES)
$(JSON_REPORT): $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(MAKEFILE_LIST)
$(QUIET)cd $(ROOT_DIR) && \
$(REMOVE_DIR) buck-out && \
$(call silent_on_success,Testing Buck genrule for Java integration,\
@ -38,7 +38,8 @@ $(JSON_REPORT): $(JAVA_DEPS) $(JAVA_SOURCE_FILES)
$(BUCK) build --no-cache $(INFER_TARGET))
$(QUIET)touch $@
infer-out/report.json: $(JSON_REPORT)
infer-out/report.json: $(JSON_REPORT) $(MAKEFILE_LIST)
$(QUIET)$(REMOVE_DIR) infer-out
$(QUIET)$(MKDIR_P) infer-out
# the report contains absolute paths
$(QUIET)sed -e 's#$(abspath $(TESTS_DIR))/##g' $< > $@

@ -39,7 +39,8 @@ infer-out-simple_app/report.json: infer-out-app_with_infer_profile/report.json
infer-out-app_with_infer_profile/report.json: infer-out-app_with_profiles/report.json
issues-%.exp.test: infer-out-%/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ \
-o $(<D) --from-json-report $<
issues.exp.test: $(foreach mvndir,$(MVN_DIRS),issues-$(mvndir).exp.test)
# erase the contents of the file

@ -22,7 +22,7 @@ $(REPORT): $(JAVA_DEPS) $(MAKEFILE_LIST) SimpleLeak.java
$(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) -- javac SimpleLeak.java)
$(EXPECTED_TEST_OUTPUT): $(REPORT)
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(<D) \
--issues-fields "qualifier_contains_potential_exception_note,bug_type,file,procedure,line_offset" \
--from-json-report $(REPORT) \
--issues-tests $(EXPECTED_TEST_OUTPUT)

@ -92,7 +92,8 @@ infer-out-make/report.json: $(CLANG_DEPS) $(MAKE_DIR)
make clean all)
issues-%.exp.test: infer-out-%/report.json $(INFER_BIN)
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ \
-o $(<D) --from-json-report $<
issues.exp.test: issues-cmake.exp.test issues-gradle.exp.test issues-javac.exp.test \
issues-make.exp.test

@ -139,9 +139,9 @@ infer-out/report.json: $(CLANG_DEPS) $(SOURCES_DEFAULT)
issues.exp.test: infer-out-all/report.json infer-out-arc/report.json infer-out/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.all \
--from-json-report infer-out-all/report.json
-o infer-out-all --from-json-report infer-out-all/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.arc \
--from-json-report infer-out-arc/report.json
-o infer-out-arc --from-json-report infer-out-arc/report.json
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.default \
--from-json-report infer-out/report.json
-o infer-out --from-json-report infer-out/report.json
$(QUIET)cat $@.all $@.arc $@.default > $@

@ -19,13 +19,13 @@ default: analyze
analyze: $(INFER_OUT)/differential/introduced.json
introduced.exp.test: $(INFER_OUT)/differential/introduced.json $(INFER_BIN)
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--from-json-report $(INFER_OUT)/differential/introduced.json \
--issues-tests introduced.exp.test
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--from-json-report $(INFER_OUT)/differential/fixed.json \
--issues-tests fixed.exp.test
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--from-json-report $(INFER_OUT)/differential/preexisting.json \
--issues-tests preexisting.exp.test

@ -30,22 +30,23 @@ $(PREVIOUS_REPORT): $(CURRENT_REPORT)
.PHONY: analyze
analyze: $(CURRENT_REPORT) $(PREVIOUS_REPORT)
$(DIFFERENTIAL_REPORT): $(CURRENT_REPORT) $(PREVIOUS_REPORT)
$(DIFFERENTIAL_REPORT): $(CURRENT_REPORT) $(PREVIOUS_REPORT) $(MAKEFILE_LIST)
$(QUIET)$(REMOVE_DIR) $(INFER_OUT)
$(QUIET)$(call silent_on_success,Computing results difference in $(TEST_REL_DIR),\
$(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) reportdiff \
--report-current $(CURRENT_REPORT) --report-previous $(PREVIOUS_REPORT) \
$(DIFFERENTIAL_ARGS))
$(EXPECTED_TEST_OUTPUT): $(DIFFERENTIAL_REPORT) $(INFER_BIN)
$(QUIET)$(INFER_BIN) report \
$(EXPECTED_TEST_OUTPUT): $(DIFFERENTIAL_REPORT) $(INFER_BIN) $(MAKEFILE_LIST)
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/introduced.json \
--issues-tests introduced.exp.test
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/fixed.json \
--issues-tests fixed.exp.test
$(QUIET)$(INFER_BIN) report \
$(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/preexisting.json \
--issues-tests preexisting.exp.test

@ -13,7 +13,8 @@ ANALYZER_STRING=$(shell if [ -n $(ANALYZER) ]; then printf ' ($(ANALYZER))'; fi)
default: compile
issues.exp.test$(TEST_SUFFIX): infer-out$(TEST_SUFFIX)/report.json $(INFER_BIN)
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
$(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) --results-dir $(<D) \
$(INFERPRINT_OPTIONS) $@ --from-json-report $<
.PHONY: compile
compile: $(OBJECTS)

Loading…
Cancel
Save