[tests] Convert java tests to avoid phony targets

Summary:
This diff revises the makefiles for java tests so that they are based on
the files actually produced and depended on, instead of the existing
imperative style.  This is, I think, clearer and easier to modify, and
enables a little more parallelism.

Reviewed By: jvillard

Differential Revision: D4072560

fbshipit-source-id: c16d4bd
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent 5752b14d9c
commit 175e85525d

3
.gitignore vendored

@ -12,6 +12,8 @@
*.orig
*.rej
*.start
*.exp.test
infer/tests/codetoanalyze/java/*/codetoanalyze
# Directories generated by Ocamlbuild
_build
@ -56,6 +58,7 @@ org.eclipse.core.resources.prefs
infer-sources.tar.gz
infer-osx-*.tar.xz
infer-linux64-*.tar.xz
infer-out*
# Directories generated by buck
buck-out/

@ -170,9 +170,8 @@ inferTraceBugs_test: infer
.PHONY: check_missing_mli
check_missing_mli:
@bash -c '\
for x in `find infer/src -name "*.ml" -or -name "*.re"`; do \
test -f "$$x"i || echo Missing "$$x"i; done'
@for x in $$(find infer/src -name "*.ml" -or -name "*.re"); do \
test -f "$$x"i || echo Missing "$$x"i; done
.PHONY: toplevel
toplevel: infer
@ -193,6 +192,11 @@ test_xml: test_build ocaml_unit_test buck_test_xml inferTraceBugs_test
.PHONY: quick-test
quick-test: test_this_build ocaml_unit_test
.PHONY: test-replace
test-replace:
@for file in $$(find infer/tests -name "*.exp.test"); do \
mv -f $$file $$(dirname $$file)/$$(basename -s .exp.test $$file).exp; done
.PHONY: uninstall
uninstall:
$(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/

@ -257,7 +257,6 @@ inc_flags:=$(foreach dir,$(src_dirs),-I $(dir))
root_flags:=$(foreach root,$(roots),-r $(root))
cluster_flags:=$(foreach cluster,$(clusters),-c $(cluster))
.PHONY: mod_dep_dot
mod_dep.dot: $(ml_src_files) $(re_src_files)
$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot
{ ocamldep.opt $(inc_flags) -ml-synonym .re -mli-synonym .rei $(ml_src_files); \
@ -266,7 +265,6 @@ mod_dep.dot: $(ml_src_files) $(re_src_files)
| grep -v -e "\"IList\"\|\"Utils\"" \
> mod_dep.dot
.PHONY: mod_dep.pdf
mod_dep.pdf: mod_dep.dot
dot -Tpdf -o mod_dep.pdf mod_dep.dot

@ -7,7 +7,7 @@
include ../../Makefile.clang
OPTIONS = -x c++ -std=c++11 -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c
OPTIONS = -x c++ -std=c++11 -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c
ANALYZER = quandary
INFERPRINT_OPTIONS = --issues-txt
@ -20,5 +20,5 @@ compile:
clang $(OPTIONS) $(FILES)
analyze:
$(INFER_BIN) -a $(ANALYZER) --cxx --ml-buckets cpp --check-duplicate-symbols -- clang $(OPTIONS) $(FILES) >/dev/null 2>duplicates.txt
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) --cxx --ml-buckets cpp --check-duplicate-symbols -- clang $(OPTIONS) $(FILES) 2>duplicates.txt)
grep "DUPLICATE_SYMBOLS" duplicates.txt; test $$? -ne 0

@ -5,28 +5,11 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = checkers
FILES = \
Branch.java \
ExpensiveCallExample.java \
ExpensiveInheritanceExample.java \
ExpensiveInterfaceExample.java \
ExpensiveSubtypingExample.java \
FragmentDoesNotRetainViewExample.java \
FragmentRetainsViewExample.java \
ImmutableCast.java \
NoAllocationExample.java \
NotThreadSafeExample.java \
PrintfArgsChecker.java \
ThreadSafeExample.java \
TraceCallSequence.java \
TwoCheckersExample.java
INFER_OPTIONS = --thread-safety
compile:
javac -cp $(CLASSPATH) $(FILES)
analyze:
$(call silent_on_success,$(INFER_BIN) --thread-safety -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = $(wildcard *.java)

@ -17,19 +17,3 @@ JSR305 = $(DEPENDENCIES_DIR)/java/jsr-305/jsr305.jar
INJECT = $(DEPENDENCIES_DIR)/java/jsr-330/javax.inject.jar
CLASSPATH=$(ANDROID19):$(ANDROIDSUPPORT):$(ANNOTATIONS):$(BUTTERKNIFE):$(JACKSON):$(JSR305):$(INJECT):$(JAVA_BUILTINS_DIR):.
INFERPRINT_OPTIONS = --issues-tests
default: compile
print: analyze
$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) issues.exp.test
LC_ALL=C sort -t: -k1,1 -k2n,2 -o issues.exp.test issues.exp.test
test: analyze print
$(MAKE) clean
diff -u issues.exp issues.exp.test
rm issues.exp.test
clean:
rm -rf codetoanalyze infer-out *.class

@ -1 +0,0 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.bar():void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":24,"blame_range":[{"start_line":22,"end_line":24}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.foo():void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":29,"blame_range":[{"start_line":27,"end_line":30}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.bar():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":22,"blame_range":[{"start_line":22,"end_line":24}]},"callees":[]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.pre_bar():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":14,"blame_range":[{"start_line":14,"end_line":15}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":34,"blame_range":[{"start_line":33,"end_line":34}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.foo():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":27,"blame_range":[{"start_line":27,"end_line":30}]},"callees":[]}]}]}

@ -5,38 +5,47 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/config.make
ANALYZER = crashcontext
FILES = \
BranchingCallsExample \
MethodNameClashExample \
MinimalCrashExample \
MultiStackFrameCrashExample \
NativeMethodExample \
compile:
for file in $(FILES) ; do \
javac -cp $(CLASSPATH) $$file.java ; \
done
analyze:
for file in $(FILES) ; do \
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) --stacktrace $$file.stacktrace.json -- javac -cp $(CLASSPATH) $$file.java) ; \
cp infer-out/crashcontext/crashcontext.json $$file.exp.test ; \
done
# overwrite
print:
# overwrite
test: analyze
set -e; \
for file in $(FILES) ; do \
diff -u $$file.exp $$file.exp.test ; \
rm $$file.exp.test ; \
done
$(MAKE) clean
JAVA_SOURCE_FILES = $(wildcard *.java)
JAVA_CLASS_FILES = $(patsubst %.java,%.class,$(JAVA_SOURCE_FILES))
EXP_TESTs = $(sort $(patsubst %.java,%.exp.test,$(JAVA_SOURCE_FILES)))
INFER_OUTs = $(patsubst %.java,infer-out-%,$(JAVA_SOURCE_FILES))
$(JAVA_CLASS_FILES): $(JAVA_SOURCE_FILES)
javac -cp $(CLASSPATH) $(JAVA_SOURCE_FILES)
# analyze a single source file and generate the test results for it
%.exp.test: $(INFER_BIN) %.stacktrace.json %.java
$(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) -o infer-out-$* --stacktrace $*.stacktrace.json \
-- javac -cp $(CLASSPATH) $*.java)
# add a newline at the end of the json when creating the exp.test
bash -c 'cat infer-out-$*/crashcontext/crashcontext.json <(echo) > $*.exp.test'
# combine the test results for all the source files
issues.exp.test: $(EXP_TESTs)
cat $(EXP_TESTs) > issues.exp.test
default: compile
.PHONY: compile
compile: $(JAVA_CLASS_FILES)
.PHONY: analyze
analyze: $(EXP_TESTs)
.PHONY: print
print: issues.exp.test
.PHONY: test
test: issues.exp.test
diff -u issues.exp issues.exp.test
.PHONY: clean
clean:
$(REMOVE_DIR) $(INFER_OUTs) $(JAVA_CLASS_FILES) $(EXP_TESTs)

@ -1 +0,0 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$A.foo():void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":18,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$B.foo():void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":26,"blame_range":[{"start_line":26,"end_line":26}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$A.foo():void","location":{"location_type":"proc_start","file":"MethodNameClashExample.java","line":16,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":32,"blame_range":[{"start_line":31,"end_line":32}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$B.foo():void","location":{"location_type":"proc_start","file":"MethodNameClashExample.java","line":26,"blame_range":[{"start_line":26,"end_line":26}]},"callees":[]}]}]}

@ -1 +0,0 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MinimalCrashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MinimalCrashExample.java","line":16,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]}]}

@ -1 +0,0 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.bar():void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":16,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.foo():void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":20,"blame_range":[{"start_line":19,"end_line":20}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.bar():void","location":{"location_type":"proc_start","file":"MultiStackFrameCrashExample.java","line":14,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":24,"blame_range":[{"start_line":23,"end_line":24}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.foo():void","location":{"location_type":"proc_start","file":"MultiStackFrameCrashExample.java","line":19,"blame_range":[{"start_line":19,"end_line":20}]},"callees":[]}]}]}

@ -1 +0,0 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.NativeMethodExample.foo():void","location":{"location_type":"call_site","file":"NativeMethodExample.java","line":18,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"sun.reflect.NativeMethodAccessorImpl.invoke0","location":{"location_type":"call_site","file":"Native Method","blame_range":[]},"callees":[]},{"method_name":"sun.reflect.NativeMethodAccessorImpl.invoke","location":{"location_type":"call_site","file":"NativeMethodAccessorImpl.java","line":62,"blame_range":[]},"callees":[]},{"method_name":"sun.reflect.DelegatingMethodAccessorImpl.invoke","location":{"location_type":"call_site","file":"DelegatingMethodAccessorImpl.java","line":43,"blame_range":[]},"callees":[]},{"method_name":"java.lang.reflect.Method.invoke","location":{"location_type":"call_site","file":"Method.java","line":497,"blame_range":[]},"callees":[]},{"method_name":"codetoanalyze.java.crashcontext.NativeMethodExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"NativeMethodExample.java","line":27,"blame_range":[{"start_line":21,"end_line":29}]},"callees":[{"method_name":"java.lang.Class.getDeclaredMethod(java.lang.String,java.lang.Class[]):java.lang.reflect.Method","callees":[]},{"method_name":"java.lang.reflect.Method.invoke(java.lang.Object,java.lang.Object[]):java.lang.Object","callees":[]},{"method_name":"__new_array","callees":[]}]}]}

@ -0,0 +1,5 @@
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.bar():void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":24,"blame_range":[{"start_line":22,"end_line":24}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.foo():void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":29,"blame_range":[{"start_line":27,"end_line":30}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.bar():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":22,"blame_range":[{"start_line":22,"end_line":24}]},"callees":[]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.pre_bar():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":14,"blame_range":[{"start_line":14,"end_line":15}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"BranchingCallsExample.java","line":34,"blame_range":[{"start_line":33,"end_line":34}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.BranchingCallsExample.foo():void","location":{"location_type":"proc_start","file":"BranchingCallsExample.java","line":27,"blame_range":[{"start_line":27,"end_line":30}]},"callees":[]}]}]}
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$A.foo():void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":18,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$B.foo():void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":26,"blame_range":[{"start_line":26,"end_line":26}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$A.foo():void","location":{"location_type":"proc_start","file":"MethodNameClashExample.java","line":16,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MethodNameClashExample.java","line":32,"blame_range":[{"start_line":31,"end_line":32}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MethodNameClashExample$B.foo():void","location":{"location_type":"proc_start","file":"MethodNameClashExample.java","line":26,"blame_range":[{"start_line":26,"end_line":26}]},"callees":[]}]}]}
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MinimalCrashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MinimalCrashExample.java","line":16,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]}]}
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.bar():void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":16,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.foo():void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":20,"blame_range":[{"start_line":19,"end_line":20}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.bar():void","location":{"location_type":"proc_start","file":"MultiStackFrameCrashExample.java","line":14,"blame_range":[{"start_line":14,"end_line":16}]},"callees":[]}]},{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"MultiStackFrameCrashExample.java","line":24,"blame_range":[{"start_line":23,"end_line":24}]},"callees":[{"method_name":"codetoanalyze.java.crashcontext.MultiStackFrameCrashExample.foo():void","location":{"location_type":"proc_start","file":"MultiStackFrameCrashExample.java","line":19,"blame_range":[{"start_line":19,"end_line":20}]},"callees":[]}]}]}
{"stack":[{"method_name":"codetoanalyze.java.crashcontext.NativeMethodExample.foo():void","location":{"location_type":"call_site","file":"NativeMethodExample.java","line":18,"blame_range":[{"start_line":16,"end_line":18}]},"callees":[{"method_name":"java.lang.String.toString():java.lang.String","callees":[]}]},{"method_name":"sun.reflect.NativeMethodAccessorImpl.invoke0","location":{"location_type":"call_site","file":"Native Method","blame_range":[]},"callees":[]},{"method_name":"sun.reflect.NativeMethodAccessorImpl.invoke","location":{"location_type":"call_site","file":"NativeMethodAccessorImpl.java","line":62,"blame_range":[]},"callees":[]},{"method_name":"sun.reflect.DelegatingMethodAccessorImpl.invoke","location":{"location_type":"call_site","file":"DelegatingMethodAccessorImpl.java","line":43,"blame_range":[]},"callees":[]},{"method_name":"java.lang.reflect.Method.invoke","location":{"location_type":"call_site","file":"Method.java","line":497,"blame_range":[]},"callees":[]},{"method_name":"codetoanalyze.java.crashcontext.NativeMethodExample.main(java.lang.String[]):void","location":{"location_type":"call_site","file":"NativeMethodExample.java","line":27,"blame_range":[{"start_line":21,"end_line":29}]},"callees":[{"method_name":"java.lang.Class.getDeclaredMethod(java.lang.String,java.lang.Class[]):java.lang.reflect.Method","callees":[]},{"method_name":"java.lang.reflect.Method.invoke(java.lang.Object,java.lang.Object[]):java.lang.Object","callees":[]},{"method_name":"__new_array","callees":[]}]}]}

@ -5,27 +5,11 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = eradicate
FILES = \
ActivityFieldNotInitialized.java \
FieldNotInitialized.java \
FieldNotNullable.java \
InconsistentSubclassAnnotationInterface.java \
InconsistentSubclassAnnotation.java \
LibraryCalls.java \
NoReuseUndefFunctionValues.java \
NullFieldAccess.java \
NullMethodCall.java \
ParameterNotNullable.java \
ReturnNotNullable.java \
SuppressWarningsExample.java \
SuppressedFieldNotInitializedExample.java
INFER_OPTIONS = --eradicate-return-over-annotated
compile:
javac -cp $(CLASSPATH) $(FILES)
analyze:
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) --eradicate-return-over-annotated -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = $(wildcard *.java)

@ -5,15 +5,12 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = infer
FILES = \
BasicHarnessActivity.java \
compile:
javac -cp $(CLASSPATH) $(FILES)
INFER_OPTIONS = --android-harness
analyze:
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) --android-harness -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = \
BasicHarnessActivity.java \

@ -5,42 +5,9 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = infer
FILES = \
SomeLibrary.java \
SkippedSourceFile.java \
T.java \
Utils.java \
\
AnalysisStops.java \
ArrayOutOfBounds.java \
AutoGenerated.java \
Builtins.java \
ClassCastExceptions.java \
CloseableAsResourceExample.java \
ContextLeaks.java \
CursorLeaks.java \
DivideByZero.java \
DynamicDispatch.java \
FilterInputStreamLeaks.java \
FilterOutputStreamLeaks.java \
GuardedByExample.java \
HashMapExample.java \
IntegerExample.java \
JunitAssertion.java \
NeverNullSource.java \
NullPointerExceptions.java \
ReaderLeaks.java \
ResourceLeaks.java \
ReturnValueIgnored.java \
TaintExample.java \
WriterLeaks.java \
compile:
javac -cp $(CLASSPATH) $(FILES)
analyze:
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = $(wildcard *.java)

@ -0,0 +1,49 @@
# Copyright (c) 2016 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# Makefiles that include this one must define JAVA_TEST_DIR and then include
# $(JAVA_TEST_DIR)/java.make in order for config.make to be found.
#
# Makefiles that include this one must define the ANALYZER and JAVA_SOURCE_FILES
# variables, and may optionally define INFER_OPTIONS and INFERPRINT_OPTIONS.
include $(JAVA_TEST_DIR)/config.make
INFERPRINT_OPTIONS = --issues-tests
JAVA_CLASS_FILES = $(patsubst %.java,%.class,$(JAVA_SOURCE_FILES))
$(JAVA_CLASS_FILES): $(JAVA_SOURCE_FILES)
javac -cp $(CLASSPATH) $(JAVA_SOURCE_FILES)
infer-out/report.json: $(INFER_BIN) $(JAVA_SOURCE_FILES)
$(call silent_on_success,\
$(INFER_BIN) $(INFER_OPTIONS) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(JAVA_SOURCE_FILES))
issues.exp.test: $(INFERPRINT_BIN) infer-out/report.json
$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) issues.exp.test
LC_ALL=C sort -t: -k1,1 -k2n,2 -o issues.exp.test issues.exp.test
default: compile
.PHONY: compile
compile: $(JAVA_CLASS_FILES)
.PHONY: analyze
analyze: infer-out/report.json
.PHONY: print
print: issues.exp.test
.PHONY: test
test: issues.exp.test
diff -u issues.exp issues.exp.test
.PHONY: clean
clean:
rm -rf codetoanalyze issues.exp.test infer-out $(JAVA_CLASS_FILES)

@ -5,25 +5,11 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = quandary
INFERPRINT_OPTIONS = --issues-txt
FILES = \
Arrays.java \
Basics.java \
DynamicDispatch.java \
Exceptions.java \
Fields.java \
Intents.java \
Interprocedural.java \
LoggingPrivateData.java \
Recursion.java \
UnknownCode.java \
compile:
javac -cp $(CLASSPATH) $(FILES)
INFERPRINT_OPTIONS = --issues-txt
analyze:
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = $(wildcard *.java)

@ -5,38 +5,9 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
include ../Makefile
JAVA_TEST_DIR = ..
include $(JAVA_TEST_DIR)/java.make
ANALYZER = tracing
FILES_FOR_TRACING = \
T2.java \
\
ArrayIndexOutOfBoundsExceptionExample.java \
ClassCastExceptionExample.java \
LazyDynamicDispatchExample.java \
LocallyDefinedExceptionExample.java \
NullPointerExceptionExample.java \
ReportOnMainExample.java \
UnavoidableExceptionExample.java \
\
FILES_LINKED_FROM_INFER = \
T.java \
SkippedSourceFile.java \
SomeLibrary.java \
Utils.java \
CloseableAsResourceExample.java \
NeverNullSource.java \
\
ArrayOutOfBounds.java \
ClassCastExceptions.java \
NullPointerExceptions.java \
FILES = $(FILES_FOR_TRACING) $(FILES_LINKED_FROM_INFER)
compile:
javac -cp $(CLASSPATH) $(FILES)
analyze:
$(call silent_on_success,$(INFER_BIN) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(FILES))
JAVA_SOURCE_FILES = $(wildcard *.java)

Loading…
Cancel
Save