From 70720798d8ea736608fdf168c006438b2ddafc3f Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 15 Nov 2016 07:36:33 -0800 Subject: [PATCH] [tests] share javac.make more broadly Summary: - rename java.make -> javac.make, config.make -> java.make, and move to infer/tests/ so it's easier to use from infer/tests/build_systems/ - use these from ant's test Makefile, much code reuse! - factor out common functionality between java and clang A wrinkle: sorting is now done the same way for --issues-tests and --issues-txt, which produces bogus (but still as deterministic) sorting for --issues-txt. This is more of a cosmetic issue, but I hope to fix it in a later diff that gets rid of calls to `sort` in favour of sorting directly from `InferPrint`. Reviewed By: jberdine Differential Revision: D4166841 fbshipit-source-id: ed6f232 --- Makefile | 25 ++++++++-- infer/tests/base.make | 33 +++++++++++++ infer/tests/build_systems/ant/Makefile | 37 ++++---------- infer/tests/clang.make | 29 +---------- .../codetoanalyze/java/checkers/Makefile | 8 ++-- .../codetoanalyze/java/crashcontext/Makefile | 20 ++++---- .../codetoanalyze/java/eradicate/Makefile | 8 ++-- .../tests/codetoanalyze/java/harness/Makefile | 10 ++-- infer/tests/codetoanalyze/java/infer/Makefile | 7 +-- .../tests/codetoanalyze/java/infer/issues.exp | 12 ++--- infer/tests/codetoanalyze/java/java.make | 48 ------------------- .../codetoanalyze/java/quandary/Makefile | 8 ++-- .../codetoanalyze/java/quandary/issues.exp | 46 +++++++++--------- .../tests/codetoanalyze/java/tracing/Makefile | 7 +-- .../java/config.make => java.make} | 3 +- infer/tests/javac.make | 25 ++++++++++ 16 files changed, 156 insertions(+), 170 deletions(-) create mode 100644 infer/tests/base.make delete mode 100644 infer/tests/codetoanalyze/java/java.make rename infer/tests/{codetoanalyze/java/config.make => java.make} (96%) create mode 100644 infer/tests/javac.make diff --git a/Makefile b/Makefile index c9bec6413..7b5190877 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ include $(ROOT_DIR)/Makefile.config ifeq ($(IS_FACEBOOK_TREE),yes) # With this makefile, all targets will default to have right env variables pointing to the sandbox - include $(ROOT_DIR)/facebook//Makefile.env + include $(ROOT_DIR)/facebook/Makefile.env endif BUILD_SYSTEMS_TESTS = ant assembly project_root_rel @@ -132,6 +132,12 @@ $(1): infer | grep -v "warning: ignoring old commands for target" \ | grep -v "warning: overriding commands for target" \ ; exit $$$${PIPESTATUS[0]} + +.PHONY: $(1)_clean +$(1)_clean: + $(MAKE) -C \ + $(INFER_DIR)/tests/codetoanalyze/$(shell printf $(1) | cut -f 1 -d _)/$(shell printf $(1) | cut -f 2 -d _) \ + clean endef $(foreach test,$(DIRECT_TESTS) $(DIRECT_TESTS_REPLACE),\ @@ -142,9 +148,13 @@ $(foreach test,$(DIRECT_TESTS) $(DIRECT_TESTS_REPLACE),\ direct_tests: $(DIRECT_TESTS) define gen_build_system_test_rule -.PHONY: $(1)_test +.PHONY: build_$(1)_test build_$(1)_test: infer $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(1) test + +.PHONY: build_$(1)_clean +build_$(1)_clean: + $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(1) clean endef $(foreach test,$(BUILD_SYSTEMS_TESTS), $(eval $(call gen_build_system_test_rule,$(test)))) @@ -220,6 +230,10 @@ uninstall: $(REMOVE) $(DESTDIR)$(bindir)/inferTraceBugs $(REMOVE) $(DESTDIR)$(bindir)/infer +.PHONY: test_clean +test_clean: $(foreach test,$(DIRECT_TESTS),$(test)_clean) \ + $(foreach test,$(BUILD_SYSTEMS_TESTS),build_$(test)_clean) + .PHONY: install install: infer inferTraceBugs # create directory structure @@ -325,7 +339,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes) endif .PHONY: clean -clean: +clean: test_clean ifeq ($(IS_RELEASE_TREE),no) ifeq ($(BUILD_C_ANALYZERS),yes) $(MAKE) -C $(FCP_DIR) clean @@ -363,3 +377,8 @@ conf-clean: clean # print any variable for Makefile debugging print-%: @echo '$*=$($*)' + +# print list of targets +.PHONY: show-targets +show-targets: + @$(MAKE) -pqrR . | grep --only-matching -e '^[a-zA-Z0-9][^ ]*:' | cut -d ':' -f 1 | sort diff --git a/infer/tests/base.make b/infer/tests/base.make new file mode 100644 index 000000000..07077c8ab --- /dev/null +++ b/infer/tests/base.make @@ -0,0 +1,33 @@ +# 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. + +ROOT_DIR = $(TESTS_DIR)/../.. + +include $(ROOT_DIR)/Makefile.config + +default: compile + +issues.exp.test: infer-out/report.json $(INFERPRINT_BIN) + $(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< + LC_ALL=C sort -t, -k1,1 -k2,2 -k3n,3 -o $@ $@ + +.PHONY: compile +compile: $(OBJECTS) + +.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 $(OBJECTS) $(CLEAN_EXTRA) diff --git a/infer/tests/build_systems/ant/Makefile b/infer/tests/build_systems/ant/Makefile index 0434d3688..4eca79627 100644 --- a/infer/tests/build_systems/ant/Makefile +++ b/infer/tests/build_systems/ant/Makefile @@ -5,41 +5,22 @@ # 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. -ANALYZER = infer -ROOT_DIR = ../../../.. - -include $(ROOT_DIR)/Makefile.config +TESTS_DIR = ../.. -default: compile +ANALYZER = infer +SOURCES = $(wildcard src/infer/*.java) +OBJECTS = $(patsubst %.java,ant_out/%.class,$(SOURCES)) +INFERPRINT_OPTIONS = --issues-tests -JAVA_SOURCE_FILES = $(wildcard src/infer/*.java) -JAVA_CLASS_FILES = $(patsubst %.java,ant_out/%.class,$(JAVA_SOURCE_FILES)) +include $(TESTS_DIR)/java.make +include $(TESTS_DIR)/base.make -$(JAVA_CLASS_FILES): $(JAVA_SOURCE_FILES) +$(OBJECTS): $(SOURCES) ant -infer-out/report.json: $(INFER_BIN) $(JAVA_SOURCE_FILES) +infer-out/report.json: $(INFER_BIN) $(SOURCES) $(call silent_on_success,\ $(INFER_BIN) -a $(ANALYZER) -- ant) -issues.exp.test: infer-out/report.json $(INFERPRINT_BIN) - $(INFERPRINT_BIN) -q -a $(ANALYZER) --issues-tests $@ --from-json-report $< - LC_ALL=C sort -t: -k1,1 -k2n,2 -o $@ $@ - -.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: ant clean - rm -rf issues.exp.test infer-out diff --git a/infer/tests/clang.make b/infer/tests/clang.make index 055fbe9dd..ae1159159 100644 --- a/infer/tests/clang.make +++ b/infer/tests/clang.make @@ -5,42 +5,15 @@ # 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. -ROOT_DIR = $(TESTS_DIR)/../.. -include $(ROOT_DIR)/Makefile.config - INFERPRINT_OPTIONS = --issues-tests - OBJECTS = $(foreach source,$(SOURCES),$(basename $(source)).o) -CLEAN_EXTRA = - -default: compile +include $(TESTS_DIR)/base.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(call silent_on_success,\ $(INFER_BIN) --check-duplicate-symbols $(INFER_OPTIONS) -a $(ANALYZER) -- clang $(CLANG_OPTIONS) $(SOURCES) 2>duplicates.txt) grep "DUPLICATE_SYMBOLS" duplicates.txt; test $$? -ne 0 -issues.exp.test: infer-out/report.json $(INFERPRINT_BIN) - $(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< - LC_ALL=C sort -t, -k1,1 -k2,2 -k3n,3 -o $@ $@ - $(OBJECTS): $(SOURCES) clang $(CLANG_OPTIONS) $(SOURCES) - -.PHONY: compile -compile: $(OBJECTS) - -.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: - $(REMOVE_DIR) duplicates.txt issues.exp.test infer-out $(OBJECTS) $(CLEAN_EXTRA) diff --git a/infer/tests/codetoanalyze/java/checkers/Makefile b/infer/tests/codetoanalyze/java/checkers/Makefile index c9f0cbe16..8be93bd90 100644 --- a/infer/tests/codetoanalyze/java/checkers/Makefile +++ b/infer/tests/codetoanalyze/java/checkers/Makefile @@ -5,11 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = checkers - INFER_OPTIONS = --no-filtering --debug-exceptions +INFERPRINT_OPTIONS = --issues-tests +SOURCES = $(wildcard *.java) -JAVA_SOURCE_FILES = $(wildcard *.java) +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/crashcontext/Makefile b/infer/tests/codetoanalyze/java/crashcontext/Makefile index cb8c51625..79fe45d09 100644 --- a/infer/tests/codetoanalyze/java/crashcontext/Makefile +++ b/infer/tests/codetoanalyze/java/crashcontext/Makefile @@ -5,18 +5,18 @@ # 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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/config.make +TESTS_DIR = ../../.. +include $(TESTS_DIR)/java.make ANALYZER = crashcontext -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)) +SOURCES = $(wildcard *.java) +OBJECTS = $(patsubst %.java,%.class,$(SOURCES)) +EXP_TESTs = $(sort $(patsubst %.java,%.exp.test,$(SOURCES))) +INFER_OUTs = $(patsubst %.java,infer-out-%,$(SOURCES)) -$(JAVA_CLASS_FILES): $(JAVA_SOURCE_FILES) - javac -cp $(CLASSPATH) $(JAVA_SOURCE_FILES) +$(OBJECTS): $(SOURCES) + javac -cp $(CLASSPATH) $(SOURCES) # analyze a single source file and generate the test results for it %.exp.test: $(INFER_BIN) %.stacktrace.json %.java @@ -34,7 +34,7 @@ issues.exp.test: $(EXP_TESTs) default: compile .PHONY: compile -compile: $(JAVA_CLASS_FILES) +compile: $(OBJECTS) .PHONY: analyze analyze: $(EXP_TESTs) @@ -48,4 +48,4 @@ test: issues.exp.test .PHONY: clean clean: - $(REMOVE_DIR) $(INFER_OUTs) $(JAVA_CLASS_FILES) $(EXP_TESTs) + $(REMOVE_DIR) $(INFER_OUTs) $(OBJECTS) $(EXP_TESTs) diff --git a/infer/tests/codetoanalyze/java/eradicate/Makefile b/infer/tests/codetoanalyze/java/eradicate/Makefile index c6b0d4f07..ed4e12baa 100644 --- a/infer/tests/codetoanalyze/java/eradicate/Makefile +++ b/infer/tests/codetoanalyze/java/eradicate/Makefile @@ -5,11 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = eradicate - INFER_OPTIONS = --eradicate-return-over-annotated --no-filtering --debug-exceptions +INFERPRINT_OPTIONS = --issues-tests +SOURCES = $(wildcard *.java) -JAVA_SOURCE_FILES = $(wildcard *.java) +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/harness/Makefile b/infer/tests/codetoanalyze/java/harness/Makefile index 9e7f6ae2b..7ad45fdc7 100644 --- a/infer/tests/codetoanalyze/java/harness/Makefile +++ b/infer/tests/codetoanalyze/java/harness/Makefile @@ -5,12 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = infer - INFER_OPTIONS = --android-harness --no-filtering --debug-exceptions - -JAVA_SOURCE_FILES = \ +INFERPRINT_OPTIONS = --issues-tests +SOURCES = \ BasicHarnessActivity.java \ + +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/infer/Makefile b/infer/tests/codetoanalyze/java/infer/Makefile index 33c42b019..eed8ebb85 100644 --- a/infer/tests/codetoanalyze/java/infer/Makefile +++ b/infer/tests/codetoanalyze/java/infer/Makefile @@ -5,10 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = infer INFER_OPTIONS = --no-filtering --debug-exceptions +INFERPRINT_OPTIONS = --issues-tests +SOURCES = $(wildcard *.java) -JAVA_SOURCE_FILES = $(wildcard *.java) +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/infer/issues.exp b/infer/tests/codetoanalyze/java/infer/issues.exp index 7723ef7bb..de760e143 100644 --- a/infer/tests/codetoanalyze/java/infer/issues.exp +++ b/infer/tests/codetoanalyze/java/infer/issues.exp @@ -57,8 +57,8 @@ CursorLeaks.java, int CursorLeaks.cursorNotClosed(SQLiteDatabase), 4, RESOURCE_L CursorLeaks.java, int CursorLeaks.getBucketCountNotClosed(), 10, RESOURCE_LEAK CursorLeaks.java, int CursorLeaks.getImageCountHelperNotClosed(String), 13, RESOURCE_LEAK CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderClosed(), 3, NULL_TEST_AFTER_DEREFERENCE -CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 11, RESOURCE_LEAK CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 3, NULL_TEST_AFTER_DEREFERENCE +CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 11, RESOURCE_LEAK CursorLeaks.java, void CursorLeaks.queryUVMLegacyDbNotClosed(), 4, RESOURCE_LEAK CursorLeaks.java, void CursorLeaks.queryUVMLegacyDbNotClosed(), 4, RETURN_VALUE_IGNORED DivideByZero.java, int DivideByZero.callDivideByZeroInterProc(), 1, DIVIDE_BY_ZERO @@ -143,16 +143,16 @@ GuardedByExample.java, void GuardedByExample.writeFBad(), 1, UNSAFE_GUARDED_BY_A GuardedByExample.java, void GuardedByExample.writeFBadWrongLock(), 2, UNSAFE_GUARDED_BY_ACCESS HashMapExample.java, Integer HashMapExample.getOrCreateInteger(HashMap,int), 8, RETURN_VALUE_IGNORED HashMapExample.java, int HashMapExample.getOneIntegerWithoutCheck(), 6, NULL_DEREFERENCE -HashMapExample.java, void HashMapExample.containsIntegerTwiceThenGetTwice(HashMap), 10, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.containsIntegerTwiceThenGetTwice(HashMap), 9, RETURN_VALUE_IGNORED +HashMapExample.java, void HashMapExample.containsIntegerTwiceThenGetTwice(HashMap), 10, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.getTwoIntegersWithOneCheck(Integer,Integer), 10, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.getTwoIntegersWithOneCheck(Integer,Integer), 11, NULL_DEREFERENCE HashMapExample.java, void HashMapExample.getTwoIntegersWithOneCheck(Integer,Integer), 11, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.getTwoIntegersWithOneCheck(Integer,Integer), 7, Cannot_star -HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 12, RETURN_VALUE_IGNORED -HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 13, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 6, RETURN_VALUE_IGNORED HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 7, RETURN_VALUE_IGNORED +HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 12, RETURN_VALUE_IGNORED +HashMapExample.java, void HashMapExample.putIntegerTwiceThenGetTwice(HashMap), 13, RETURN_VALUE_IGNORED InvokeDynamic.java, int InvokeDynamic.lambda$npeInLambdaBad$1(String,String), 1, ANALYSIS_STOPS InvokeDynamic.java, int InvokeDynamic.lambda$npeInLambdaBad$1(String,String), 1, NULL_DEREFERENCE InvokeDynamic.java, void InvokeDynamic.invokeDynamicThenNpeBad(List), 5, ANALYSIS_STOPS @@ -305,8 +305,8 @@ ResourceLeaks.java, void ResourceLeaks.objectOutputStreamNotClosedAfterWrite(), ResourceLeaks.java, void ResourceLeaks.objectOutputStreamNotClosedAfterWrite(), 7, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.openHttpURLConnectionNotDisconnected(), 7, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.openHttpsURLConnectionNotDisconnected(), 3, RESOURCE_LEAK -ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 10, NULL_TEST_AFTER_DEREFERENCE ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 5, RESOURCE_LEAK +ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 10, NULL_TEST_AFTER_DEREFERENCE ResourceLeaks.java, void ResourceLeaks.pipedInputStreamClosed(PipedOutputStream), 4, RETURN_VALUE_IGNORED ResourceLeaks.java, void ResourceLeaks.pipedInputStreamNotClosedAfterRead(PipedOutputStream), 4, RETURN_VALUE_IGNORED ResourceLeaks.java, void ResourceLeaks.pipedInputStreamNotClosedAfterRead(PipedOutputStream), 6, RESOURCE_LEAK @@ -317,9 +317,9 @@ ResourceLeaks.java, void ResourceLeaks.socketNotClosed(), 1, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.themeObtainTypedArrayAndLeak(Resources$Theme), 2, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.twoResourcesRandomAccessFile(), 10, RESOURCE_LEAK -ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 10, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 7, NULL_TEST_AFTER_DEREFERENCE ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 8, NULL_TEST_AFTER_DEREFERENCE +ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 10, RESOURCE_LEAK ResourceLeaks.java, void ResourceLeaks.zipFileLeakExceptionalBranch(), 5, RESOURCE_LEAK ReturnValueIgnored.java, void ReturnValueIgnored.returnValueIgnored(), 1, RETURN_VALUE_IGNORED TaintExample.java, InputStream TaintExample.socketIgnoreExceptionNoVerify(SSLSocketFactory), 9, TAINTED_VALUE_REACHING_SENSITIVE_FUNCTION diff --git a/infer/tests/codetoanalyze/java/java.make b/infer/tests/codetoanalyze/java/java.make deleted file mode 100644 index d3ce77b30..000000000 --- a/infer/tests/codetoanalyze/java/java.make +++ /dev/null @@ -1,48 +0,0 @@ -# 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: infer-out/report.json $(INFERPRINT_BIN) - $(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< - LC_ALL=C sort -t: -k1,1 -k2n,2 -o $@ $@ - -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) diff --git a/infer/tests/codetoanalyze/java/quandary/Makefile b/infer/tests/codetoanalyze/java/quandary/Makefile index 8e58d3cce..688329d2e 100644 --- a/infer/tests/codetoanalyze/java/quandary/Makefile +++ b/infer/tests/codetoanalyze/java/quandary/Makefile @@ -5,11 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = quandary -INFER_OPTIONS = --no-filtering --debug-exceptions +INFER_OPTIONS = --no-filtering --debug-exceptions INFERPRINT_OPTIONS = --issues-txt +SOURCES = $(wildcard *.java) -JAVA_SOURCE_FILES = $(wildcard *.java) +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/quandary/issues.exp b/infer/tests/codetoanalyze/java/quandary/issues.exp index 16696925e..1d8d022aa 100644 --- a/infer/tests/codetoanalyze/java/quandary/issues.exp +++ b/infer/tests/codetoanalyze/java/quandary/issues.exp @@ -4,6 +4,16 @@ Arrays.java:37: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.infer Arrays.java:44: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 43]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 44]) Arrays.java:67: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 66]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 67]) Arrays.java:75: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 73]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 75]) +Basics.java:103: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 100]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 103]) +Basics.java:118: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 113]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 118]) +Basics.java:132: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 129]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 132]) +Basics.java:142: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 140]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 142]) +Basics.java:153: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 150]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 153]) +Basics.java:159: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 158]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 159]) +Basics.java:160: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 158]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 160]) +Basics.java:166: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 164]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 166]) +Basics.java:209: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 206]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 209]) +Basics.java:218: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 214]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 218]) Basics.java:24: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 24]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 24]) Basics.java:29: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 28]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 29]) Basics.java:35: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 33]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 35]) @@ -15,34 +25,24 @@ Basics.java:67: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.infer Basics.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 75]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) Basics.java:89: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 85]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 89]) Basics.java:95: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 93]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 95]) -Basics.java:103: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 100]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 103]) -Basics.java:118: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 113]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 118]) -Basics.java:132: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 129]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 132]) -Basics.java:142: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 140]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 142]) -Basics.java:153: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 150]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 153]) -Basics.java:159: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 158]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 159]) -Basics.java:160: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 158]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 160]) -Basics.java:166: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 164]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 166]) -Basics.java:209: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 206]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 209]) -Basics.java:218: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 214]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 218]) -DynamicDispatch.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadInterfaceImpl1.returnSource() at [line 76]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { Object DynamicDispatch$Interface.returnSource() at [line 76] }) -DynamicDispatch.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadInterfaceImpl2.returnSource() at [line 76]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { Object DynamicDispatch$Interface.returnSource() at [line 76] }) -DynamicDispatch.java:82: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 81]) -> Other(void DynamicDispatch$BadInterfaceImpl1.callSink(Object) at [line 82]) -DynamicDispatch.java:82: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 81]) -> Other(void DynamicDispatch$BadInterfaceImpl2.callSink(Object) at [line 82]) -DynamicDispatch.java:88: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 86]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 88]) (via { Object DynamicDispatch$BadInterfaceImpl1.propagate(Object) at [line 87], Object DynamicDispatch$BadInterfaceImpl2.propagate(Object) at [line 87], Object DynamicDispatch$Interface.propagate(Object) at [line 87] }) DynamicDispatch.java:135: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadSubtype.returnSource() at [line 134]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 135]) DynamicDispatch.java:140: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 139]) -> Other(void DynamicDispatch$BadSubtype.callSink(Object) at [line 140]) DynamicDispatch.java:146: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 144]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 146]) (via { Object DynamicDispatch$BadSubtype.propagate(Object) at [line 145] }) DynamicDispatch.java:154: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadSubtype.returnSource() at [line 153]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 154]) DynamicDispatch.java:157: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 156]) -> Other(void DynamicDispatch$BadSubtype.callSink(Object) at [line 157]) DynamicDispatch.java:160: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 156]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 160]) (via { Object DynamicDispatch$BadSubtype.propagate(Object) at [line 159] }) +DynamicDispatch.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadInterfaceImpl1.returnSource() at [line 76]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { Object DynamicDispatch$Interface.returnSource() at [line 76] }) +DynamicDispatch.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object DynamicDispatch$BadInterfaceImpl2.returnSource() at [line 76]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { Object DynamicDispatch$Interface.returnSource() at [line 76] }) +DynamicDispatch.java:82: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 81]) -> Other(void DynamicDispatch$BadInterfaceImpl1.callSink(Object) at [line 82]) +DynamicDispatch.java:82: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 81]) -> Other(void DynamicDispatch$BadInterfaceImpl2.callSink(Object) at [line 82]) +DynamicDispatch.java:88: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 86]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 88]) (via { Object DynamicDispatch$BadInterfaceImpl1.propagate(Object) at [line 87], Object DynamicDispatch$BadInterfaceImpl2.propagate(Object) at [line 87], Object DynamicDispatch$Interface.propagate(Object) at [line 87] }) +Exceptions.java:117: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 117]) -> Other(void Exceptions.callSinkThenThrow(Object) at [line 117]) Exceptions.java:23: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 19]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 23]) Exceptions.java:33: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 30]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 33]) Exceptions.java:44: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 38]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 44]) Exceptions.java:63: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 59]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 63]) Exceptions.java:73: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 71]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 73]) Exceptions.java:84: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 82]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 84]) -Exceptions.java:117: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 117]) -> Other(void Exceptions.callSinkThenThrow(Object) at [line 117]) Fields.java:28: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 27]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 28]) Fields.java:33: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 32]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 33]) Fields.java:38: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 37]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 38]) @@ -80,13 +80,6 @@ Intents.java:51: ERROR: QUANDARY_TAINT_ERROR Error: Intent(Intent Intent.parseIn Intents.java:51: ERROR: QUANDARY_TAINT_ERROR Error: Intent(Intent Intent.parseUri(String,int) at [line 31]) -> Intent(void Activity.startActivityFromFragment(Fragment,Intent,int) at [line 51]) Intents.java:52: ERROR: QUANDARY_TAINT_ERROR Error: Intent(Intent Intent.parseIntent(Resources,XmlPullParser,AttributeSet) at [line 34]) -> Intent(ComponentName ContextWrapper.startService(Intent) at [line 52]) Intents.java:52: ERROR: QUANDARY_TAINT_ERROR Error: Intent(Intent Intent.parseUri(String,int) at [line 31]) -> Intent(ComponentName ContextWrapper.startService(Intent) at [line 52]) -Interprocedural.java:39: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceDirect() at [line 39]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 39]) -Interprocedural.java:44: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceDirect() at [line 43]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 44]) -Interprocedural.java:48: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceIndirect() at [line 48]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 48]) -Interprocedural.java:58: ERROR: QUANDARY_TAINT_ERROR Error: Other(Interprocedural$Obj Interprocedural.returnSourceViaField() at [line 58]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 58]) -Interprocedural.java:67: ERROR: QUANDARY_TAINT_ERROR Error: Other(void Interprocedural.returnSourceViaParameter1(Interprocedural$Obj) at [line 66]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 67]) -Interprocedural.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 75]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { void Interprocedural.returnSourceViaParameter2(Interprocedural$Obj,Interprocedural$Obj) at [line 76] }) -Interprocedural.java:92: ERROR: QUANDARY_TAINT_ERROR Error: Other(void Interprocedural.returnSourceViaGlobal() at [line 91]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 92]) Interprocedural.java:108: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 108]) -> Other(void Interprocedural.callSinkParam1(Object,Object) at [line 108]) Interprocedural.java:120: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 120]) -> Other(void Interprocedural.callSinkParam2(Object,Object) at [line 120]) Interprocedural.java:133: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 132]) -> Other(void Interprocedural.callSinkOnFieldDirect() at [line 133]) @@ -105,6 +98,13 @@ Interprocedural.java:251: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferT Interprocedural.java:262: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 260]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 262]) Interprocedural.java:309: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 309]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 309]) Interprocedural.java:314: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 313]) -> Other(void Interprocedural.sourceAndSink(Interprocedural$Obj) at [line 314]) +Interprocedural.java:39: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceDirect() at [line 39]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 39]) +Interprocedural.java:44: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceDirect() at [line 43]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 44]) +Interprocedural.java:48: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object Interprocedural.returnSourceIndirect() at [line 48]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 48]) +Interprocedural.java:58: ERROR: QUANDARY_TAINT_ERROR Error: Other(Interprocedural$Obj Interprocedural.returnSourceViaField() at [line 58]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 58]) +Interprocedural.java:67: ERROR: QUANDARY_TAINT_ERROR Error: Other(void Interprocedural.returnSourceViaParameter1(Interprocedural$Obj) at [line 66]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 67]) +Interprocedural.java:77: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 75]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 77]) (via { void Interprocedural.returnSourceViaParameter2(Interprocedural$Obj,Interprocedural$Obj) at [line 76] }) +Interprocedural.java:92: ERROR: QUANDARY_TAINT_ERROR Error: Other(void Interprocedural.returnSourceViaGlobal() at [line 91]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 92]) LoggingPrivateData.java:57: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getDeviceId() at [line 40]) -> Logging(int Log.e(String,String) at [line 57]) (via { String String.valueOf(double) at [line 25], String String.valueOf(double) at [line 31], String String.valueOf(double) at [line 34], String String.valueOf(float) at [line 28], String String.valueOf(float) at [line 37] }) LoggingPrivateData.java:57: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getLine1Number() at [line 43]) -> Logging(int Log.e(String,String) at [line 57]) (via { String String.valueOf(double) at [line 25], String String.valueOf(double) at [line 31], String String.valueOf(double) at [line 34], String String.valueOf(float) at [line 28], String String.valueOf(float) at [line 37] }) LoggingPrivateData.java:57: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getSimSerialNumber() at [line 46]) -> Logging(int Log.e(String,String) at [line 57]) (via { String String.valueOf(double) at [line 25], String String.valueOf(double) at [line 31], String String.valueOf(double) at [line 34], String String.valueOf(float) at [line 28], String String.valueOf(float) at [line 37] }) diff --git a/infer/tests/codetoanalyze/java/tracing/Makefile b/infer/tests/codetoanalyze/java/tracing/Makefile index 49a6cc1a1..b72e189d2 100644 --- a/infer/tests/codetoanalyze/java/tracing/Makefile +++ b/infer/tests/codetoanalyze/java/tracing/Makefile @@ -5,10 +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. -JAVA_TEST_DIR = .. -include $(JAVA_TEST_DIR)/java.make +TESTS_DIR = ../../.. ANALYZER = tracing INFER_OPTIONS = --no-filtering --debug-exceptions +INFERPRINT_OPTIONS = --issues-tests +SOURCES = $(wildcard *.java) -JAVA_SOURCE_FILES = $(wildcard *.java) +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/config.make b/infer/tests/java.make similarity index 96% rename from infer/tests/codetoanalyze/java/config.make rename to infer/tests/java.make index b16a2b8d3..d82a4af53 100644 --- a/infer/tests/codetoanalyze/java/config.make +++ b/infer/tests/java.make @@ -5,7 +5,8 @@ # 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. -ROOT_DIR = ../../../../.. +ROOT_DIR = $(TESTS_DIR)/../.. + include $(ROOT_DIR)/Makefile.config ANDROID19 = $(JAVA_LIB_DIR)/android/android-19.jar diff --git a/infer/tests/javac.make b/infer/tests/javac.make new file mode 100644 index 000000000..94df9a5e0 --- /dev/null +++ b/infer/tests/javac.make @@ -0,0 +1,25 @@ +# 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 TESTS_DIR and then include +# $(TESTS_DIR)/javac.make. +# +# Makefiles that include this one must define the ANALYZER and SOURCES +# variables, and may optionally define INFER_OPTIONS, INFERPRINT_OPTIONS, +# CLEAN_EXTRA. + +OBJECTS = $(patsubst %.java,%.class,$(SOURCES)) + +include $(TESTS_DIR)/java.make +include $(TESTS_DIR)/base.make + +$(OBJECTS): $(SOURCES) + javac -cp $(CLASSPATH) $(SOURCES) + +infer-out/report.json: $(INFER_BIN) $(SOURCES) + $(call silent_on_success,\ + $(INFER_BIN) $(INFER_OPTIONS) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(SOURCES))