[cost] Add ability to test costs-report.json (part 2)

Summary: D21816312 forgot to add the new cost testing mechanism to `fb-performance` and `performance-exlusive` directories. This diff fixes that.

Reviewed By: skcho

Differential Revision: D21837912

fbshipit-source-id: 407dafcd3
master
Ezgi Çiçek 5 years ago committed by Facebook GitHub Bot
parent 89e34b4b5e
commit 9e44bc3687

@ -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

@ -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

@ -0,0 +1,7 @@
../../facebook/skel/infer/tests/codetoanalyze/java/fb-performance/StringFormatUtil.java, com.facebook.common.stringformat.StringFormatUtil.<init>(), 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

@ -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

@ -0,0 +1,4 @@
codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.<init>(), 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

@ -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)

Loading…
Cancel
Save