[infer][Java] more consistent names for env variables

master
jrm 10 years ago
parent d0ea01e354
commit 5e9f88eaeb

@ -5,7 +5,7 @@ LIBDIR = $(CWD)/../../lib
LIB_SPECS = $(LIBDIR)/specs
C_MODELS_FILE = $(LIB_SPECS)/c_models
INFER = ANALYZE_MODELS=1 $(BINDIR)/infer
INFER = INFER_ANALYZE_MODELS=1 $(BINDIR)/infer
default: run_infer

@ -5,7 +5,7 @@ LIBDIR = $(CWD)/../../lib
LIB_SPECS = $(LIBDIR)/specs
CPP_MODELS_FILE = $(LIB_SPECS)/cpp_models
INFER = ANALYZE_MODELS=1 $(BINDIR)/infer
INFER = INFER_ANALYZE_MODELS=1 $(BINDIR)/infer
default: run_infer

@ -2,7 +2,7 @@ SHELL := /bin/bash
CWD = $(shell pwd)
BINDIR = $(CWD)/../../bin
INFERJ = ANALYZE_MODELS=1 $(BINDIR)/inferJ --buck --analyzer infer --multicore 1
INFERJ = INFER_ANALYZE_MODELS=1 $(BINDIR)/inferJ --buck --analyzer infer --multicore 1
ANDROID_JAR = ../../lib/java/android/android-19.jar
JACKSON_JAR = ../../../dependencies/java/jackson/jackson-2.2.3.jar

@ -5,7 +5,7 @@ LIBDIR = $(CWD)/../../lib
LIB_SPECS = $(LIBDIR)/specs
OBJC_MODELS_FILE = $(LIB_SPECS)/objc_models
INFER = ANALYZE_MODELS=1 $(BINDIR)/infer
INFER = INFER_ANALYZE_MODELS=1 $(BINDIR)/infer
default: run_infer

@ -344,9 +344,11 @@ let arc_mode = ref false
let objc_memory_model_on = ref false
let report_assertion_failure = from_env_variable "REPORT_ASSERTION_FAILURE"
let report_assertion_failure = from_env_variable "INFER_REPORT_ASSERTION_FAILURE"
let default_failure_name = "Assertion_failure"
let analyze_models = from_env_variable "INFER_ANALYZE_MODELS"
module Experiment = struct
(** if true, activate the subtyping routines in C++ as well, not just in Java *)

@ -423,8 +423,7 @@ let symops_timeout, seconds_timeout =
let default_seconds_timeout = 10 in
let long_symops_timeout = 1000 in
let long_seconds_timeout = 30 in
let analyzing_models = Config.from_env_variable "ANALYZE_MODELS" in
if analyzing_models then
if Config.analyze_models then
(* use longer timeouts when analyzing models *)
long_symops_timeout, long_seconds_timeout
else

@ -37,11 +37,10 @@ let print_usage_exit () =
exit(1)
let () =
let analysing_models = Config.from_env_variable "ANALYZE_MODELS" in
Arg2.parse arg_desc (fun arg -> ()) usage;
if analysing_models && !JClasspath.models_jar <> "" then
if Config.analyze_models && !JClasspath.models_jar <> "" then
failwith "Not expecting model file when analyzing the models";
if not analysing_models && !JClasspath.models_jar = "" then
if not Config.analyze_models && !JClasspath.models_jar = "" then
failwith "Java model file is required"

@ -34,12 +34,10 @@ Since Sawja often reports a method off by a few lines, we search
backwards for a line where the method name is. *)
let fix_method_definition_line linereader proc_name loc =
let method_name =
let raw = Procname.java_get_method proc_name in
if raw = "<init>"
then
if Procname.is_constructor proc_name then
let inner_class_name cname = snd (string_split_character cname '$') in
inner_class_name (Procname.java_get_simple_class proc_name)
else raw in
else Procname.java_get_method proc_name in
let regex = Str.regexp (Str.quote method_name) in
let method_is_defined_here linenum =
match Printer.LineReader.from_file_linenum_original linereader loc.Sil.file linenum with
@ -574,7 +572,8 @@ let rec expression context pc expr =
let callee_procdesc =
match get_method_procdesc program cfg tenv cn JBasics.clinit_signature Static with
| Called p | Defined p -> p in
let field_type = (JTransType.get_class_type program tenv (JBasics.make_cn JConfig.string_cl)) in
let field_type =
JTransType.get_class_type program tenv (JBasics.make_cn JConfig.string_cl) in
JTransStaticField.translate_instr_static_field context callee_procdesc fs field_type loc
else
if JTransType.is_autogenerated_assert_field field_name
@ -595,7 +594,8 @@ let method_invocation context loc pc var_opt cn ms sil_obj_opt expr_list invoke_
let cf_virtual = match invoke_code with
| I_Virtual -> true
| _ -> false in
let call_flags = { Sil.cf_virtual = cf_virtual; Sil.cf_noreturn = false; Sil.cf_is_objc_block = false; } in
let call_flags =
{ Sil.cf_virtual = cf_virtual; Sil.cf_noreturn = false; Sil.cf_is_objc_block = false; } in
let callee_procdesc =
match get_method_procdesc program cfg tenv cn ms is_static with
| Called p | Defined p -> p in
@ -631,7 +631,7 @@ let method_invocation context loc pc var_opt cn ms sil_obj_opt expr_list invoke_
if JBasics.cn_equal cn JConfig.infer_builtins_cl then
Procname.from_string (JBasics.ms_name ms)
else Cfg.Procdesc.get_proc_name callee_procdesc in
let (call_idl, call_instrs) =
let call_idl, call_instrs =
let callee_fun = Sil.Const (Sil.Cfun callee_procname) in
let return_type = Cfg.Procdesc.get_ret_type callee_procdesc in
let call_ret_instrs sil_var =
@ -925,10 +925,7 @@ let rec instruction context pc instr : translation =
| JBir.New (var, cn, constr_type_list, constr_arg_list) ->
let builtin_new = Sil.Const (Sil.Cfun SymExec.ModelBuiltins.__new) in
let class_type = JTransType.get_class_type program tenv cn in
let class_type_np =
try
JTransType.get_class_type_no_pointer program tenv cn
with _ -> assert false in
let class_type_np = JTransType.get_class_type_no_pointer program tenv cn in
let sizeof_exp = Sil.Sizeof (class_type_np, Sil.Subtype.exact) in
let args = [(sizeof_exp, class_type)] in
let ret_id = Ident.create_fresh Ident.knormal in
@ -940,9 +937,9 @@ let rec instruction context pc instr : translation =
context loc pc None cn constr_ms ret_opt constr_arg_list I_Special Static in
let pvar = JContext.set_pvar context var class_type in
let set_instr = Sil.Set (Sil.Lvar pvar, class_type, Sil.Var ret_id, loc) in
let node_kind = Cfg.Node.Stmt_node ("Call "^(Procname.to_string constr_procname)) in
let ids = ret_id :: call_ids in
let instrs = (new_instr :: call_instrs) @ [set_instr] in
let node_kind = Cfg.Node.Stmt_node ("Call "^(Procname.to_string constr_procname)) in
let node = create_node node_kind ids instrs in
let caller_procname = (Cfg.Procdesc.get_proc_name (JContext.get_procdesc context)) in
Cg.add_edge cg caller_procname constr_procname;

@ -13,10 +13,11 @@ val create_fieldname : JBasics.class_name -> JBasics.field_signature -> Ident.fi
(** returns a procedure name based on the class name and the method's signature. *)
val get_method_procname : JBasics.class_name -> JBasics.method_signature -> Procname.t
(** [get_class_type_no_pointer tenv cn] returns the sil type representation of the class without the pointer part *)
(** [get_class_type_no_pointer program tenv cn] returns the sil type representation of the class
without the pointer part *)
val get_class_type_no_pointer: JClasspath.program -> Sil.tenv -> JBasics.class_name -> Sil.typ
(** [get_class_type tenv cn] returns the sil type representation of the class *)
(** [get_class_type program tenv cn] returns the sil type representation of the class *)
val get_class_type : JClasspath.program -> Sil.tenv -> JBasics.class_name -> Sil.typ
(** return true if [field_name] is the autogenerated C.$assertionsDisabled field for class C *)

@ -4,7 +4,7 @@ sources += glob(['**/Makefile'])
out = 'out'
clean_cmd = ' '.join(['rm', '-rf', out])
env_cmd = ' '.join(['export', 'REPORT_ASSERTION_FAILURE=1'])
env_cmd = ' '.join(['export', 'INFER_REPORT_ASSERTION_FAILURE=1'])
infer_cmd = ' '.join([
'infer',
'--no-filtering',

@ -471,7 +471,7 @@ public class InferRunner {
ProcessBuilder pb = new ProcessBuilder(inferCmd);
Map<String, String> env = pb.environment();
env.put("REPORT_ASSERTION_FAILURE", "1");
env.put("INFER_REPORT_ASSERTION_FAILURE", "1");
Process process = pb.start();
StringBuilder stderr = new StringBuilder();

Loading…
Cancel
Save