All of lore.kernel.org
 help / color / mirror / Atom feed
* [kernel-build 1/2] kernel: modify build via env
@ 2019-05-09  8:07 Norbert Manthey
  2019-05-09  8:07 ` [kernel-build 2/2] kernel: forward build failures Norbert Manthey
  0 siblings, 1 reply; 4+ messages in thread
From: Norbert Manthey @ 2019-05-09  8:07 UTC (permalink / raw)
  To: smatch; +Cc: Marius Hillenbrand, David Woodhouse, Dan Carpenter,
	Norbert Manthey

For certain kernel builds, additional parameter might be specified
that are not picked up by the build system of the kernel via the
environment. This change allows to modify the build target, as well
as extra build arguments for the kernel build.

The following two environment variables are used to control this
behaviour. The value of the target variable is overriden in case
the environment variable is specified.

SMATCH_ENV_TARGET target to be build
SMATCH_ENV_BUILD_PARAM other parameters to be forwarded to make

Signed-off-by: Norbert Manthey <nmanthey@amazon.de>

---
 smatch_scripts/test_kernel.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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
@@ -41,6 +41,10 @@ while true ; do
     fi
 done
 
+# receive parameters from environment, which override
+[ -z "${SMATCH_ENV_TARGET:-}" ] || TARGET="$SMATCH_ENV_TARGET"
+[ -z "${SMATCH_ENV_BUILD_PARAM:-}" ] || BUILD_PARAM="$SMATCH_ENV_BUILD_PARAM"
+
 SCRIPT_DIR=$(dirname $0)
 if [ -e $SCRIPT_DIR/../smatch ] ; then
     cp $SCRIPT_DIR/../smatch $SCRIPT_DIR/../bak.smatch
@@ -55,7 +59,7 @@ fi
 make clean
 find -name \*.c.smatch -exec rm \{\} \;
 make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output --succeed $*" \
-	C=1 $TARGET 2>&1 | tee $LOG
+	C=1 $BUILD_PARAM $TARGET 2>&1 | tee $LOG
 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
-- 
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [kernel-build 2/2] kernel: forward build failures
  2019-05-09  8:07 [kernel-build 1/2] kernel: modify build via env Norbert Manthey
@ 2019-05-09  8:07 ` Norbert Manthey
  2019-05-09  9:34   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Norbert Manthey @ 2019-05-09  8:07 UTC (permalink / raw)
  To: smatch; +Cc: Marius Hillenbrand, David Woodhouse, Dan Carpenter,
	Norbert Manthey

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 <nmanthey@amazon.de>

---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kernel-build 2/2] kernel: forward build failures
  2019-05-09  8:07 ` [kernel-build 2/2] kernel: forward build failures Norbert Manthey
@ 2019-05-09  9:34   ` Dan Carpenter
  2019-05-09 10:03     ` Norbert Manthey
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2019-05-09  9:34 UTC (permalink / raw)
  To: Norbert Manthey; +Cc: smatch, Marius Hillenbrand, David Woodhouse

Thanks!

I've applied both.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kernel-build 2/2] kernel: forward build failures
  2019-05-09  9:34   ` Dan Carpenter
@ 2019-05-09 10:03     ` Norbert Manthey
  0 siblings, 0 replies; 4+ messages in thread
From: Norbert Manthey @ 2019-05-09 10:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: smatch, Marius Hillenbrand, David Woodhouse

Thanks!

Best,
Norbert

On 5/9/19 11:34, Dan Carpenter wrote:
> Thanks!
>
> I've applied both.
>
> regards,
> dan carpenter
>



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-09 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09  8:07 [kernel-build 1/2] kernel: modify build via env Norbert Manthey
2019-05-09  8:07 ` [kernel-build 2/2] kernel: forward build failures Norbert Manthey
2019-05-09  9:34   ` Dan Carpenter
2019-05-09 10:03     ` Norbert Manthey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.