[tests] port --fail-on-issue test to a Makefile

Reviewed By: jberdine

Differential Revision: D4329627

fbshipit-source-id: cad3eab
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 674e3c86ea
commit ebb75d6171

@ -14,7 +14,8 @@ ifeq ($(IS_FACEBOOK_TREE),yes)
endif
BUILD_SYSTEMS_TESTS = \
assembly ck_analytics ck_imports clang_translation delete_results_dir linters project_root_rel
assembly ck_analytics ck_imports clang_translation delete_results_dir fail_on_issue linters \
project_root_rel
ifneq ($(ANT),no)
BUILD_SYSTEMS_TESTS += ant
endif

@ -61,7 +61,6 @@ CODETOANALYZE_DIR = os.path.join(SCRIPT_DIR, 'codetoanalyze')
EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs')
ALL_TESTS = [
'fail',
'gradle',
'javac',
'locale',
@ -472,13 +471,6 @@ class BuildIntegrationTest(unittest.TestCase):
{'compile': ['analyze'],
'infer_args': ['--reactive']}])
def test_fail_on_issue(self):
test('fail', '--fail-on-issue flag',
CODETOANALYZE_DIR,
[{'compile': ['clang', '-c', 'hello.c'],
'infer_args': ['--fail-on-issue']}],
should_fail=2)
def test_pmd_xml_output(self):
def pmd_check(infer_out):
assert os.path.exists(os.path.join(infer_out, 'report.xml'))

@ -1,7 +0,0 @@
[
{
"bug_type": "NULL_DEREFERENCE",
"file": "hello.c",
"procedure": "test"
}
]

@ -0,0 +1,44 @@
# 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 = ../..
ANALYZER = infer
CODETOANALYZE_DIR = ../codetoanalyze
CLANG_OPTIONS = -c
INFER_OPTIONS = --project-root $(CODETOANALYZE_DIR) --fail-on-issue
INFERPRINT_OPTIONS = --issues-tests
SOURCES = $(CODETOANALYZE_DIR)/hello.c
OBJECTS = $(foreach source,$(SOURCES),$(basename $(source)).o)
ROOT_DIR = $(TESTS_DIR)/../..
include $(ROOT_DIR)/Makefile.config
default: compile
issues.exp.test: $(CLANG_DEPS) $(SOURCES)
$(call silent_on_success,\
($(INFER_BIN) --fail-on-issue -- clang $(CLANG_OPTIONS) $(SOURCES); \
echo "infer exit code: $$?" > $@))
.PHONY: compile
compile: $(OBJECTS)
.PHONY: print
print: issues.exp.test
.PHONY: test
test: issues.exp.test
diff -u issues.exp issues.exp.test
.PHONY: clean
clean:
rm -rf issues.exp.test infer-out $(OBJECTS)
Loading…
Cancel
Save