From 3d7878ef25ada71120ccb8b7de5110c8a73313ab Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Fri, 12 Jan 2018 07:59:20 -0800 Subject: [PATCH] [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 --- .../tests/build_systems/clang_compilation_db/Makefile | 6 +++--- .../differential_interesting_paths_filter/Makefile | 4 ++-- infer/tests/build_systems/genrule/Makefile | 5 +++-- infer/tests/build_systems/mvn/Makefile | 3 ++- .../resource_leak_exception_lines/Makefile | 2 +- infer/tests/build_systems/utf8_in_pwd/Makefile | 3 ++- infer/tests/codetoanalyze/objc/errors/Makefile | 6 +++--- infer/tests/diff.make | 6 +++--- infer/tests/differential.make | 11 ++++++----- infer/tests/infer.make | 3 ++- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/infer/tests/build_systems/clang_compilation_db/Makefile b/infer/tests/build_systems/clang_compilation_db/Makefile index 2bf5a9a41..b83713e22 100644 --- a/infer/tests/build_systems/clang_compilation_db/Makefile +++ b/infer/tests/build_systems/clang_compilation_db/Makefile @@ -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 > $@ diff --git a/infer/tests/build_systems/differential_interesting_paths_filter/Makefile b/infer/tests/build_systems/differential_interesting_paths_filter/Makefile index 86bb2b637..549b28a7c 100644 --- a/infer/tests/build_systems/differential_interesting_paths_filter/Makefile +++ b/infer/tests/build_systems/differential_interesting_paths_filter/Makefile @@ -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 $( $@ diff --git a/infer/tests/build_systems/mvn/Makefile b/infer/tests/build_systems/mvn/Makefile index 9d7464032..e1a6965d8 100644 --- a/infer/tests/build_systems/mvn/Makefile +++ b/infer/tests/build_systems/mvn/Makefile @@ -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 $( $@ diff --git a/infer/tests/diff.make b/infer/tests/diff.make index 19d08e273..513a7bb61 100644 --- a/infer/tests/diff.make +++ b/infer/tests/diff.make @@ -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 diff --git a/infer/tests/differential.make b/infer/tests/differential.make index 20d1cc644..522a4858b 100644 --- a/infer/tests/differential.make +++ b/infer/tests/differential.make @@ -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 diff --git a/infer/tests/infer.make b/infer/tests/infer.make index 64bed261e..0222e8434 100644 --- a/infer/tests/infer.make +++ b/infer/tests/infer.make @@ -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 $(