Skip to content

Commit 825fa4c

Browse files
wtarreauPaul E. McKenney
authored andcommitted
rcutorture: Check initrd/init instead of initrd only
If the build fails, we can end up with an empty initrd directory which prevents the build script from operating again. Better rely on the resulting init executable instead. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 18d7bf8 commit 825fa4c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ if [ ! -d "$D" ]; then
2828
echo >&2 "$D does not exist: Malformed kernel source tree?"
2929
exit 1
3030
fi
31-
if [ -d "$D/initrd" ]; then
32-
echo "$D/initrd already exists, no need to create it"
31+
if [ -s "$D/initrd/init" ]; then
32+
echo "$D/initrd/init already exists, no need to create it"
3333
exit 0
3434
fi
3535

@@ -65,7 +65,7 @@ then
6565
# Filesystem creation
6666
dracut --force --no-hostonly --no-hostonly-cmdline --module "base" $T/initramfs.img
6767
cd $D
68-
mkdir initrd
68+
mkdir -p initrd
6969
cd initrd
7070
zcat $T/initramfs.img | cpio -id
7171
cp $T/init init
@@ -79,7 +79,7 @@ fi
7979
# future-proof than dracut.
8080
echo "Could not find dracut, attempting C initrd"
8181
cd $D
82-
mkdir initrd
82+
mkdir -p initrd
8383
cd initrd
8484
cat > init.c << '___EOF___'
8585
#include <unistd.h>

0 commit comments

Comments
 (0)