diff --git a/infer/src/integration/JsonReports.ml b/infer/src/integration/JsonReports.ml index 26c6a18d0..a4ca0297b 100644 --- a/infer/src/integration/JsonReports.ml +++ b/infer/src/integration/JsonReports.ml @@ -259,7 +259,9 @@ module JsonCostsPrinter = MakeJsonListPrinter (struct ; hum= hum cost } in let cost_item = - let file = SourceFile.to_rel_path loc.Location.file in + let file = + SourceFile.to_string ~force_relative:Config.report_force_relative_path loc.Location.file + in { Jsonbug_t.hash= compute_hash ~severity:"" ~bug_type:"" ~proc_name ~file ~qualifier:"" ; loc= {file; lnum= loc.Location.line; cnum= loc.Location.col; enum= -1} ; procedure_name= Procname.get_method proc_name diff --git a/infer/tests/codetoanalyze/java/fb-performance/Makefile b/infer/tests/codetoanalyze/java/fb-performance/Makefile index 24eb094e6..9b306a151 100644 --- a/infer/tests/codetoanalyze/java/fb-performance/Makefile +++ b/infer/tests/codetoanalyze/java/fb-performance/Makefile @@ -8,6 +8,8 @@ TESTS_DIR = ../../.. INFER_OPTIONS = --cost-only --bufferoverrun --debug-exceptions --use-cost-threshold \ --report-force-relative-path INFERPRINT_OPTIONS = --issues-tests +INFERPRINT_COST_OPTIONS = --cost-issues-tests SOURCES = $(wildcard *.java) include $(TESTS_DIR)/javac.make +include $(TESTS_DIR)/cost.make diff --git a/infer/tests/codetoanalyze/java/fb-performance/cost-issues.exp b/infer/tests/codetoanalyze/java/fb-performance/cost-issues.exp new file mode 100644 index 000000000..145a61d53 --- /dev/null +++ b/infer/tests/codetoanalyze/java/fb-performance/cost-issues.exp @@ -0,0 +1,7 @@ +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.(), 3, OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.appendSegmentFormat(java.lang.StringBuilder,java.lang.String,int,java.lang.Object,boolean):int, 2, OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.call_appendSegmentFormat_linear(java.lang.StringBuilder,java.lang.String,int,java.lang.Object,boolean):void, 7 + (-startIdx + format.length), OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.call_doFormatArgs_linear(java.lang.StringBuilder,java.lang.String,int,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object):void, 9 + format.length, OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.call_doFormatArray_linear(java.lang.StringBuilder,java.lang.String,java.lang.Object[]):void, 5 + format.length, OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.doFormatArgs(java.lang.StringBuilder,java.lang.String,int,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object):int, 2, OnUIThread:false +../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.doFormatArray(java.lang.StringBuilder,java.lang.String,java.lang.Object[]):int, 2, OnUIThread:false diff --git a/infer/tests/codetoanalyze/java/performance-exclusive/Makefile b/infer/tests/codetoanalyze/java/performance-exclusive/Makefile index f2abd5648..56e0e2826 100644 --- a/infer/tests/codetoanalyze/java/performance-exclusive/Makefile +++ b/infer/tests/codetoanalyze/java/performance-exclusive/Makefile @@ -7,6 +7,8 @@ TESTS_DIR = ../../.. INFER_OPTIONS = --cost-only --no-inclusive-cost --bufferoverrun --debug-exceptions --use-cost-threshold INFERPRINT_OPTIONS = --issues-tests +INFERPRINT_COST_OPTIONS = --cost-issues-tests SOURCES = $(wildcard *.java) include $(TESTS_DIR)/javac.make +include $(TESTS_DIR)/cost.make diff --git a/infer/tests/codetoanalyze/java/performance-exclusive/cost-issues.exp b/infer/tests/codetoanalyze/java/performance-exclusive/cost-issues.exp new file mode 100644 index 000000000..13f7f0000 --- /dev/null +++ b/infer/tests/codetoanalyze/java/performance-exclusive/cost-issues.exp @@ -0,0 +1,4 @@ +codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.(), 2, OnUIThread:false +codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.call_linear_exclusive_constant(int):void, 3, OnUIThread:false +codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.call_linear_exclusive_linear(int):void, 5 + 7 ⋅ x, OnUIThread:false +codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.linear(int):void, 5 + 5 ⋅ x, OnUIThread:false diff --git a/infer/tests/cost.make b/infer/tests/cost.make index 01241b116..7f2ebc7a4 100644 --- a/infer/tests/cost.make +++ b/infer/tests/cost.make @@ -23,4 +23,4 @@ cost-replace: cost-issues.exp.test$(TEST_SUFFIX) clean: cost-clean cost-clean: - rm cost-issues.exp.test$(TEST_SUFFIX) + $(REMOVE) cost-issues.exp.test$(TEST_SUFFIX)