[tests] move javac test to a Makefile

Reviewed By: jberdine

Differential Revision: D4329635

fbshipit-source-id: 143ea87
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 5ffd9e3a7b
commit de8356e4b0

@ -15,7 +15,7 @@ endif
BUILD_SYSTEMS_TESTS = \ BUILD_SYSTEMS_TESTS = \
assembly ck_analytics ck_imports clang_translation delete_results_dir fail_on_issue gradle \ assembly ck_analytics ck_imports clang_translation delete_results_dir fail_on_issue gradle \
linters project_root_rel javac linters project_root_rel
ifneq ($(ANT),no) ifneq ($(ANT),no)
BUILD_SYSTEMS_TESTS += ant BUILD_SYSTEMS_TESTS += ant
endif endif

@ -61,7 +61,6 @@ CODETOANALYZE_DIR = os.path.join(SCRIPT_DIR, 'codetoanalyze')
EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs') EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs')
ALL_TESTS = [ ALL_TESTS = [
'javac',
'locale', 'locale',
'make', 'make',
'multiclang', 'multiclang',
@ -316,7 +315,7 @@ def test(name,
class BuildIntegrationTest(unittest.TestCase): class BuildIntegrationTest(unittest.TestCase):
def test_javac_integration( def _test_javac_integration(
self, self,
enabled=None, enabled=None,
root=os.path.join(ROOT_DIR, 'examples'), root=os.path.join(ROOT_DIR, 'examples'),
@ -437,7 +436,7 @@ class BuildIntegrationTest(unittest.TestCase):
enabled=True, enabled=True,
root=os.path.join(utf8_in_pwd_path, 'gradle'), root=os.path.join(utf8_in_pwd_path, 'gradle'),
report_fname='utf8_in_pwd_gradle_report.json') report_fname='utf8_in_pwd_gradle_report.json')
self.test_javac_integration( self._test_javac_integration(
enabled=True, enabled=True,
root=os.path.join(utf8_in_pwd_path), root=os.path.join(utf8_in_pwd_path),
report_fname='utf8_in_pwd_javac_report.json') report_fname='utf8_in_pwd_javac_report.json')

@ -1,7 +0,0 @@
[
{
"bug_type": "NULL_DEREFERENCE",
"file": "Hello.java",
"procedure": "int Hello.test()"
}
]

@ -0,0 +1,18 @@
# 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.
TESTS_DIR = ../..
ROOT_DIR = $(TESTS_DIR)/../..
ANALYZER = infer
INFER_OPTIONS =
INFERPRINT_OPTIONS = --issues-tests
PROJECT_ROOT = $(ROOT_DIR)/examples
SOURCES = $(PROJECT_ROOT)/Hello.java
include $(TESTS_DIR)/javac.make

@ -0,0 +1 @@
Hello.java, int Hello.test(), 2, NULL_DEREFERENCE, [start of procedure test()]

@ -17,9 +17,12 @@ OBJECTS = $(patsubst %.java,%.class,$(SOURCES))
include $(TESTS_DIR)/java.make include $(TESTS_DIR)/java.make
include $(TESTS_DIR)/base.make include $(TESTS_DIR)/base.make
PROJECT_ROOT ?= $(TESTS_DIR)
$(OBJECTS): $(SOURCES) $(OBJECTS): $(SOURCES)
javac -cp $(CLASSPATH) $(SOURCES) javac -cp $(CLASSPATH) $(SOURCES)
infer-out/report.json: $(JAVA_DEPS) $(SOURCES) infer-out/report.json: $(JAVA_DEPS) $(SOURCES)
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) --project-root $(TESTS_DIR) --inferconfig-home . $(INFER_OPTIONS) -a $(ANALYZER) -- javac -cp $(CLASSPATH) $(SOURCES)) $(INFER_BIN) -a $(ANALYZER) --inferconfig-home . --project-root $(PROJECT_ROOT) $(INFER_OPTIONS) -- \
javac -cp $(CLASSPATH) $(SOURCES))

Loading…
Cancel
Save