From c40dfc950eaec1ff47cf4e72c91a5b45b7590e85 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 15 Dec 2016 09:03:47 -0800 Subject: [PATCH] [tests] convert reactive test to Makefile Reviewed By: jberdine Differential Revision: D4329651 fbshipit-source-id: 8b67f9e --- Makefile | 2 +- .../build_systems/build_integration_tests.py | 14 -------- .../expected_outputs/reactive_report.json | 17 --------- infer/tests/build_systems/reactive/Makefile | 35 +++++++++++++++++++ infer/tests/build_systems/reactive/issues.exp | 3 ++ 5 files changed, 39 insertions(+), 32 deletions(-) delete mode 100644 infer/tests/build_systems/expected_outputs/reactive_report.json create mode 100644 infer/tests/build_systems/reactive/Makefile create mode 100644 infer/tests/build_systems/reactive/issues.exp diff --git a/Makefile b/Makefile index a0e896dc4..2c48920b8 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ endif BUILD_SYSTEMS_TESTS = \ 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) BUILD_SYSTEMS_TESTS += ant endif diff --git a/infer/tests/build_systems/build_integration_tests.py b/infer/tests/build_systems/build_integration_tests.py index 9eb807f55..18277856f 100755 --- a/infer/tests/build_systems/build_integration_tests.py +++ b/infer/tests/build_systems/build_integration_tests.py @@ -61,7 +61,6 @@ CODETOANALYZE_DIR = os.path.join(SCRIPT_DIR, 'codetoanalyze') EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs') ALL_TESTS = [ - 'reactive', 'unknown_ext', 'utf8_in_pwd', 'waf', @@ -414,19 +413,6 @@ class BuildIntegrationTest(unittest.TestCase): CODETOANALYZE_DIR, [{'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__': # hackish capturing of the arguments after '--' diff --git a/infer/tests/build_systems/expected_outputs/reactive_report.json b/infer/tests/build_systems/expected_outputs/reactive_report.json deleted file mode 100644 index 87b045435..000000000 --- a/infer/tests/build_systems/expected_outputs/reactive_report.json +++ /dev/null @@ -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" - } -] \ No newline at end of file diff --git a/infer/tests/build_systems/reactive/Makefile b/infer/tests/build_systems/reactive/Makefile new file mode 100644 index 000000000..d622fc54a --- /dev/null +++ b/infer/tests/build_systems/reactive/Makefile @@ -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 diff --git a/infer/tests/build_systems/reactive/issues.exp b/infer/tests/build_systems/reactive/issues.exp new file mode 100644 index 000000000..399dbec33 --- /dev/null +++ b/infer/tests/build_systems/reactive/issues.exp @@ -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()]