From 03cb052ad99b7ba9da40a648a8b9761048cba305 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Thu, 12 Oct 2017 09:44:29 -0700 Subject: [PATCH] [infer][checkers] run the Java biabduction tests using the checkers framework Summary: Another step toward running the biabduction analysis as a checker. Depends on D6038210 Reviewed By: jvillard Differential Revision: D6038682 fbshipit-source-id: fed45bf --- infer/models/java/Makefile | 2 +- infer/src/backend/specs.ml | 9 +++------ infer/src/base/Config.ml | 13 ++++++++++++- infer/tests/codetoanalyze/java/eradicate/Makefile | 2 +- infer/tests/codetoanalyze/java/infer/.inferconfig | 2 +- infer/tests/codetoanalyze/java/infer/Makefile | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/infer/models/java/Makefile b/infer/models/java/Makefile index 41a7f309d..05d82e65b 100644 --- a/infer/models/java/Makefile +++ b/infer/models/java/Makefile @@ -32,7 +32,7 @@ $(INFER_REPORT): $(JAVA_DEPS_NO_MODELS) $(JAVA_SOURCES) $(QUIET)$(MKDIR_P) $(MODELS_OUT) $(QUIET)rm -f $(JAVA_MODELS_JAR) $(QUIET)$(call silent_on_success,Building Java models,\ - $(INFER_BIN) --results-dir $(INFER_RESULTS_DIR) --models-mode -- \ + $(INFER_BIN) -a checkers --biabduction-only --results-dir $(INFER_RESULTS_DIR) --models-mode -- \ $(JAVAC) -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(MODELS_CLASSPATH) \ $(JAVA_SOURCES)) diff --git a/infer/src/backend/specs.ml b/infer/src/backend/specs.ml index 9d9fde2b3..3f5aefd91 100644 --- a/infer/src/backend/specs.ml +++ b/infer/src/backend/specs.ml @@ -722,12 +722,9 @@ let dummy = (** Reset a summary rebuilding the dependents and preserving the proc attributes if present. *) let reset_summary proc_desc = let proc_desc_option = if Config.dynamic_dispatch = `Lazy then Some proc_desc else None in - init_summary - ( [] - , ProcAttributes.proc_flags_empty () - , [] - , Procdesc.get_attributes proc_desc - , proc_desc_option ) + let attributes = Procdesc.get_attributes proc_desc in + let proc_flags = attributes.ProcAttributes.proc_flags in + init_summary ([], proc_flags, [], attributes, proc_desc_option) (* =============== END of support for spec tables =============== *) (* diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 495f3957c..7c8534ab2 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -2383,7 +2383,18 @@ let clang_frontend_action_string = let dynamic_dispatch = let default_mode = - match analyzer with BiAbduction -> `Lazy | Checkers when quandary -> `Sound | _ -> `None + match analyzer with + | BiAbduction + -> `Lazy + | Checkers when biabduction + -> if quandary then + F.printf + "WARNING: Running Quanday on Java is not compatible with the Biabduction analysis@." ; + `Lazy + | Checkers when quandary + -> `Sound + | _ + -> `None in Option.value ~default:default_mode !dynamic_dispatch diff --git a/infer/tests/codetoanalyze/java/eradicate/Makefile b/infer/tests/codetoanalyze/java/eradicate/Makefile index 5c506652e..3baa3f173 100644 --- a/infer/tests/codetoanalyze/java/eradicate/Makefile +++ b/infer/tests/codetoanalyze/java/eradicate/Makefile @@ -8,7 +8,7 @@ TESTS_DIR = ../../.. ANALYZER = checkers -INFER_OPTIONS = --no-default-checkers --eradicate --eradicate-return-over-annotated --eradicate-optional-present --debug-exceptions +INFER_OPTIONS = --eradicate-only --eradicate-return-over-annotated --eradicate-optional-present --debug-exceptions INFERPRINT_OPTIONS = --issues-tests SOURCES = $(wildcard *.java) diff --git a/infer/tests/codetoanalyze/java/infer/.inferconfig b/infer/tests/codetoanalyze/java/infer/.inferconfig index dc3c086c7..a7e342c8c 100644 --- a/infer/tests/codetoanalyze/java/infer/.inferconfig +++ b/infer/tests/codetoanalyze/java/infer/.inferconfig @@ -11,7 +11,7 @@ "method": "get" } ], - "infer-blacklist-files-containing": [ + "checkers-blacklist-files-containing": [ "@generated" ], "skip-translation": [ diff --git a/infer/tests/codetoanalyze/java/infer/Makefile b/infer/tests/codetoanalyze/java/infer/Makefile index eed8ebb85..372c215ec 100644 --- a/infer/tests/codetoanalyze/java/infer/Makefile +++ b/infer/tests/codetoanalyze/java/infer/Makefile @@ -7,8 +7,8 @@ TESTS_DIR = ../../.. -ANALYZER = infer -INFER_OPTIONS = --no-filtering --debug-exceptions +ANALYZER = checkers +INFER_OPTIONS = --biabduction-only --debug-exceptions INFERPRINT_OPTIONS = --issues-tests SOURCES = $(wildcard *.java)