[kernel-build 2/2] kernel: forward build failures

Norbert Manthey <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
In case the kernel build fails, the calling tool chain should also
return with a non-zero exit code, to indicate that the currently used
tool chain is broken. This change allows to forward the exit code
accordingly.

Signed-off-by: Norbert Manthey <[email protected]>

---
 smatch_scripts/build_kernel_data.sh | 4 +++-
 smatch_scripts/test_kernel.sh       | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/smatch_scripts/build_kernel_data.sh b/smatch_scripts/build_kernel_data.sh
--- a/smatch_scripts/build_kernel_data.sh
+++ b/smatch_scripts/build_kernel_data.sh
@@ -35,7 +35,8 @@ if [ ! -e smatch_db.sqlite ] ; then
     fi
 fi
 
-$SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR
+BUILD_STATUS=0
+$SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR || BUILD_STATUS=$?
 
 for i in $SCRIPT_DIR/gen_* ; do
 	$i smatch_warns.txt -p=kernel
@@ -45,3 +46,4 @@ mv ${PROJECT}.* $DATA_DIR
 
 $DATA_DIR/db/create_db.sh -p=kernel smatch_warns.txt
 
+exit $BUILD_STATUS
diff --git a/smatch_scripts/test_kernel.sh b/smatch_scripts/test_kernel.sh
--- a/smatch_scripts/test_kernel.sh
+++ b/smatch_scripts/test_kernel.sh
@@ -60,8 +60,10 @@ make clean
 find -name \*.c.smatch -exec rm \{\} \;
 make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output --succeed $*" \
 	C=1 $BUILD_PARAM $TARGET 2>&1 | tee $LOG
+BUILD_STATUS=${PIPESTATUS[0]}
 find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > $WLOG
 find -name \*.c.smatch.sql -exec cat \{\} \; -exec rm \{\} \; > $WLOG.sql
 find -name \*.c.smatch.caller_info -exec cat \{\} \; -exec rm \{\} \; > $WLOG.caller_info
 
-echo "Done.  The warnings are saved to $WLOG"
+echo "Done. Build with status $BUILD_STATUS. The warnings are saved to $WLOG"
+exit $BUILD_STATUS
-- 
2.7.4




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.