move build integration tests to infer/tests/

Summary:public
It's a test, so infer/tests/ is a good place for it. Also, park the expected
outputs all in their own directory. This will help a future diff that changes
the gradle integration test.

Reviewed By: jeremydubreil

Differential Revision: D3019305

fb-gh-sync-id: d3a3ed8
shipit-source-id: d3a3ed8
master
Jules Villard 9 years ago committed by Facebook Github Bot 0
parent 71f81f102c
commit 09f5605a6e

@ -86,20 +86,20 @@ test_build:
$(MAKE) -C $(SRC_DIR) test_build
ocaml_unit_test: $(INFER_ANALYZERS) unit
InferUnit
$(INFERUNIT_BIN)
buck_test: $(INFER_ANALYZERS)
NO_BUCKD=1 buck clean
NO_BUCKD=1 buck test $(TARGETS_TO_TEST)
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
NO_BUCKD=1 ./scripts/build_integration_tests.py
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
endif
buck_test_xml: $(INFER_ANALYZERS)
NO_BUCKD=1 buck clean
NO_BUCKD=1 buck test --xml test.xml $(TARGETS_TO_TEST)
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
NO_BUCKD=1 ./scripts/build_integration_tests.py
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
endif
inferTraceBugs_test: $(INFER_ANALYZERS)
@ -136,7 +136,6 @@ ifeq (@BUILD_C_ANALYZERS@,yes)
endif
$(MAKE) -C $(INFER_DIR) clean
.PHONY: all buck_test buck_test_xml build_integration_tests clean clang
.PHONY: all buck_test buck_test_xml clean clang
.PHONY: clang_plugin clang_setup inferTraceBugs_test java ocaml_unit_test
.PHONY: test test_xml test_build
.PHONY: test test_xml test_build unit

@ -19,15 +19,14 @@ import sys
import tempfile
import unittest
SCRIPTS_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0,
os.path.join(SCRIPTS_DIRECTORY,
os.pardir, 'infer', 'lib', 'python'))
os.path.join(SCRIPT_DIRECTORY,
os.pardir, os.pardir, 'lib', 'python'))
from inferlib import issues, utils
CURRENT_DIR = os.getcwd()
REPORT_JSON = 'report.json'
INFER_EXECUTABLE = 'infer'
@ -40,6 +39,7 @@ REPORT_FIELDS = [
issues.JSON_INDEX_TYPE,
]
EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIRECTORY, 'expected_outputs')
def should_record_tests():
return RECORD_ENV in os.environ and os.environ[RECORD_ENV] == '1'
@ -94,7 +94,7 @@ def run_analysis(root, clean_cmd, build_cmd, analyzer):
json_path = os.path.join(temp_out_dir, REPORT_JSON)
found_errors = utils.load_json_from_path(json_path)
shutil.rmtree(temp_out_dir)
os.chdir(CURRENT_DIR)
os.chdir(SCRIPT_DIRECTORY)
return found_errors
@ -168,13 +168,14 @@ class BuildIntegrationTest(unittest.TestCase):
def test_ant_integration(self):
if is_tool_available(['ant', '-version']):
print('\nRunning Gradle integration test')
root = os.path.join(CURRENT_DIR, 'infer', 'tests')
root = os.path.join(SCRIPT_DIRECTORY, os.pardir)
errors = run_analysis(
root,
['ant', 'clean'],
['ant', 'compile'],
INFER_EXECUTABLE)
do_test(errors, os.path.join(root, 'ant_report.json'))
original = os.path.join(EXPECTED_OUTPUTS_DIR, 'ant_report.json')
do_test(errors, original)
else:
print('\nSkipping Ant integration test')
assert True
@ -182,13 +183,15 @@ class BuildIntegrationTest(unittest.TestCase):
def test_gradle_integration(self):
if is_tool_available(['gradle', '--version']):
print('\nRunning Gradle integration test')
root = os.path.join(CURRENT_DIR, 'examples', 'android_hello')
root = os.path.join(SCRIPT_DIRECTORY, os.pardir, os.pardir,
os.pardir, 'examples', 'android_hello')
errors = run_analysis(
root,
['gradle', 'clean'],
['gradle', 'build'],
INFER_EXECUTABLE)
do_test(errors, os.path.join(root, 'gradle_report.json'))
original = os.path.join(EXPECTED_OUTPUTS_DIR, 'gradle_report.json')
do_test(errors, original)
else:
print('\nSkipping Gradle integration test')
assert True
@ -196,15 +199,15 @@ class BuildIntegrationTest(unittest.TestCase):
def test_buck_integration(self):
if is_tool_available(['buck', '--version']):
print('\nRunning Buck integration test')
root = CURRENT_DIR
root = os.path.join(SCRIPT_DIRECTORY,
os.pardir, os.pardir, os.pardir)
errors = run_analysis(
root,
['buck', 'clean'],
['buck', 'build', 'infer'],
INFER_EXECUTABLE)
report_path = os.path.join(
CURRENT_DIR, 'infer', 'tests', 'buck_report.json')
do_test(errors, report_path)
original = os.path.join(EXPECTED_OUTPUTS_DIR, 'buck_report.json')
do_test(errors, original)
else:
print('\nSkipping Buck integration test')
assert True
Loading…
Cancel
Save