Skip to content

Commit

Permalink
Split up analyzer handling part
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Feb 19, 2019
1 parent ea8ac20 commit 11672e5
Show file tree
Hide file tree
Showing 157 changed files with 383 additions and 110 deletions.
24 changes: 23 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ services:

matrix:
include:
- os: linux
name: "Analyzer test cases"
sudo: required
dist: xenial
python: "2.7"
env: CC_MODULE=analyzer
- os: linux
sudo: required
dist: xenial
Expand All @@ -21,6 +27,12 @@ matrix:
dist: xenial
python: "2.7"
env: DATABASE=psql_pg8000
- os: osx
osx_image: xcode9.4
name: "Analyzer test cases"
sudo: false
language: generic
env: CC_MODULE=analyzer
- os: osx
osx_image: xcode9.4
sudo: false
Expand Down Expand Up @@ -95,5 +107,15 @@ addons:
script:
- make clean_travis
- make package
- if [[ ! -z "$DATABASE" ]]; then make test_matrix_${DATABASE}; else make test; fi
- >
if [[ "$CC_MODULE" = "analyzer" ]]; then
make -C analyzer test_unit test_functional test_tu_collector;
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
make -C analyzer test_build_logger
fi
elif [[ ! -z "$DATABASE" ]]; then
make test_matrix_${DATABASE};
else
make test;
fi
- make clean_travis
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ CC_BUILD_DOCS_DIR = $(CC_BUILD_WEB_DIR)/docs
CC_BUILD_WEB_PLUGINS_DIR = $(CC_BUILD_SCRIPTS_DIR)/plugins
CC_BUILD_API_DIR = $(CC_BUILD_SCRIPTS_DIR)/codechecker-api
CC_BUILD_LIB_DIR = $(CC_BUILD_DIR)/lib/python2.7
CC_BUILD_LIBCC_DIR = $(CC_BUILD_LIB_DIR)/libcodechecker
CC_BUILD_GEN_DIR = $(CC_BUILD_LIB_DIR)/gencodechecker

CC_ANALYZER = $(CURRENT_DIR)/analyzer

# Root of the repository.
ROOT = $(CURRENT_DIR)

Expand Down Expand Up @@ -68,7 +71,14 @@ package: clean_package build_dir gen-docs thrift userguide build_plist_to_html b
cp -r $(BUILD_DIR)/thrift/v*/gen-js/* $(CC_BUILD_API_DIR)

# Copy libraries.
cp -r $(ROOT)/libcodechecker $(CC_BUILD_LIB_DIR)
mkdir -p $(CC_BUILD_LIBCC_DIR) && \
cp -r $(ROOT)/libcodechecker/* $(CC_BUILD_LIBCC_DIR) && \
cp -r $(CC_ANALYZER)/cmd/* $(CC_BUILD_LIBCC_DIR)/libhandlers && \
cp -r $(CC_ANALYZER)/codechecker $(CC_BUILD_LIB_DIR)

# Copy sub-commands.
cp $(ROOT)/bin/* $(CC_BUILD_DIR)/bin && \
cp $(CC_ANALYZER)/bin/* $(CC_BUILD_DIR)/bin

# Copy documentation files.
mkdir -p $(CC_BUILD_DOCS_DIR) && \
Expand All @@ -80,7 +90,9 @@ package: clean_package build_dir gen-docs thrift userguide build_plist_to_html b
cp -r $(ROOT)/config $(CC_BUILD_DIR) && \
./scripts/build/extend_version_file.py -r $(ROOT) -b $(BUILD_DIR) && \
mkdir -p $(CC_BUILD_DIR)/cc_bin && \
./scripts/build/create_commands.py -b $(BUILD_DIR) $(ROOT)/bin
./scripts/build/create_commands.py -b $(BUILD_DIR) \
$(ROOT)/bin \
$(CC_ANALYZER)/bin

# Copy web client files.
mkdir -p $(CC_BUILD_WEB_DIR) && \
Expand Down Expand Up @@ -190,3 +202,10 @@ clean_plist_to_html:

clean_tu_collector:
rm -rf vendor/tu_collector/build

clean_travis:
# Clean CodeChecker config files stored in the users home directory.
rm -rf ~/.codechecker*

test_analyzer:
$(MAKE) -C $(CC_ANALYZER) test
13 changes: 13 additions & 0 deletions analyzer/.noserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[nosetests]

# increase verbosity level
verbosity=3

# more detailed error messages on failed asserts
detailed-errors=1

# stop running tests on first error
stop=1

# do not capture stdout
#nocapture=1
24 changes: 24 additions & 0 deletions analyzer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-include Makefile.local

CURRENT_DIR = $(shell pwd)

# Root of the repository.
ROOT = $(CURRENT_DIR)/..

ACTIVATE_DEV_VENV ?= . venv_dev/bin/activate

VENV_DEV_REQ_FILE ?= requirements_py/dev/requirements.txt
VENV_TEST_REQ_FILE ?= requirements_py/test/requirements.txt

include tests/Makefile

venv_dev:
# Create a virtual environment for development.
virtualenv -p python2 venv_dev && \
$(ACTIVATE_DEV_VENV) && pip install -r $(VENV_DEV_REQ_FILE) && \
pip install -r $(VENV_TEST_REQ_FILE)

clean_venv_dev:
rm -rf venv_dev

# TODO: add targets to build analyzer separately.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import shutil
import sys

from codechecker.analyze import analyzer
from codechecker.analyze.analyzers import analyzer_types
from codechecker.buildlog import log_parser

from libcodechecker import logger
from libcodechecker import package_context
from libcodechecker import skiplist_handler
from libcodechecker.analyze import analyzer
from libcodechecker.analyze.analyzers import analyzer_types
from libcodechecker.log import log_parser
from libcodechecker.util import RawDescriptionDefaultHelpFormatter, \
load_json_or_empty

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
import argparse
import subprocess

from codechecker.analyze.analyzers import analyzer_types

from libcodechecker import logger
from libcodechecker import package_context
from libcodechecker import output_formatters
from libcodechecker.analyze.analyzers import analyzer_types

LOG = logger.get_logger('system')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
import shutil
import tempfile

from codechecker.analyze.analyzers import analyzer_types

from libcodechecker import logger
from libcodechecker import libhandlers
from libcodechecker import package_context
from libcodechecker.analyze.analyzers import analyzer_types
from libcodechecker.util import RawDescriptionDefaultHelpFormatter

LOG = logger.get_logger('system')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
import argparse
import os

from codechecker.analyze.analyzers import analyzer_types

from libcodechecker import package_context
from libcodechecker import logger
from libcodechecker import output_formatters
from libcodechecker.analyze.analyzers import analyzer_types
from libcodechecker.env import get_check_env

LOG = logger.get_logger('system')
Expand Down
5 changes: 3 additions & 2 deletions libcodechecker/libhandlers/log.py → analyzer/cmd/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
import argparse
import os

from codechecker.buildlog import build_manager
from codechecker.buildlog.host_check import check_intercept

from libcodechecker import package_context
from libcodechecker import logger
from libcodechecker.log import build_manager
from libcodechecker.log.host_check import check_intercept


def get_argparser_ctor_args():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import zipfile

from libcodechecker import util, plist_parser
from libcodechecker.analyze import gcc_toolchain
from libcodechecker.analyze.analyzers import analyzer_clangsa
from libcodechecker.analyze.analyzers import analyzer_types
from libcodechecker.analyze.statistics_collector \
import SpecialReturnValueCollector
from libcodechecker.env import get_check_env
from libcodechecker.logger import get_logger
from tu_collector import tu_collector

from . import gcc_toolchain
from .analyzers import analyzer_clangsa
from .analyzers import analyzer_types
from .statistics_collector import SpecialReturnValueCollector

LOG = get_logger('analyzer')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
import time

from libcodechecker.logger import get_logger
from libcodechecker.analyze import analysis_manager
from libcodechecker.analyze import pre_analysis_manager
from libcodechecker.analyze.analyzers import analyzer_types
from libcodechecker.analyze.analyzers.analyzer_clangsa import ClangSA
from libcodechecker.analyze.statistics_collector \
import SpecialReturnValueCollector
from libcodechecker.analyze.statistics_collector \
import ReturnValueCollector
from libcodechecker.env import get_check_env

from . import analysis_manager, pre_analysis_manager
from .analyzers import analyzer_types
from .analyzers.analyzer_clangsa import ClangSA
from .statistics_collector import SpecialReturnValueCollector
from .statistics_collector import ReturnValueCollector

LOG = get_logger('analyzer')

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
import shlex
import subprocess

from libcodechecker.analyze import host_check
from libcodechecker.analyze.analyzers import analyzer_base
from libcodechecker.analyze.analyzers import config_handler_clang_tidy
from libcodechecker.analyze.analyzers import result_handler_clang_tidy
from libcodechecker.analyze.analyzers.analyzer_clangsa import ClangSA
from libcodechecker.analyze.analyzer_env import \
extend_analyzer_cmd_with_resource_dir
from libcodechecker.env import get_check_env
from libcodechecker.logger import get_logger
from libcodechecker.util import get_binary_in_path, replace_env_var

from .. import host_check
from ..analyzer_env import extend_analyzer_cmd_with_resource_dir

from . import analyzer_base
from . import config_handler_clang_tidy
from . import result_handler_clang_tidy
from .analyzer_clangsa import ClangSA

LOG = get_logger('analyzer')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
import shlex
import subprocess

from libcodechecker.analyze import host_check
from libcodechecker.analyze.analyzers import analyzer_base
from libcodechecker.analyze.analyzers import config_handler_clangsa
from libcodechecker.analyze.analyzers import ctu_triple_arch
from libcodechecker.analyze.analyzers.result_handler_clangsa import \
ResultHandlerClangSA
from libcodechecker.analyze.analyzer_env import \
extend_analyzer_cmd_with_resource_dir
from libcodechecker.env import get_check_env
from libcodechecker.logger import get_logger
from libcodechecker.util import get_binary_in_path, replace_env_var

from .. import host_check
from ..analyzer_env import extend_analyzer_cmd_with_resource_dir

from . import analyzer_base
from . import config_handler_clangsa
from . import ctu_triple_arch
from .result_handler_clangsa import ResultHandlerClangSA

LOG = get_logger('analyzer')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
import re
import subprocess

from libcodechecker.analyze import host_check
from libcodechecker.analyze.analyzers.analyzer_clang_tidy import ClangTidy
from libcodechecker.analyze.analyzers.analyzer_clangsa import ClangSA
from libcodechecker.env import get_check_env
from libcodechecker.logger import get_logger

from .. import host_check

from .analyzer_clang_tidy import ClangTidy
from .analyzer_clangsa import ClangSA

LOG = get_logger('analyzer')

supported_analyzers = {ClangSA.ANALYZER_NAME: ClangSA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
import re
import shlex

from libcodechecker.analyze.analyzers import config_handler
from libcodechecker.logger import get_logger

from . import config_handler

LOG = get_logger('analyzer.tidy')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import re

from libcodechecker.analyze.analyzers import config_handler
from libcodechecker.logger import get_logger

from . import config_handler

LOG = get_logger('analyzer.clangsa')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import shlex

from libcodechecker.analyze.analyzers import analyzer_base
from libcodechecker.analyze.analyzer_env import\
extend_analyzer_cmd_with_resource_dir
from ..analyzer_env import extend_analyzer_cmd_with_resource_dir

from . import analyzer_base


def get_compile_command(action, config, source='', output=''):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
from __future__ import absolute_import

from libcodechecker import report
from libcodechecker.analyze import tidy_output_converter
from libcodechecker.analyze.analyzers.result_handler_base \
import ResultHandler
from libcodechecker.logger import get_logger

from .. import tidy_output_converter

from .result_handler_base import ResultHandler

LOG = get_logger('report')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from __future__ import absolute_import

from libcodechecker import report
from libcodechecker.analyze.analyzers.result_handler_base \
import ResultHandler
from libcodechecker.logger import get_logger

from .result_handler_base import ResultHandler

LOG = get_logger('report')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import shutil
import tempfile

from libcodechecker.analyze.analyzers import analyzer_base
from libcodechecker.analyze.analyzers import ctu_triple_arch
from libcodechecker.logger import get_logger

from .analyzers import analyzer_base
from .analyzers import ctu_triple_arch

LOG = get_logger('analyzer')


Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 11672e5

Please sign in to comment.