summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/linux
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/linux')
-rwxr-xr-xcmake/scripts/linux/clang-check-test.sh.in24
-rwxr-xr-xcmake/scripts/linux/cppcheck-test.sh.in28
2 files changed, 52 insertions, 0 deletions
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 @@
1#!/bin/bash
2
3# This script performs a single analysis using clang-check
4# It is used by the 'make test' target in the buildsystems
5# Usually you should use 'ctest -C clang-check' rather than calling this script directly
6#
7# Parameters: $1 = Application binary
8# $2 = Source file to process
9
10clangcheck_cmd=$1
11source_file=$2
12
13tmpfil=`mktemp`
14$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil
15nerr=`cat $tmpfil | grep -v "warning: /usr/bin/c++: 'linker' input unused" | wc -l`
16if test $nerr -gt 0
17then
18 cat $tmpfil
19 rm $tmpfil
20 exit 1
21fi
22
23rm $tmpfil
24exit 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 @@
1#!/bin/bash
2
3# This script performs a single analysis using cppcheck
4# It is used by the 'make test' target in the buildsystems
5# Usually you should use 'ctest -C cppcheck' rather than calling this script directly
6#
7# Parameters: $1 = Application binary
8# $2 = Source file to process
9# $3..$N = include path parameters (-I dir1 -I dir2 ...)
10
11cppcheck_cmd=$1
12source_file=$2
13shift 2
14
15tmpfil=`mktemp`
16$cppcheck_cmd $@ --force --enable=all --suppress=unusedFunction $source_file &> $tmpfil
17nmatch=`cat $tmpfil | grep "\[.*\]" | wc -l`
18nnone=`cat $tmpfil | grep "\[\\*]" | wc -l`
19let "nval=$nmatch-$nnone"
20if test $nval -gt 0
21then
22 cat $tmpfil
23 rm $tmpfil
24 exit 1
25fi
26
27rm $tmpfil
28exit 0