|
@@ -46,8 +46,9 @@ function do_sparse()
|
|
|
make sparse || exit 1
|
|
|
sudo make INST_PROGRAMS=sparse PREFIX=/usr install || exit 1
|
|
|
popd
|
|
|
+ local SPARSE=$(which sparse)
|
|
|
|
|
|
- make -C examples C=2 2> sparse.log
|
|
|
+ make -C examples C=2 CHECK="$SPARSE" 2> sparse.log
|
|
|
|
|
|
local WARNING_COUNT=$(cat sparse.log | egrep -c " warning:" )
|
|
|
local ERROR_COUNT=$(cat sparse.log | egrep -c " error:" )
|
|
@@ -81,7 +82,33 @@ function do_gcc()
|
|
|
make -C examples CONFIG_STATUS_CHECK_GCC=y STATUS_CHECK_GCC=$GCC clean
|
|
|
}
|
|
|
|
|
|
+function do_smatch()
|
|
|
+{
|
|
|
+ wget -q https://repo.or.cz/smatch.git/snapshot/refs/heads/master.tar.gz
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ echo "Failed to download smatch."
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ tar -xzf master.tar.gz
|
|
|
+ pushd smatch-master-*
|
|
|
+ make smatch || exit 1
|
|
|
+ local SMATCH=$(pwd)/smatch
|
|
|
+ popd
|
|
|
+
|
|
|
+ make -C examples C=2 CHECK="$SMATCH -p=kernel" > smatch.log
|
|
|
+ local WARNING_COUNT=$(cat smatch.log | egrep -c " warn:" )
|
|
|
+ local ERROR_COUNT=$(cat smatch.log | egrep -c " error:" )
|
|
|
+ local COUNT=`expr $WARNING_COUNT + $ERROR_COUNT`
|
|
|
+ if [ $COUNT -gt 0 ]; then
|
|
|
+ echo "Smatch failed: $WARNING_COUNT warning(s), $ERROR_COUNT error(s)"
|
|
|
+ cat smatch.log | grep "warn:\|error:"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ make -C examples clean
|
|
|
+}
|
|
|
+
|
|
|
do_cppcheck
|
|
|
do_sparse
|
|
|
do_gcc
|
|
|
+do_smatch
|
|
|
exit 0
|