Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ This expects to run on a jenkins instance with opm-common as the 'origin' remote

It will build and test opm-common. It can be used both for post-merge builds
of the master branch and for a github pull request builder job.

**static_analysis.sh**:
This expects to run on a jenkins instance with opm-common as the 'origin' remote.

It will run and build opm-common using various configurations, and then
run static analysis.
46 changes: 46 additions & 0 deletions jenkins/build-opm-module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,49 @@ function build_module_full {
test $? -eq 0 || exit 1
fi
}

# Run static analysis checks for a given module
# Assumes coverage_gcov, debug_iterator and clang_lto build configurations
# has been built.
# $1 - Name of main module
function run_static_analysis {
if test -d $WORKSPACE/coverage_gcov
then
pushd $WORKSPACE/coverage_gcov/build-$1
gcovr -j$TESTTHREADS --xml -r /build -o /build/coverage.xml
popd
fi

if test -d $WORKSPACE/debug_iterator
then
pushd $WORKSPACE/debug_iterator/build-$1
ninja doc
popd
fi

COMPILE_COMMANDS=$WORKSPACE/clang_lto/build-$1/compile_commands.json
if test -d $WORKSPACE/clang_lto
then
pushd $WORKSPACE
infer run \
--compilation-database $COMPILE_COMMANDS \
--keep-going \
--pmd-xml \
-j $TESTTHREADS
popd

run-clang-tidy -checks='clang-analyzer.*' \
-p $WORKSPACE/clang_lto/build-$1/ \
-j$TESTTHREADS | tee $WORKSPACE/clang-tidy-report.log

cppcheck --project=${COMPILE_COMMANDS} \
-q \
--force \
--enable=all \
--xml \
--xml-version=2 \
-i$WORKSPACE/tests/material/test_fluidmatrixinteractions.cpp \
-j$TESTTHREADS \
--output-file=$WORKSPACE/cppcheck-result.xml
fi
}
8 changes: 8 additions & 0 deletions jenkins/static_analysis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source ${TOOLCHAIN_DIR}/build-configurations-sca.sh
source `dirname $0`/build-opm-module.sh

$WORKSPACE/jenkins/build.sh

run_static_analysis opm-common