new: smatch_scripts/test_kernel.sh
[smatch.git] / smatch_scripts / test_kernel.sh
blob43d05ec0046fb36f748a372b7c95a33125c6cb79
1 #!/bin/bash
3 NR_CPU=$(cat /proc/cpuinfo | grep ^processor | wc -l)
5 function usage {
6 echo
7 echo "Usage: $0 [smatch options]"
8 echo "Compiles the kernel with -j${NR_CPU}"
9 echo
10 exit 1
13 if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
14 usage;
17 SCRIPT_DIR=$(dirname $0)
18 if [ -e $SCRIPT_DIR/../smatch ] ; then
19 CMD=$SCRIPT_DIR/../smatch
20 elif which smatch | grep smatch > /dev/null ; then
21 CMD=smatch
22 else
23 echo "Smatch binary not found."
24 exit 1
27 make clean
28 find -name \*.c.smatch -exec rm \{\} \;
29 make -j${NR_CPU} -k CHECK="$CMD -p=kernel --file-output $*" \
30 C=1 bzImage modules 2>&1 | tee compile.warns
31 find -name \*.c.smatch -exec cat \{\} \; > warns.txt