Add --continue option for reactive analysis to continue the capture.

Summary:public
The reactive analysis starts from the set of changed files/procedures, and proceeds
reactively to analyze their dependencies.
This means that after every command, the set of changed files/procedures is reset.
With the --continue option, the capture is continued: all the files/procedures marked
as changed stay changed, plus any additional changes are recorded.
In addition to allowing to spread capture over several commands, the option also allows to separate capture and analysis in reactive mode, or to repeat the analysis.

Reviewed By: sblackshear

Differential Revision: D3046361

fb-gh-sync-id: b6e3797
shipit-source-id: b6e3797
master
Cristiano Calcagno 9 years ago committed by Facebook Github Bot 6
parent 3d4942a748
commit 010b57e7cc

@ -126,6 +126,7 @@ def main():
if imported_module: if imported_module:
analyze.create_results_dir(args.infer_out) analyze.create_results_dir(args.infer_out)
if not args.continue_capture:
analyze.reset_start_file(args.infer_out) analyze.reset_start_file(args.infer_out)
utils.configure_logging(args) utils.configure_logging(args)

@ -65,9 +65,13 @@ base_group.add_argument('-i', '--incremental',
base_group.add_argument('-ic', '--changed-only', base_group.add_argument('-ic', '--changed-only',
dest='reactive', action='store_true', dest='reactive', action='store_true',
help='''DEPRECATED: use --reactive.''') help='''DEPRECATED: use --reactive.''')
base_group.add_argument('--reactive', action='store_true', base_group.add_argument('-r', '--reactive', action='store_true',
help='''Analyze in reactive propagation mode help='''Analyze in reactive propagation mode
starting from changed files.''') starting from changed files.''')
base_group.add_argument('-c', '--continue', action='store_true',
dest='continue_capture',
help='''Continue the capture for the reactive
analysis, increasing the changed files/procedures.''')
base_group.add_argument('--debug-exceptions', action='store_true', base_group.add_argument('--debug-exceptions', action='store_true',
help='''Generate lightweight debugging information: help='''Generate lightweight debugging information:
just print the internal exceptions during analysis''') just print the internal exceptions during analysis''')
@ -108,7 +112,7 @@ infer_group.add_argument('-j', '--multicore', metavar='n', type=int,
infer_group.add_argument('-x', '--project', metavar='<projectname>', infer_group.add_argument('-x', '--project', metavar='<projectname>',
help='Project name, for recording purposes only') help='Project name, for recording purposes only')
infer_group.add_argument('-r', '--revision', metavar='<githash>', infer_group.add_argument('--revision', metavar='<githash>',
help='The githash, for recording purposes only') help='The githash, for recording purposes only')
infer_group.add_argument('--buck', action='store_true', dest='buck', infer_group.add_argument('--buck', action='store_true', dest='buck',
@ -309,6 +313,9 @@ class AnalyzerWrapper(object):
if self.args.reactive: if self.args.reactive:
infer_options.append('-reactive') infer_options.append('-reactive')
if self.args.continue_capture:
infer_options.append('-continue')
if self.args.specs_dirs: if self.args.specs_dirs:
infer_options += self.args.specs_dirs infer_options += self.args.specs_dirs

@ -133,7 +133,10 @@ module Node = struct
let mark_pdesc_if_unchanged pname new_pdesc = let mark_pdesc_if_unchanged pname new_pdesc =
try try
let old_pdesc = Procname.Hash.find old_procs pname in let old_pdesc = Procname.Hash.find old_procs pname in
let changed = not (pdescs_eq old_pdesc new_pdesc) in let changed =
(* in continue_capture mode keep the old changed bit *)
(!Config.continue_capture && old_pdesc.pd_attributes.ProcAttributes.changed) ||
not (pdescs_eq old_pdesc new_pdesc) in
new_pdesc.pd_attributes.changed <- changed new_pdesc.pd_attributes.changed <- changed
with Not_found -> () in with Not_found -> () in
Procname.Hash.iter mark_pdesc_if_unchanged new_procs Procname.Hash.iter mark_pdesc_if_unchanged new_procs

@ -195,6 +195,10 @@ let checkers_enabled () = not !eradicate
the analysis starts from the files captured since the "infer" command started *) the analysis starts from the files captured since the "infer" command started *)
let reactive_mode = ref false let reactive_mode = ref false
(** Continue the capture for reactive mode:
If a procedure was changed beforehand, keep the changed marking. *)
let continue_capture = ref false
(** Flag for footprint discovery mode *) (** Flag for footprint discovery mode *)
let footprint = ref true let footprint = ref true

@ -82,6 +82,12 @@ let arg_desc =
None, None,
"analyze in reactive propagation mode starting from changed files" "analyze in reactive propagation mode starting from changed files"
; ;
"-continue",
Arg.Set Config.continue_capture,
None,
"continue the capture for the reactive analysis,\
increasing the changed files/procedures."
;
(* TODO: merge with the -project_root option *) (* TODO: merge with the -project_root option *)
"-java", "-java",
Arg.Unit (fun () -> Config.curr_language := Config.Java), Arg.Unit (fun () -> Config.curr_language := Config.Java),

Loading…
Cancel
Save