From 203fa17c87a83dd2061f950abb4974d116924bc5 Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov Date: Fri, 7 Apr 2017 17:18:02 +0400 Subject: [PATCH] test_kernel.sh: add config options It would be nice to have an ability to specify check options similar to kcheck Signed-off-by: Dmitry Monakhov Signed-off-by: Dan Carpenter --- smatch_scripts/test_kernel.sh | 45 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/smatch_scripts/test_kernel.sh b/smatch_scripts/test_kernel.sh index c9a6ae50..0e111352 100755 --- a/smatch_scripts/test_kernel.sh +++ b/smatch_scripts/test_kernel.sh @@ -1,18 +1,45 @@ #!/bin/bash NR_CPU=$(cat /proc/cpuinfo | grep ^processor | wc -l) - +TARGET="bzImage modules" +WLOG="smatch_warns.txt" +LOG="smatch_compile.warns" function usage { echo echo "Usage: $0 [smatch options]" echo "Compiles the kernel with -j${NR_CPU}" - echo + echo " available options:" + echo " --endian : enable endianess check" + echo " --target {TARGET} : specify build target, default: $TARGET" + echo " --log {FILE} : Output compile log to file, default is: $LOG" + echo " --wlog {FILE} : Output warnigs to file, default is: $WLOG" + echo " --help : Show this usage" exit 1 } -if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then - usage; -fi + +while true ; do + if [[ "$1" == "--endian" ]] ; then + ENDIAN="CF=-D__CHECK_ENDIAN__" + shift + elif [[ "$1" == "--target" ]] ; then + shift + TARGET="$1" + shift + elif [[ "$1" == "--log" ]] ; then + shift + LOG="$1" + shift + elif [[ "$1" == "--wlog" ]] ; then + shift + WLOG="$1" + shift + elif [[ "$1" == "--help" ]] ; then + usage + else + break + fi +done SCRIPT_DIR=$(dirname $0) if [ -e $SCRIPT_DIR/../smatch ] ; then @@ -27,8 +54,8 @@ fi make clean find -name \*.c.smatch -exec rm \{\} \; -make -j${NR_CPU} -k CHECK="$CMD -p=kernel --file-output $*" \ - C=1 bzImage modules 2>&1 | tee smatch_compile.warns -find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > smatch_warns.txt +make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output $*" \ + C=1 $TARGET 2>&1 | tee $LOG +find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > $WLOG -echo "Done. The warnings are saved to smatch_warns.txt" +echo "Done. The warnings are saved to $WLOG" -- 2.11.4.GIT