debug: fix cut and paste bug in print
[smatch.git] / smatch_scripts / test_kernel.sh
blobbe8b6327eee478c94d8095c0194aea0760ae9868
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 cp $SCRIPT_DIR/../smatch $SCRIPT_DIR/../bak.smatch
20 CMD=$SCRIPT_DIR/../bak.smatch
21 elif which smatch | grep smatch > /dev/null ; then
22 CMD=smatch
23 else
24 echo "Smatch binary not found."
25 exit 1
28 make clean
29 find -name \*.c.smatch -exec rm \{\} \;
30 make -j${NR_CPU} -k CHECK="$CMD -p=kernel --file-output $*" \
31 C=1 bzImage modules 2>&1 | tee compile.warns
32 find -name \*.c.smatch -exec cat \{\} \; > warns.txt