Skip to content

Commit 7c25ee8

Browse files
committed
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 <[email protected]>
1 parent 451d2a5 commit 7c25ee8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/testing/selftests/rcutorture/bin/mkinitrd.sh

+8
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,16 @@ if echo -e "#if __x86_64__||__i386__||__i486__||__i586__||__i686__" \
7474
${CROSS_COMPILE}gcc -fno-asynchronous-unwind-tables -fno-ident \
7575
-nostdlib -include ../../../../include/nolibc/nolibc.h \
7676
-s -static -Os -o init init.c -lgcc
77+
ret=$?
7778
else
7879
${CROSS_COMPILE}gcc -s -static -Os -o init init.c
80+
ret=$?
81+
fi
82+
83+
if [ "$ret" -ne 0 ]
84+
then
85+
echo "Failed to create a statically linked C-language initrd"
86+
exit "$ret"
7987
fi
8088

8189
rm init.c

0 commit comments

Comments
 (0)