diff --git a/docker/code-analysis/Dockerfile b/docker/code-analysis/Dockerfile index fcf06467a3210aea0ab935f1b8791f0169ae6ae8..3eb95bd635bff8ea1d053c00812c7d82b7a0c95b 100644 --- a/docker/code-analysis/Dockerfile +++ b/docker/code-analysis/Dockerfile @@ -245,7 +245,7 @@ RUN cd /opt/dev && \ ENV PATH /infer/bin:${PATH} # Install python ubus module and valgrind-ci -RUN pip3 install ubus ValgrindCI +RUN pip3 install ubus ValgrindCI codechecker WORKDIR /builds/iopsys/ diff --git a/docker/code-analysis/more_test.sh b/docker/code-analysis/more_test.sh index c66692d3df137d8bef1b93b8d7a12a035d09ad91..4ca71d016fa849dc108edbc328b9d2ed91af2b24 100755 --- a/docker/code-analysis/more_test.sh +++ b/docker/code-analysis/more_test.sh @@ -2,7 +2,7 @@ log() { - echo "# $* ..." + echo "# $* #" } exec_cmd() @@ -33,9 +33,16 @@ generate_compilation_db() run_cppcheck_validation() { if [ -f "compile_commands.json" ]; then - exec_cmd cppcheck --error-exitcode=1 --addon=threadsafety --addon=cert --inline-suppr ${CPPCHECK_OPTIONS} --project=compile_commands.json + exec_cmd cppcheck --error-exitcode=1 --addon=threadsafety --addon=cert -i ./test --inline-suppr ${CPPCHECK_OPTIONS} --project=compile_commands.json else - exec_cmd cppcheck --error-exitcode=1 --addon=threadsafety --addon=cert --inline-suppr ${CPPCHECK_OPTIONS} ${SOURCE_FOLDER} + exec_cmd cppcheck --error-exitcode=1 --addon=threadsafety --addon=cert -i ./test --inline-suppr ${CPPCHECK_OPTIONS} ${SOURCE_FOLDER} + fi +} + +run_cppcheck_clang_validation() +{ + if [ -f "compile_commands.json" ]; then + exec_cmd cppcheck --error-exitcode=1 --clang -i ./test --inline-suppr ${CPPCHECK_OPTIONS} --project=compile_commands.json fi } @@ -53,6 +60,7 @@ main() # Install pre-req if present/defined if [ -f "./gitlab-ci/install-dependencies.sh" ]; then + log "Installing prerequisites for compilation" exec_cmd ./gitlab-ci/install-dependencies.sh fi @@ -60,11 +68,13 @@ main() generate_compilation_db # TODO: Run gcc fanalyzer analysis - # TODO: Run clag analysis # Run cppcheck with compilation-db run_cppcheck_validation + # Run clag analysis + run_cppcheck_clang_validation + # Run infer analysis run_infer_analysis }