From 339ebe74ec6a2e9a448b75fdd611c97f8a1ea852 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 11 Mar 2020 04:52:32 -0700 Subject: [PATCH] [config] sensible default for --from-json-report Summary: Make /report.json the default value for this option, as this is what is used 99% of the time. Clean up test options using this. Reviewed By: ngorogiannis Differential Revision: D20362644 fbshipit-source-id: a1bb18757 --- infer/man/man1/infer-full.txt | 10 +++++----- infer/man/man1/infer-report.txt | 8 ++++---- infer/man/man1/infer.txt | 10 +++++----- infer/src/backend/InferPrint.ml | 8 ++++---- infer/src/base/Config.ml | 14 +++++++------- infer/src/base/Config.mli | 8 ++++---- .../tests/build_systems/buck_flavors_diff/Makefile | 2 -- .../build_systems/clang_compilation_db/Makefile | 6 +++--- .../differential_interesting_paths_filter/Makefile | 6 ++---- infer/tests/build_systems/mvn/Makefile | 3 +-- .../resource_leak_exception_lines/Makefile | 3 +-- infer/tests/build_systems/utf8_in_pwd/Makefile | 3 +-- infer/tests/codetoanalyze/c/errors/Makefile | 2 +- infer/tests/codetoanalyze/java/classloads/Makefile | 2 +- infer/tests/codetoanalyze/objc/errors/Makefile | 6 +++--- infer/tests/differential.make | 6 +++--- infer/tests/infer.make | 2 +- 17 files changed, 46 insertions(+), 53 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index c1ac48e57..e3104cfc0 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -655,16 +655,16 @@ OPTIONS particular path, with the format path:version (can be specified multiple times) See also infer-capture(1). - --issues-fields ,-separated sequence of { bug_type | bucket | + --issues-tests file + Write a list of issues in a format suitable for tests to file + See also infer-report(1). + + --issues-tests-fields ,-separated sequence of { bug_type | bucket | qualifier | severity | line | column | procedure | procedure_start_line | file | bug_trace | key | hash | line_offset | qualifier_contains_potential_exception_note } Fields to emit with --issues-tests See also infer-report(1). - --issues-tests file - Write a list of issues in a format suitable for tests to file - See also infer-report(1). - --java-jar-compiler path Specify the Java compiler jar used to generate the bytecode See also infer-capture(1). diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index bf124a678..926de8ea2 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -274,15 +274,15 @@ OPTIONS Show this manual with all internal options in the INTERNAL OPTIONS section - --issues-fields ,-separated sequence of { bug_type | bucket | + --issues-tests file + Write a list of issues in a format suitable for tests to file + + --issues-tests-fields ,-separated sequence of { bug_type | bucket | qualifier | severity | line | column | procedure | procedure_start_line | file | bug_trace | key | hash | line_offset | qualifier_contains_potential_exception_note } Fields to emit with --issues-tests - --issues-tests file - Write a list of issues in a format suitable for tests to file - --print-logs Activates: Also log messages to stdout and stderr (Conversely: --no-print-logs) diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 046c11b71..b10cb5207 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -655,16 +655,16 @@ OPTIONS particular path, with the format path:version (can be specified multiple times) See also infer-capture(1). - --issues-fields ,-separated sequence of { bug_type | bucket | + --issues-tests file + Write a list of issues in a format suitable for tests to file + See also infer-report(1). + + --issues-tests-fields ,-separated sequence of { bug_type | bucket | qualifier | severity | line | column | procedure | procedure_start_line | file | bug_trace | key | hash | line_offset | qualifier_contains_potential_exception_note } Fields to emit with --issues-tests See also infer-report(1). - --issues-tests file - Write a list of issues in a format suitable for tests to file - See also infer-report(1). - --java-jar-compiler path Specify the Java compiler jar used to generate the bytecode See also infer-capture(1). diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index 74079986d..ef6eb6aaf 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -444,7 +444,7 @@ let pp_json_report_by_report_kind formats_by_report_kind fname = match format_kind with | Tests -> let outf = get_outfile outfile_opt in - pp_custom_of_report outf.fmt report Config.issues_fields + pp_custom_of_report outf.fmt report Config.issues_tests_fields | Json -> L.die InternalError "Printing issues from json does not support json output" in @@ -578,9 +578,9 @@ let main ~report_json = costs_report_format_kind @ [(Issues, issue_formats); (Summary, [])] in init_files formats_by_report_kind ; - ( match Config.from_json_report with - | Some fname -> - pp_json_report_by_report_kind formats_by_report_kind fname + ( match Config.issues_tests with + | Some _ -> + pp_json_report_by_report_kind formats_by_report_kind Config.from_json_report | None -> pp_summary_and_issues formats_by_report_kind issue_formats ) ; if Config.test_determinator && Config.process_clang_ast then diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 496c6a28b..983751876 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -30,7 +30,7 @@ let ml_bucket_symbols = ; ("unknown_origin", `MLeak_unknown) ] -let issues_fields_symbols = +let issues_tests_fields_symbols = [ ("bug_type", `Issue_field_bug_type) ; ("bucket", `Issue_field_bucket) ; ("qualifier", `Issue_field_qualifier) @@ -1434,8 +1434,8 @@ and iphoneos_target_sdk_version_path_regex = format path:version (can be specified multiple times)" -and issues_fields = - CLOpt.mk_symbol_seq ~long:"issues-fields" +and issues_tests_fields = + CLOpt.mk_symbol_seq ~long:"issues-tests-fields" ~in_help:InferCommand.[(Report, manual_generic)] ~default: [ `Issue_field_file @@ -1445,7 +1445,7 @@ and issues_fields = ; `Issue_field_bucket ; `Issue_field_severity ; `Issue_field_bug_trace ] - ~symbols:issues_fields_symbols ~eq:PolyVariantEqual.( = ) + ~symbols:issues_tests_fields_symbols ~eq:PolyVariantEqual.( = ) "Fields to emit with $(b,--issues-tests)" @@ -2757,7 +2757,7 @@ and force_delete_results_dir = !force_delete_results_dir and force_integration = !force_integration -and from_json_report = !from_json_report +and from_json_report = Option.value !from_json_report ~default:(!results_dir ^/ report_json) and frontend_stats = !frontend_stats @@ -2783,10 +2783,10 @@ and iphoneos_target_sdk_version_path_regex = process_iphoneos_target_sdk_version_path_regex !iphoneos_target_sdk_version_path_regex -and issues_fields = !issues_fields - and issues_tests = !issues_tests +and issues_tests_fields = !issues_tests_fields + and iterations = !iterations and java_jar_compiler = !java_jar_compiler diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index d6e488ff1..7d88e8a0d 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -349,7 +349,7 @@ val force_delete_results_dir : bool val force_integration : build_system option -val from_json_report : string option +val from_json_report : string val frontend_stats : bool @@ -385,7 +385,9 @@ val iphoneos_target_sdk_version_path_regex : iphoneos_target_sdk_version_path_re val is_checker_enabled : Checker.t -> bool -val issues_fields : +val issues_tests : string option + +val issues_tests_fields : [ `Issue_field_bug_type | `Issue_field_qualifier | `Issue_field_severity @@ -402,8 +404,6 @@ val issues_fields : | `Issue_field_qualifier_contains_potential_exception_note ] list -val issues_tests : string option - val iterations : int val java_jar_compiler : string option diff --git a/infer/tests/build_systems/buck_flavors_diff/Makefile b/infer/tests/build_systems/buck_flavors_diff/Makefile index e003cb606..df894ef10 100644 --- a/infer/tests/build_systems/buck_flavors_diff/Makefile +++ b/infer/tests/build_systems/buck_flavors_diff/Makefile @@ -28,12 +28,10 @@ replace_reports: current.exp.test previous.exp.test current.exp.test: $(CURRENT_REPORT) $(QUIET)$(INFER_BIN) report -o $( $@ diff --git a/infer/tests/build_systems/differential_interesting_paths_filter/Makefile b/infer/tests/build_systems/differential_interesting_paths_filter/Makefile index a359bc97d..3e884a456 100644 --- a/infer/tests/build_systems/differential_interesting_paths_filter/Makefile +++ b/infer/tests/build_systems/differential_interesting_paths_filter/Makefile @@ -34,14 +34,12 @@ $(MODIFIED_FILES_FILE): current.exp.test: $(CURRENT_REPORT) $(QUIET)$(INFER_BIN) report -o $( $@ $(QUIET)cat infer-out-all/duplicates.txt infer-out-arc/duplicates.txt >> infer-out/duplicates.txt diff --git a/infer/tests/differential.make b/infer/tests/differential.make index dae1b2f02..5c4e90801 100644 --- a/infer/tests/differential.make +++ b/infer/tests/differential.make @@ -40,15 +40,15 @@ $(EXPECTED_TEST_OUTPUT): $(CURRENT_REPORT) $(PREVIOUS_REPORT) $(MODIFIED_FILES_F --costs-current $(CURRENT_COSTS) --costs-previous $(PREVIOUS_COSTS) \ $(DIFFERENTIAL_ARGS)) $(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \ - --issues-fields $(INFERPRINT_ISSUES_FIELDS) \ + --issues-tests-fields $(INFERPRINT_ISSUES_FIELDS) \ --from-json-report $(INFER_OUT)/differential/introduced.json \ --issues-tests introduced.exp.test $(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \ - --issues-fields $(INFERPRINT_ISSUES_FIELDS) \ + --issues-tests-fields $(INFERPRINT_ISSUES_FIELDS) \ --from-json-report $(INFER_OUT)/differential/fixed.json \ --issues-tests fixed.exp.test $(QUIET)$(INFER_BIN) report -o $(INFER_OUT) \ - --issues-fields $(INFERPRINT_ISSUES_FIELDS) \ + --issues-tests-fields $(INFERPRINT_ISSUES_FIELDS) \ --from-json-report $(INFER_OUT)/differential/preexisting.json \ --issues-tests preexisting.exp.test $(QUIET)$(COPY) $(INFER_OUT)/differential/costs_summary.json \ diff --git a/infer/tests/infer.make b/infer/tests/infer.make index de2d49674..afaf07a4c 100644 --- a/infer/tests/infer.make +++ b/infer/tests/infer.make @@ -11,7 +11,7 @@ default: compile issues.exp.test$(TEST_SUFFIX): $(INFER_OUT)/report.json $(INFER_BIN) $(QUIET)$(INFER_BIN) report -q --results-dir $(