torture: Cause mkinitrd.sh to indicate failure on compile errors

Currently, if the C program created by mkinitrd.sh has compile errors,
the errors are printed, but kvm.sh soldiers on, building kernels that
have init-less initrd setups.  The kernels then fail on boot when they
attempt to mount non-existent root filesystems.

This commit therefore improves user friendliness by making mkinitrd.sh
return non-zero exit status on compile errors, which in turn causes kvm.sh
to take an early exit, with the compile errors still clearly visible.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Paul E. McKenney 2023-07-13 18:29:36 -07:00
parent 451d2a52f6
commit 7c25ee819f
1 changed files with 8 additions and 0 deletions

View File

@ -74,8 +74,16 @@ if echo -e "#if __x86_64__||__i386__||__i486__||__i586__||__i686__" \
${CROSS_COMPILE}gcc -fno-asynchronous-unwind-tables -fno-ident \
-nostdlib -include ../../../../include/nolibc/nolibc.h \
-s -static -Os -o init init.c -lgcc
ret=$?
else
${CROSS_COMPILE}gcc -s -static -Os -o init init.c
ret=$?
fi
if [ "$ret" -ne 0 ]
then
echo "Failed to create a statically linked C-language initrd"
exit "$ret"
fi
rm init.c