[diff] delete infer-diff

Summary:
It's not being worked on and is not in a state where it works.

It would probably better to write this as a script of some kind or else
resurrect this subcommand in a form where it behaves more like a script,
ie fork/execs infer analyses instead of having them be function calls
(but then it might as well *be* a script as it would likely be more
flexible).

In any case...

youarealreadydead

Reviewed By: ezgicicek

Differential Revision: D16602417

fbshipit-source-id: d0d129539
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 13d54990bd
commit fe701a17cc

@ -34,8 +34,6 @@ BUILD_SYSTEMS_TESTS += \
clang_with_MD_flag \
deduplicate_template_warnings \
delete_results_dir \
diff \
diff_gen_build_script \
duplicate_symbols \
fail_on_issue \
j1 \

@ -192,7 +192,7 @@ OPTIONS
--changed-files-index file
Specify the file containing the list of source files from which
reactive analysis should start. Source files should be specified
relative to project root or be absolute See also infer-analyze(1) and infer-diff(1).
relative to project root or be absolute See also infer-analyze(1).
--clang-biniou-file file
Specify a file containing the AST of the program, in biniou format
@ -247,11 +247,6 @@ OPTIONS
Costs report of the base revision to use for comparison
See also infer-reportdiff(1).
--current-to-previous-script shell
Specify a script to checkout a previous version of the project to
compare against, assuming we are on the current version already.
See also infer-diff(1).
--custom-symbols json
Specify named lists of symbols available to rules See also infer-analyze(1).
@ -269,8 +264,8 @@ OPTIONS
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)
See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level level
Debug level (sets --bo-debug level, --debug-level-analysis level,
@ -279,26 +274,26 @@ OPTIONS
- 1: verbose debugging enabled
- 2: very verbose debugging enabled
See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-analysis int
Debug level for the analysis. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-capture int
Debug level for the capture. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-linters int
Debug level for the linters. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--no-default-checkers
Deactivates: Default checkers: --biabduction,
@ -541,8 +536,7 @@ OPTIONS
--force-delete-results-dir
Activates: Do not refuse to delete the results directory if it
doesn't look like an infer results directory. (Conversely:
--no-force-delete-results-dir) See also infer-capture(1), infer-compile(1), infer-diff(1), and
infer-run(1).
--no-force-delete-results-dir) See also infer-capture(1), infer-compile(1), and infer-run(1).
--force-integration command
Proceed as if the first argument after -- was command. Possible
@ -570,11 +564,6 @@ OPTIONS
for frontend tests (also sets --print-types) (Conversely:
--no-frontend-tests) See also infer-capture(1).
--gen-previous-build-command-script shell
Specify a script that outputs the build command to capture in the
previous version of the project. The script should output the
command on stdout. For example "echo make". See also infer-diff(1).
--generated-classes path
Specify where to load the generated class files See also infer-capture(1).
@ -584,20 +573,20 @@ OPTIONS
--help
Show this manual See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--help-format { auto | groff | pager | plain }
Show this help in the specified format. auto sets the format to
plain if the environment variable TERM is "dumb" or undefined, and
to pager otherwise. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--help-full
Show this manual with all internal options in the INTERNAL OPTIONS
section See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--no-hoisting-report-only-expensive
@ -790,13 +779,6 @@ OPTIONS
Activates: Output issues in (PMD) XML format (Conversely:
--no-pmd-xml) See also infer-run(1).
--previous-to-current-script shell
Specify a script to checkout the current version of the project.
The project is supposed to already be at that current version when
running infer diff; the script is used after having analyzed the
current and previous versions of the project, to restore the
project to the current version. See also infer-diff(1).
--print-active-checkers
Activates: Print the active checkers before starting the analysis
(Conversely: --no-print-active-checkers) See also infer-analyze(1).
@ -1261,9 +1243,6 @@ INTERNAL OPTIONS
--coverage
analysis mode to maximize coverage (can take longer)
--current-to-previous-script-reset
Cancel the effect of --current-to-previous-script.
--debug-exceptions
Activates: Generate lightweight debugging information: just print
the internal exceptions during analysis (also sets
@ -1370,9 +1349,6 @@ INTERNAL OPTIONS
Activates: Do function pointer preprocessing (clang only).
(Conversely: --no-function-pointer-specialization)
--gen-previous-build-command-script-reset
Cancel the effect of --gen-previous-build-command-script.
--generated-classes-reset
Cancel the effect of --generated-classes.
@ -1541,9 +1517,6 @@ INTERNAL OPTIONS
Activates: Print stats about preconditions to standard output
(Conversely: --no-precondition-stats)
--previous-to-current-script-reset
Cancel the effect of --previous-to-current-script.
--print-buckets
Activates: Show the internal bucket of Infer reports in their
textual description (Conversely: --no-print-buckets)
@ -1879,9 +1852,8 @@ FILES
SEE ALSO
infer-analyze(1), infer-capture(1), infer-compile(1), infer-diff(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), infer-run(1)
infer-analyze(1), infer-capture(1), infer-compile(1), infer-events(1),
infer-explore(1), infer-report(1), infer-reportdiff(1), infer-run(1)

@ -192,7 +192,7 @@ OPTIONS
--changed-files-index file
Specify the file containing the list of source files from which
reactive analysis should start. Source files should be specified
relative to project root or be absolute See also infer-analyze(1) and infer-diff(1).
relative to project root or be absolute See also infer-analyze(1).
--clang-biniou-file file
Specify a file containing the AST of the program, in biniou format
@ -247,11 +247,6 @@ OPTIONS
Costs report of the base revision to use for comparison
See also infer-reportdiff(1).
--current-to-previous-script shell
Specify a script to checkout a previous version of the project to
compare against, assuming we are on the current version already.
See also infer-diff(1).
--custom-symbols json
Specify named lists of symbols available to rules See also infer-analyze(1).
@ -269,8 +264,8 @@ OPTIONS
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)
See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level level
Debug level (sets --bo-debug level, --debug-level-analysis level,
@ -279,26 +274,26 @@ OPTIONS
- 1: verbose debugging enabled
- 2: very verbose debugging enabled
See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-analysis int
Debug level for the analysis. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-capture int
Debug level for the capture. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--debug-level-linters int
Debug level for the linters. See --debug-level for accepted
values. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1).
--no-default-checkers
Deactivates: Default checkers: --biabduction,
@ -541,8 +536,7 @@ OPTIONS
--force-delete-results-dir
Activates: Do not refuse to delete the results directory if it
doesn't look like an infer results directory. (Conversely:
--no-force-delete-results-dir) See also infer-capture(1), infer-compile(1), infer-diff(1), and
infer-run(1).
--no-force-delete-results-dir) See also infer-capture(1), infer-compile(1), and infer-run(1).
--force-integration command
Proceed as if the first argument after -- was command. Possible
@ -570,11 +564,6 @@ OPTIONS
for frontend tests (also sets --print-types) (Conversely:
--no-frontend-tests) See also infer-capture(1).
--gen-previous-build-command-script shell
Specify a script that outputs the build command to capture in the
previous version of the project. The script should output the
command on stdout. For example "echo make". See also infer-diff(1).
--generated-classes path
Specify where to load the generated class files See also infer-capture(1).
@ -584,20 +573,20 @@ OPTIONS
--help
Show this manual See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--help-format { auto | groff | pager | plain }
Show this help in the specified format. auto sets the format to
plain if the environment variable TERM is "dumb" or undefined, and
to pager otherwise. See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--help-full
Show this manual with all internal options in the INTERNAL OPTIONS
section See also infer-analyze(1), infer-capture(1), infer-compile(1),
infer-diff(1), infer-events(1), infer-explore(1), infer-report(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), and infer-run(1).
--no-hoisting-report-only-expensive
@ -790,13 +779,6 @@ OPTIONS
Activates: Output issues in (PMD) XML format (Conversely:
--no-pmd-xml) See also infer-run(1).
--previous-to-current-script shell
Specify a script to checkout the current version of the project.
The project is supposed to already be at that current version when
running infer diff; the script is used after having analyzed the
current and previous versions of the project, to restore the
project to the current version. See also infer-diff(1).
--print-active-checkers
Activates: Print the active checkers before starting the analysis
(Conversely: --no-print-active-checkers) See also infer-analyze(1).
@ -1149,9 +1131,8 @@ FILES
SEE ALSO
infer-analyze(1), infer-capture(1), infer-compile(1), infer-diff(1),
infer-events(1), infer-explore(1), infer-report(1),
infer-reportdiff(1), infer-run(1)
infer-analyze(1), infer-capture(1), infer-compile(1), infer-events(1),
infer-explore(1), infer-report(1), infer-reportdiff(1), infer-run(1)

@ -7,7 +7,7 @@
open Core
(* NOTE: All variants must be also added to `all_commands` below *)
type t = Analyze | Capture | Compile | Diff | Events | Explore | Report | ReportDiff | Run
type t = Analyze | Capture | Compile | Events | Explore | Report | ReportDiff | Run
[@@deriving compare]
let equal = [%compare.equal: t]
@ -16,7 +16,6 @@ let command_to_string =
[ (Analyze, "analyze")
; (Capture, "capture")
; (Compile, "compile")
; (Diff, "diff")
; (Events, "events")
; (Explore, "explore")
; (Report, "report")

@ -14,7 +14,6 @@ type t =
| Compile
(** set up the infer environment then run the compilation commands without capturing the
source files *)
| Diff (** orchestrate a diff analysis *)
| Events (** dump logged events into stdout *)
| Explore (** explore infer reports *)
| Report (** post-process infer results and reports *)

@ -113,14 +113,6 @@ let compile =
~see_also:InferCommand.[Capture]
let diff =
mk_command_doc ~title:"Infer Differential Analysis of a Project"
~short_description:"Report the difference between two versions of a project"
~synopsis:"$(b,infer) $(b,diff) $(i,[options])"
~description:[`P "EXPERIMENTAL AND IN NO WAY READY TO USE"]
~see_also:InferCommand.[ReportDiff; Run]
let explore =
mk_command_doc ~title:"Infer Explore"
~short_description:"explore the error traces in infer reports"
@ -318,7 +310,6 @@ let command_to_data =
[ mk Analyze analyze
; mk Capture capture
; mk Compile compile
; mk Diff diff
; mk Events events
; mk Explore explore
; mk Report report

@ -563,7 +563,7 @@ let () =
match cmd with
| Report ->
`Add
| Analyze | Capture | Compile | Diff | Events | Explore | ReportDiff | Run ->
| Analyze | Capture | Compile | Events | Explore | ReportDiff | Run ->
`Reject
in
(* make sure we generate doc for all the commands we know about *)
@ -949,7 +949,7 @@ and censor_report =
and changed_files_index =
CLOpt.mk_path_opt ~long:"changed-files-index"
~in_help:InferCommand.[(Analyze, manual_generic); (Diff, manual_generic)]
~in_help:InferCommand.[(Analyze, manual_generic)]
~meta:"file"
"Specify the file containing the list of source files from which reactive analysis should \
start. Source files should be specified relative to project root or be absolute"
@ -1072,14 +1072,6 @@ and costs_previous =
"Costs report of the base revision to use for comparison"
and current_to_previous_script =
CLOpt.mk_string_opt ~long:"current-to-previous-script"
~in_help:InferCommand.[(Diff, manual_generic)]
~meta:"shell"
"Specify a script to checkout a previous version of the project to compare against, assuming \
we are on the current version already."
and siof_check_iostreams =
CLOpt.mk_bool ~long:"siof-check-iostreams"
~in_help:InferCommand.[(Analyze, manual_siof)]
@ -1423,11 +1415,7 @@ and flavors =
and force_delete_results_dir =
CLOpt.mk_bool ~long:"force-delete-results-dir" ~default:false
~in_help:
InferCommand.
[ (Capture, manual_generic)
; (Compile, manual_generic)
; (Diff, manual_generic)
; (Run, manual_generic) ]
InferCommand.[(Capture, manual_generic); (Compile, manual_generic); (Run, manual_generic)]
"Do not refuse to delete the results directory if it doesn't look like an infer results \
directory."
@ -1460,14 +1448,6 @@ and function_pointer_specialization =
"Do function pointer preprocessing (clang only)."
and gen_previous_build_command_script =
CLOpt.mk_string_opt ~long:"gen-previous-build-command-script"
~in_help:InferCommand.[(Diff, manual_generic)]
~meta:"shell"
"Specify a script that outputs the build command to capture in the previous version of the \
project. The script should output the command on stdout. For example \"echo make\"."
and generated_classes =
CLOpt.mk_path_opt ~long:"generated-classes"
~in_help:InferCommand.[(Capture, manual_java)]
@ -1826,16 +1806,6 @@ and precondition_stats =
"Print stats about preconditions to standard output"
and previous_to_current_script =
CLOpt.mk_string_opt ~long:"previous-to-current-script"
~in_help:InferCommand.[(Diff, manual_generic)]
~meta:"shell"
"Specify a script to checkout the current version of the project. The project is supposed to \
already be at that current version when running $(b,infer diff); the script is used after \
having analyzed the current and previous versions of the project, to restore the project to \
the current version."
and print_active_checkers =
CLOpt.mk_bool ~long:"print-active-checkers"
~in_help:InferCommand.[(Analyze, manual_generic)]
@ -2802,8 +2772,6 @@ and costs_current = !costs_current
and costs_previous = !costs_previous
and current_to_previous_script = !current_to_previous_script
and cxx = !cxx
and cxx_scope_guards = !cxx_scope_guards
@ -2878,8 +2846,6 @@ and function_pointer_specialization = !function_pointer_specialization
and frontend_tests = !frontend_tests
and gen_previous_build_command_script = !gen_previous_build_command_script
and generated_classes = !generated_classes
and genrule_master_mode = !genrule_master_mode
@ -3015,8 +2981,6 @@ and pmd_xml = !pmd_xml
and precondition_stats = !precondition_stats
and previous_to_current_script = !previous_to_current_script
and printf_args = !printf_args
and print_active_checkers = !print_active_checkers
@ -3089,7 +3053,7 @@ and racerd = !racerd
and racerd_guardedby = !racerd_guardedby
and reactive_mode = !reactive || InferCommand.(equal Diff) command
and reactive_mode = !reactive
and reactive_capture = !reactive_capture

@ -306,8 +306,6 @@ val costs_current : string option
val costs_previous : string option
val current_to_previous_script : string option
val cxx : bool
val cxx_scope_guards : Yojson.Basic.t
@ -382,8 +380,6 @@ val frontend_tests : bool
val function_pointer_specialization : bool
val gen_previous_build_command_script : string option
val generated_classes : string option
val genrule_master_mode : bool
@ -522,8 +518,6 @@ val pmd_xml : bool
val precondition_stats : bool
val previous_to_current_script : string option
val print_active_checkers : bool
val print_builtins : bool

@ -74,8 +74,6 @@ let with_server ~f =
f s
let flush_all () = with_server ~f:(fun s -> send_line s "flush_all")
let disconnect () =
with_server ~f:(fun s ->
server := None ;

@ -17,9 +17,6 @@ val disconnect : unit -> unit
val start : unit -> unit
(** start a memcached daemon and set up an epilogue to kill it on exit -- only for top-level *)
val flush_all : unit -> unit
(** empty the cache *)
(** type to marshal, plus a unique label that will be colon-prepended to a key,
roughly signifying a table *)
module type Value = sig

@ -154,14 +154,6 @@ end
include UnsafeDatabaseRef
let reset_capture_tables () =
let db = get_database () in
SqliteUtils.exec db ~log:"drop procedures table" ~stmt:"DROP TABLE procedures" ;
create_procedures_table db ;
SqliteUtils.exec db ~log:"drop source_files table" ~stmt:"DROP TABLE source_files" ;
create_source_files_table db
let db_canonicalize () =
let db = get_database () in
SqliteUtils.exec db ~log:"running VACUUM" ~stmt:"VACUUM"

@ -19,9 +19,6 @@ val schema_hum : string
val get_database : unit -> Sqlite3.db
(** The results database. You should always use this function to access the database, as the connection to it may change during the execution (see [new_database_connection]). *)
val reset_capture_tables : unit -> unit
(** zero out the tables associated with capture data *)
val new_database_connection : unit -> unit
(** Closes the previous connection to the database (if any), and opens a new one. Needed after calls to fork(2). *)

@ -81,13 +81,3 @@ let assert_results_dir advice =
L.die UserError "%s@\nPlease remove '%s' and try again" error Config.results_dir ) ;
prepare_logging_and_db () ;
()
let delete_capture_and_analysis_data () =
ResultsDatabase.reset_capture_tables () ;
let dirs_to_delete =
List.map ~f:(Filename.concat Config.results_dir) Config.[captured_dir_name; specs_dir_name]
in
List.iter ~f:Utils.rmtree dirs_to_delete ;
List.iter ~f:Unix.mkdir_p dirs_to_delete ;
()

@ -15,6 +15,3 @@ val remove_results_dir : unit -> unit
val create_results_dir : unit -> unit
(** Create the results dir and sets up logging, the database, etc. *)
val delete_capture_and_analysis_data : unit -> unit
(** delete all results from the capture and the analysis *)

@ -30,8 +30,6 @@ let setup () =
ResultsDir.assert_results_dir "have you run capture before?"
| Report | ReportDiff ->
ResultsDir.create_results_dir ()
| Diff ->
ResultsDir.remove_results_dir () ; ResultsDir.create_results_dir ()
| Capture | Compile | Run ->
let driver_mode = Lazy.force Driver.mode_from_command_line in
if
@ -151,8 +149,6 @@ let () =
ReportDiff.reportdiff ~current_report:Config.report_current
~previous_report:Config.report_previous ~current_costs:Config.costs_current
~previous_costs:Config.costs_previous
| Diff ->
Diff.diff (Lazy.force Driver.mode_from_command_line)
| Explore -> (
match (Config.procedures, Config.source_files) with
| true, false ->

@ -1,93 +0,0 @@
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
module F = Format
module L = Logging
type revision = Current | Previous
let string_of_revision = function Current -> "current" | Previous -> "previous"
let pp_revision f r = F.pp_print_string f (string_of_revision r)
let checkout revision =
let script_opt =
match revision with
| Current ->
Config.previous_to_current_script
| Previous ->
Config.current_to_previous_script
in
match script_opt with
| None ->
L.(die UserError)
"Please specify a script to checkout the %a revision of your project using --checkout-%a \
<script>."
pp_revision revision pp_revision revision
| Some script ->
L.progress "Checking out %a version:@\n %s@\n" pp_revision revision script ;
let (), exit_or_signal = Utils.with_process_in script Utils.consume_in in
Result.iter_error exit_or_signal ~f:(fun _ ->
L.(die ExternalError)
"Failed to checkout %a revision: %s" pp_revision revision
(Unix.Exit_or_signal.to_string_hum exit_or_signal) )
let save_report revision =
let report_name = Config.results_dir ^/ F.asprintf "report-%a.json" pp_revision revision in
Unix.rename ~src:Config.(results_dir ^/ report_json) ~dst:report_name ;
let costs_report_name =
Config.results_dir ^/ F.asprintf "costs-report-%a.json" pp_revision revision
in
Unix.rename ~src:Config.(results_dir ^/ costs_report_json) ~dst:costs_report_name ;
L.progress "Results for the %a revision stored in %s@\n" pp_revision revision report_name ;
L.progress "Costs data for the %a revision stored in %s@\n" pp_revision revision
costs_report_name ;
(report_name, costs_report_name)
let gen_previous_driver_mode script =
let output, exit_or_signal = Utils.with_process_in script In_channel.input_lines in
match exit_or_signal with
| Error _ as status ->
L.(die UserError)
"*** command failed:@\n*** %s@\n*** %s@." script
(Unix.Exit_or_signal.to_string_hum status)
| Ok () ->
(* FIXME(t15553258): this won't work if the build command has arguments that contain spaces. In that case the user should be able to use an argfile for the build command instead, so not critical to fix. *)
let command = List.concat_map ~f:(String.split ~on:' ') output in
L.environment_info "Build command for the previous project version: '%s'@\n%!"
(String.concat ~sep:" " command) ;
Driver.mode_of_build_command command
let diff driver_mode =
Driver.run_prologue driver_mode ;
let changed_files = Driver.read_config_changed_files () in
Driver.capture driver_mode ~changed_files ;
Driver.analyze_and_report ~suppress_console_report:true driver_mode ~changed_files ;
let current_report, current_costs = save_report Current in
(* Some files in the current checkout may be deleted in the old checkout. If we kept the results of the previous capture and analysis around, we would report issues on these files again in the previous checkout, which is wrong. Do not do anything too smart for now and just delete all results from the analysis of the current checkout. *)
ResultsDir.delete_capture_and_analysis_data () ;
if Config.memcached then ( Memcached.(connect () ; flush_all () ; disconnect ()) ) ;
(* TODO(t15553258) bail if nothing to analyze (configurable, some people might care about bugs
fixed more than about time to analyze) *)
checkout Previous ;
let previous_driver_mode =
Option.value_map ~default:driver_mode ~f:gen_previous_driver_mode
Config.gen_previous_build_command_script
in
Driver.capture previous_driver_mode ~changed_files ;
Driver.analyze_and_report ~suppress_console_report:true previous_driver_mode ~changed_files ;
checkout Current ;
let previous_report, previous_costs = save_report Previous in
(* compute differential *)
ReportDiff.reportdiff ~current_report:(Some current_report)
~previous_report:(Some previous_report) ~current_costs:(Some current_costs)
~previous_costs:(Some previous_costs) ;
Driver.run_epilogue () ;
()

@ -1,11 +0,0 @@
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
val diff : Driver.mode -> unit
(** orchestrates the analysis of a code change *)

@ -407,7 +407,7 @@ let analyze_and_report ?suppress_console_report ~changed_files mode =
(false, false)
| (Capture | Compile | Events | Explore | Report | ReportDiff), _ ->
(false, false)
| (Analyze | Diff | Run), _ ->
| (Analyze | Run), _ ->
(true, true)
in
let should_merge =

@ -29,9 +29,6 @@ val equal_mode : mode -> mode -> bool
val mode_from_command_line : mode Lazy.t
(** driver mode computed from the command-line arguments and settings in Config *)
val mode_of_build_command : string list -> mode
(** driver mode computed from the build command alone, eg [["buck"; "build"; ...]] gives [PythonCapture (BBuck, ["buck"; "build"; ...])] *)
val run_prologue : mode -> unit
(** prepare the environment for running the given mode *)

@ -1,26 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
TESTS_DIR = ../..
INFER_OUT = infer-out
include $(TESTS_DIR)/diff.make
CLEAN_EXTRA = src
SRC_DIR = $(CURDIR)/../codetoanalyze
INFER_OPTIONS = \
--previous-to-current-script '$(COPY) $(SRC_DIR)/some_bugs.c src/hello.c' \
--current-to-previous-script '$(COPY) $(SRC_DIR)/some_different_bugs.c src/hello.c' \
--changed-files-index changed_files.txt \
-- clang -c src/hello.c
SOURCES = $(SRC_DIR)/some_bugs.c $(SRC_DIR)/some_different_bugs.c
$(INFER_OUT)/differential/introduced.json: $(SOURCES) $(CLANG_DEPS) changed_files.txt \
$(MAKEFILE_LIST)
$(QUIET)$(MKDIR_P) src
$(QUIET)$(COPY) $(SRC_DIR)/some_bugs.c src/hello.c
$(QUIET)$(call silent_on_success,Running diff analysis in $(TEST_REL_DIR),\
$(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) diff $(INFER_OPTIONS))

@ -1 +0,0 @@
src/hello.c, test3, 3, MEMORY_LEAK, no_bucket, ERROR, [start of procedure test3(),Taking true branch]

@ -1 +0,0 @@
src/hello.c, test2, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test2(),start of procedure nullify()]

@ -1 +0,0 @@
src/hello.c, test1, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test1()]

@ -1,28 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
TESTS_DIR = ../..
INFER_OUT = infer-out
include $(TESTS_DIR)/diff.make
CLEAN_EXTRA = src
SRC_DIR = $(CURDIR)/../codetoanalyze
INFER_OPTIONS = \
--previous-to-current-script 'true' \
--current-to-previous-script '$(COPY) $(SRC_DIR)/some_bugs.c src/' \
--gen-previous-build-command-script 'echo "clang -c src/some_bugs.c"' \
--changed-files-index changed_files.txt \
--file-renamings file_renamings.json \
-- clang -c src/some_different_bugs.c
SOURCES = $(SRC_DIR)/some_bugs.c $(SRC_DIR)/some_different_bugs.c
$(INFER_OUT)/differential/introduced.json: $(SOURCES) $(CLANG_DEPS) changed_files.txt \
file_renamings.json $(MAKEFILE_LIST)
$(QUIET)$(MKDIR_P) src
$(QUIET)$(COPY) $(SRC_DIR)/some_different_bugs.c src/
$(QUIET)$(call silent_on_success,Running diff analysis in $(TEST_REL_DIR),\
$(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) diff $(INFER_OPTIONS))

@ -1,2 +0,0 @@
src/some_bugs.c
src/some_different_bugs.c

@ -1,6 +0,0 @@
[
{
"previous": "src/some_bugs.c",
"current": "src/some_different_bugs.c"
}
]

@ -1 +0,0 @@
src/some_bugs.c, test2, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test2(),start of procedure nullify()]

@ -1 +0,0 @@
src/some_different_bugs.c, test3, 3, MEMORY_LEAK, no_bucket, ERROR, [start of procedure test3(),Taking true branch]

@ -1 +0,0 @@
src/some_different_bugs.c, test1, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test1()]
Loading…
Cancel
Save