Print this page
11506 smatch resync
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/smatch_scripts/test_kernel.sh
+++ new/usr/src/tools/smatch/src/smatch_scripts/test_kernel.sh
1 1 #!/bin/bash
2 2
3 3 NR_CPU=$(cat /proc/cpuinfo | grep ^processor | wc -l)
4 4 TARGET="bzImage modules"
5 5 WLOG="smatch_warns.txt"
6 6 LOG="smatch_compile.warns"
7 7 function usage {
8 8 echo
9 9 echo "Usage: $0 [smatch options]"
10 10 echo "Compiles the kernel with -j${NR_CPU}"
11 11 echo " available options:"
12 12 echo " --endian : enable endianess check"
13 13 echo " --target {TARGET} : specify build target, default: $TARGET"
14 14 echo " --log {FILE} : Output compile log to file, default is: $LOG"
15 15 echo " --wlog {FILE} : Output warnigs to file, default is: $WLOG"
16 16 echo " --help : Show this usage"
17 17 exit 1
18 18 }
19 19
20 20
21 21 while true ; do
22 22 if [[ "$1" == "--endian" ]] ; then
23 23 ENDIAN="CF=-D__CHECK_ENDIAN__"
24 24 shift
25 25 elif [[ "$1" == "--target" ]] ; then
26 26 shift
27 27 TARGET="$1"
28 28 shift
29 29 elif [[ "$1" == "--log" ]] ; then
30 30 shift
31 31 LOG="$1"
32 32 shift
33 33 elif [[ "$1" == "--wlog" ]] ; then
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
34 34 shift
35 35 WLOG="$1"
36 36 shift
37 37 elif [[ "$1" == "--help" ]] ; then
38 38 usage
39 39 else
40 40 break
41 41 fi
42 42 done
43 43
44 +# receive parameters from environment, which override
45 +[ -z "${SMATCH_ENV_TARGET:-}" ] || TARGET="$SMATCH_ENV_TARGET"
46 +[ -z "${SMATCH_ENV_BUILD_PARAM:-}" ] || BUILD_PARAM="$SMATCH_ENV_BUILD_PARAM"
47 +
44 48 SCRIPT_DIR=$(dirname $0)
45 49 if [ -e $SCRIPT_DIR/../smatch ] ; then
46 50 cp $SCRIPT_DIR/../smatch $SCRIPT_DIR/../bak.smatch
47 51 CMD=$SCRIPT_DIR/../bak.smatch
48 52 elif which smatch | grep smatch > /dev/null ; then
49 53 CMD=smatch
50 54 else
51 55 echo "Smatch binary not found."
52 56 exit 1
53 57 fi
54 58
55 59 make clean
56 60 find -name \*.c.smatch -exec rm \{\} \;
57 61 make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output --succeed $*" \
58 - C=1 $TARGET 2>&1 | tee $LOG
62 + C=1 $BUILD_PARAM $TARGET 2>&1 | tee $LOG
63 +BUILD_STATUS=${PIPESTATUS[0]}
59 64 find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > $WLOG
60 65 find -name \*.c.smatch.sql -exec cat \{\} \; -exec rm \{\} \; > $WLOG.sql
61 66 find -name \*.c.smatch.caller_info -exec cat \{\} \; -exec rm \{\} \; > $WLOG.caller_info
62 67
63 -echo "Done. The warnings are saved to $WLOG"
68 +echo "Done. Build with status $BUILD_STATUS. The warnings are saved to $WLOG"
69 +exit $BUILD_STATUS
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX