From 6c056f535a4a43d29013d43cd1bd01af356adb98 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 15 Dec 2016 09:01:02 -0800 Subject: [PATCH] [tests] port ck analytics test to a Makefile Reviewed By: jberdine Differential Revision: D4329611 fbshipit-source-id: aea5792 --- Makefile | 2 +- .../build_systems/build_integration_tests.py | 11 -- .../tests/build_systems/ck_analytics/Makefile | 20 +++ .../build_systems/ck_analytics/issues.exp | 27 ++++ .../componentkit_analytics_report.json | 137 ------------------ 5 files changed, 48 insertions(+), 149 deletions(-) create mode 100644 infer/tests/build_systems/ck_analytics/Makefile create mode 100644 infer/tests/build_systems/ck_analytics/issues.exp delete mode 100644 infer/tests/build_systems/expected_outputs/componentkit_analytics_report.json diff --git a/Makefile b/Makefile index cd3063ddb..a7251dc32 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes) include $(ROOT_DIR)/facebook/Makefile.env endif -BUILD_SYSTEMS_TESTS = assembly clang_translation linters project_root_rel +BUILD_SYSTEMS_TESTS = assembly ck_analytics clang_translation linters project_root_rel 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 8ee15d344..fda7be1b9 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 = [ - 'componentkit_analytics', 'componentkit_imports', 'delete', 'fail', @@ -475,16 +474,6 @@ class BuildIntegrationTest(unittest.TestCase): {'compile': ['analyze'], 'infer_args': ['--reactive']}]) - def test_clang_component_kit_analytics(self): - test('componentkit_analytics', - 'component quality analyzer emits analytics info when flag is ' - 'enabled', - os.path.join(CODETOANALYZE_DIR, 'componentkit'), - [{'compile': ['clang', '-x', 'objective-c++', '-std=c++11', '-c', - '-fblocks', 'TestComponentKitAnalytics.mm'], - 'infer_args': ['--cxx', '--no-filtering', '-a', 'linters', - '--compute-analytics']}]) - def test_clang_component_kit_imports(self): test('componentkit_imports', 'component quality analyzer skips imports', diff --git a/infer/tests/build_systems/ck_analytics/Makefile b/infer/tests/build_systems/ck_analytics/Makefile new file mode 100644 index 000000000..c2b8ed5e8 --- /dev/null +++ b/infer/tests/build_systems/ck_analytics/Makefile @@ -0,0 +1,20 @@ +# 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 = linters + +CODETOANALYZE_DIR = ../codetoanalyze/componentkit + +CLANG_OPTIONS = -x objective-c++ -std=c++11 -c -fblocks +INFER_OPTIONS = --no-filtering --compute-analytics --project-root $(CODETOANALYZE_DIR) +INFERPRINT_OPTIONS = --issues-tests + +SOURCES = $(CODETOANALYZE_DIR)/TestComponentKitAnalytics.mm + +include $(TESTS_DIR)/clang.make diff --git a/infer/tests/build_systems/ck_analytics/issues.exp b/infer/tests/build_systems/ck_analytics/issues.exp new file mode 100644 index 000000000..fc94bd5d4 --- /dev/null +++ b/infer/tests/build_systems/ck_analytics/issues.exp @@ -0,0 +1,27 @@ +TestComponentKitAnalytics.mm, Linters_dummy_method, -1, COMPONENT_FILE_CYCLOMATIC_COMPLEXITY, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 1, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 2, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 3, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 4, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 5, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 6, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 7, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 8, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 9, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 10, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 11, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 12, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 13, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 14, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 15, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 16, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 17, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 18, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 19, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 20, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 21, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 22, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 23, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, Linters_dummy_method, 24, COMPONENT_FILE_LINE_COUNT, [] +TestComponentKitAnalytics.mm, SomeClass_new, 16, COMPONENT_FILE_CYCLOMATIC_COMPLEXITY, [] +TestComponentKitAnalytics.mm, SomeClass_new, 18, COMPONENT_FILE_CYCLOMATIC_COMPLEXITY, [] diff --git a/infer/tests/build_systems/expected_outputs/componentkit_analytics_report.json b/infer/tests/build_systems/expected_outputs/componentkit_analytics_report.json deleted file mode 100644 index b7a829210..000000000 --- a/infer/tests/build_systems/expected_outputs/componentkit_analytics_report.json +++ /dev/null @@ -1,137 +0,0 @@ -[ - { - "bug_type": "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY", - "file": "TestComponentKitAnalytics.mm", - "procedure": "SomeClass_new" - }, - { - "bug_type": "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY", - "file": "TestComponentKitAnalytics.mm", - "procedure": "SomeClass_new" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - }, - { - "bug_type": "COMPONENT_FILE_LINE_COUNT", - "file": "TestComponentKitAnalytics.mm", - "procedure": "Linters_dummy_method" - } -] \ No newline at end of file