[tests] convert reactive test to Makefile

Reviewed By: jberdine

Differential Revision: D4329651

fbshipit-source-id: 8b67f9e
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 25e35e8bec
commit c40dfc950e

@ -15,7 +15,7 @@ endif
BUILD_SYSTEMS_TESTS = \ BUILD_SYSTEMS_TESTS = \
assembly ck_analytics ck_imports clang_multiple_files clang_translation delete_results_dir \ assembly ck_analytics ck_imports clang_multiple_files clang_translation delete_results_dir \
fail_on_issue gradle javac linters make project_root_rel utf8_in_procname fail_on_issue gradle javac linters make project_root_rel reactive utf8_in_procname
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 = [
'reactive',
'unknown_ext', 'unknown_ext',
'utf8_in_pwd', 'utf8_in_pwd',
'waf', 'waf',
@ -414,19 +413,6 @@ class BuildIntegrationTest(unittest.TestCase):
CODETOANALYZE_DIR, CODETOANALYZE_DIR,
[{'compile': ['clang', '-x', 'c', '-c', 'hello.unknown_ext']}]) [{'compile': ['clang', '-x', 'c', '-c', 'hello.unknown_ext']}])
def test_reactive_multiple_capture(self):
reactive_args = ['-a', 'capture', '--reactive', '--continue']
test('reactive', 'reactive with multiple capture',
CODETOANALYZE_DIR,
[{'compile': ['clang', '-c', 'hello.c'],
'infer_args': reactive_args},
{'compile': ['clang', '-c', 'hello2.c'],
'infer_args': reactive_args},
{'compile': ['clang', '-c', 'hello3.c'],
'infer_args': reactive_args},
{'compile': ['analyze'],
'infer_args': ['--reactive']}])
if __name__ == '__main__': if __name__ == '__main__':
# hackish capturing of the arguments after '--' # hackish capturing of the arguments after '--'

@ -1,17 +0,0 @@
[
{
"bug_type": "NULL_DEREFERENCE",
"file": "hello.c",
"procedure": "test"
},
{
"bug_type": "NULL_DEREFERENCE",
"file": "hello2.c",
"procedure": "test2"
},
{
"bug_type": "NULL_DEREFERENCE",
"file": "hello3.c",
"procedure": "test3"
}
]

@ -0,0 +1,35 @@
# 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
CLANG_OPTIONS = -c
INFER_OPTIONS = --project-root ../codetoanalyze
INFERPRINT_OPTIONS = --issues-tests
SOURCES1 = ../codetoanalyze/hello.c
SOURCES2 = ../codetoanalyze/hello2.c
SOURCES3 = ../codetoanalyze/hello3.c
SOURCES = $(SOURCES1) $(SOURCES2) $(SOURCES3)
include $(TESTS_DIR)/clang.make
infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(HEADERS)
$(call silent_on_success,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture --reactive --continue -- \
clang $(CLANG_OPTIONS) $(SOURCES1))
$(call silent_on_success,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture --reactive --continue -- \
clang $(CLANG_OPTIONS) $(SOURCES2))
$(call silent_on_success,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture --reactive --continue -- \
clang $(CLANG_OPTIONS) $(SOURCES3))
$(call silent_on_success,\
$(INFER_BIN) --check-duplicate-symbols $(INFER_OPTIONS) -a $(ANALYZER) -- analyze 2>duplicates.txt)
grep "DUPLICATE_SYMBOLS" duplicates.txt; test $$? -ne 0

@ -0,0 +1,3 @@
hello.c, test, 2, NULL_DEREFERENCE, [start of procedure test()]
hello2.c, test2, 2, NULL_DEREFERENCE, [start of procedure test2()]
hello3.c, test3, 2, NULL_DEREFERENCE, [start of procedure test3()]
Loading…
Cancel
Save