From 86b22151f0758311fd146ff508e7254337414bc1 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 15 Aug 2017 17:40:26 +0200 Subject: sync with upstream --- cmake/scripts/linux/clang-check-test.sh.in | 24 ++++++++++++++++++++++++ cmake/scripts/linux/cppcheck-test.sh.in | 28 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 cmake/scripts/linux/clang-check-test.sh.in create mode 100755 cmake/scripts/linux/cppcheck-test.sh.in (limited to 'cmake/scripts/linux') diff --git a/cmake/scripts/linux/clang-check-test.sh.in b/cmake/scripts/linux/clang-check-test.sh.in new file mode 100755 index 0000000..3b30ec1 --- /dev/null +++ b/cmake/scripts/linux/clang-check-test.sh.in @@ -0,0 +1,24 @@ +#!/bin/bash + +# This script performs a single analysis using clang-check +# It is used by the 'make test' target in the buildsystems +# Usually you should use 'ctest -C clang-check' rather than calling this script directly +# +# Parameters: $1 = Application binary +# $2 = Source file to process + +clangcheck_cmd=$1 +source_file=$2 + +tmpfil=`mktemp` +$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil +nerr=`cat $tmpfil | grep -v "warning: /usr/bin/c++: 'linker' input unused" | wc -l` +if test $nerr -gt 0 +then + cat $tmpfil + rm $tmpfil + exit 1 +fi + +rm $tmpfil +exit 0 diff --git a/cmake/scripts/linux/cppcheck-test.sh.in b/cmake/scripts/linux/cppcheck-test.sh.in new file mode 100755 index 0000000..08cb672 --- /dev/null +++ b/cmake/scripts/linux/cppcheck-test.sh.in @@ -0,0 +1,28 @@ +#!/bin/bash + +# This script performs a single analysis using cppcheck +# It is used by the 'make test' target in the buildsystems +# Usually you should use 'ctest -C cppcheck' rather than calling this script directly +# +# Parameters: $1 = Application binary +# $2 = Source file to process +# $3..$N = include path parameters (-I dir1 -I dir2 ...) + +cppcheck_cmd=$1 +source_file=$2 +shift 2 + +tmpfil=`mktemp` +$cppcheck_cmd $@ --force --enable=all --suppress=unusedFunction $source_file &> $tmpfil +nmatch=`cat $tmpfil | grep "\[.*\]" | wc -l` +nnone=`cat $tmpfil | grep "\[\\*]" | wc -l` +let "nval=$nmatch-$nnone" +if test $nval -gt 0 +then + cat $tmpfil + rm $tmpfil + exit 1 +fi + +rm $tmpfil +exit 0 -- cgit v1.2.3