From 068531232b994ef93b3245484987df1cf1504dd0 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 8 Aug 2014 13:34:04 +0200 Subject: [PATCH] test: make testsuite work with the new systemd minimal root req systemd needs more directories to switch root --- test/TEST-01-BASIC/test.sh | 9 ++++++++- test/TEST-02-SYSTEMD/test.sh | 10 +++++++++- test/TEST-03-USR-MOUNT/test.sh | 9 ++++++++- test/TEST-10-RAID/test.sh | 9 ++++++++- test/TEST-11-LVM/test.sh | 10 +++++++++- test/TEST-12-RAID-DEG/test.sh | 9 ++++++++- test/TEST-13-ENC-RAID-LVM/test.sh | 10 +++++++++- test/TEST-14-IMSM/test.sh | 9 ++++++++- test/TEST-15-BTRFSRAID/test.sh | 10 +++++++++- test/TEST-16-DMSQUASH/test.sh | 9 ++++++++- test/TEST-17-LVM-THIN/test.sh | 10 +++++++++- test/TEST-30-ISCSI/test.sh | 10 +++++++++- test/TEST-40-NBD/test.sh | 25 ++++++++++++++++++++++--- test/TEST-50-MULTINIC/client-init.sh | 7 ++++--- test/TEST-50-MULTINIC/test.sh | 18 +++++++++++------- 15 files changed, 139 insertions(+), 25 deletions(-) diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index f857fd4..6c8f1a6 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -30,6 +30,14 @@ test_setup() { export initdir=$TESTDIR/overlay/source mkdir -p $initdir . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient \ umount strace less setsid @@ -43,7 +51,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh index cc9da27..3eac744 100755 --- a/test/TEST-02-SYSTEMD/test.sh +++ b/test/TEST-02-SYSTEMD/test.sh @@ -26,6 +26,15 @@ test_setup() { export initdir=$TESTDIR/overlay/source mkdir -p $initdir . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient \ umount strace less setsid @@ -39,7 +48,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh index b3d709e..2a0cd8e 100755 --- a/test/TEST-03-USR-MOUNT/test.sh +++ b/test/TEST-03-USR-MOUNT/test.sh @@ -57,6 +57,14 @@ test_setup() { export initdir=$TESTDIR/overlay/source mkdir -p $initdir . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient \ umount strace less setsid @@ -71,7 +79,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh index b17e912..2a420f5 100755 --- a/test/TEST-10-RAID/test.sh +++ b/test/TEST-10-RAID/test.sh @@ -27,8 +27,15 @@ test_setup() { # Create what will eventually be our root filesystem onto an overlay ( export initdir=$TESTDIR/overlay/source - (mkdir -p "$initdir"; cd "$initdir"; mkdir -p dev sys proc etc var/run tmp run) . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh index 6f2461c..44a4c9c 100755 --- a/test/TEST-11-LVM/test.sh +++ b/test/TEST-11-LVM/test.sh @@ -25,6 +25,15 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -37,7 +46,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc mkdir $initdir/run sudo ldconfig -r "$initdir" diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh index dfcf3dc..00ff4bc 100755 --- a/test/TEST-12-RAID-DEG/test.sh +++ b/test/TEST-12-RAID-DEG/test.sh @@ -67,6 +67,14 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -79,7 +87,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh index 5102142..55968a1 100755 --- a/test/TEST-13-ENC-RAID-LVM/test.sh +++ b/test/TEST-13-ENC-RAID-LVM/test.sh @@ -63,6 +63,15 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -75,7 +84,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh index 9353a92..53cca27 100755 --- a/test/TEST-14-IMSM/test.sh +++ b/test/TEST-14-IMSM/test.sh @@ -55,6 +55,14 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -67,7 +75,6 @@ test_setup() { inst_multiple grep inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc mkdir $initdir/run sudo ldconfig -r "$initdir" diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh index 3fc1d45..2752e86 100755 --- a/test/TEST-15-BTRFSRAID/test.sh +++ b/test/TEST-15-BTRFSRAID/test.sh @@ -27,6 +27,15 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -39,7 +48,6 @@ test_setup() { inst ./test-init.sh /sbin/init inst_simple /etc/os-release find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh index 252e845..036cf58 100755 --- a/test/TEST-16-DMSQUASH/test.sh +++ b/test/TEST-16-DMSQUASH/test.sh @@ -49,6 +49,14 @@ test_setup() { ( export initdir="$TESTDIR"/root-source . "$basedir"/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient \ umount strace less @@ -67,7 +75,6 @@ test_setup() { inst "$TESTDIR"/initramfs.testing "/boot/initramfs-$KVERSION.img" inst /boot/vmlinuz-"$KVERSION" find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p -- dev sys proc etc var/run tmp ) cp -a -- /etc/ld.so.conf* "$initdir"/etc sudo ldconfig -r -- "$initdir" ) diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh index 0cfce19..af6fac3 100755 --- a/test/TEST-17-LVM-THIN/test.sh +++ b/test/TEST-17-LVM-THIN/test.sh @@ -25,6 +25,15 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ mount dmesg ifconfig dhclient mkdir cp ping dhclient for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -37,7 +46,6 @@ test_setup() { inst_simple /etc/os-release inst ./test-init.sh /sbin/init find_binary plymouth >/dev/null && inst_multiple plymouth - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc mkdir $initdir/run sudo ldconfig -r "$initdir" diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh index f597783..d3f59c9 100755 --- a/test/TEST-30-ISCSI/test.sh +++ b/test/TEST-30-ISCSI/test.sh @@ -105,6 +105,15 @@ test_setup() { ( export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh + ( + cd "$initdir" + mkdir -p -- dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + mkdir -p -- var/lib/nfs/rpc_pipefs + ) inst_multiple sh shutdown poweroff stty cat ps ln ip \ mount dmesg mkdir cp ping grep for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -113,7 +122,6 @@ test_setup() { inst_multiple -o ${_terminfodir}/l/linux inst_simple /etc/os-release inst ./client-init.sh /sbin/init - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) cp -a /etc/ld.so.conf* $initdir/etc sudo ldconfig -r "$initdir" ) diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh index 7cf64b1..3bc0dad 100755 --- a/test/TEST-40-NBD/test.sh +++ b/test/TEST-40-NBD/test.sh @@ -6,7 +6,7 @@ TEST_DESCRIPTION="root filesystem on NBD" KVERSION=${KVERSION-$(uname -r)} # Uncomment this to debug failures -#DEBUGFAIL="rd.shell rd.retry=10 rd.break" +#DEBUGFAIL="rd.shell rd.break" #SERIAL="udp:127.0.0.1:9999" SERIAL="null" @@ -197,7 +197,13 @@ make_encrypted_root() { export initdir=$TESTDIR/overlay/source . $basedir/dracut-functions.sh mkdir -p "$initdir" - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) + ( + cd "$initdir"; mkdir -p dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \ mount dmesg mkdir cp ping for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -215,6 +221,13 @@ make_encrypted_root() { ( export initdir=$TESTDIR/overlay . $basedir/dracut-functions.sh + ( + cd "$initdir"; mkdir -p dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple mke2fs poweroff cp umount tune2fs inst_hook emergency 000 ./hard-off.sh inst_hook initqueue 01 ./create-root.sh @@ -255,7 +268,13 @@ make_client_root() { export initdir=$TESTDIR/mnt . $basedir/dracut-functions.sh mkdir -p "$initdir" - (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) + ( + cd "$initdir"; mkdir -p dev sys proc etc var/run tmp + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ dmesg mkdir cp ping for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh index 13affc4..3f3e079 100755 --- a/test/TEST-50-MULTINIC/client-init.sh +++ b/test/TEST-50-MULTINIC/client-init.sh @@ -10,9 +10,10 @@ export PS1='initramfs-test:\w\$ ' stty sane echo "made it to the rootfs! Powering down." for i in /run/initramfs/net.*.did-setup; do - strglobin "$i" ":*:*:*:*:" && continue - i=${i%.did-setup} - IFACES+="${i##*/net.} " + [ -f "$i" ] || continue + strglobin "$i" ":*:*:*:*:" && continue + i=${i%.did-setup} + IFACES+="${i##*/net.} " done { echo "OK" diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh index add849c..fa4d692 100755 --- a/test/TEST-50-MULTINIC/test.sh +++ b/test/TEST-50-MULTINIC/test.sh @@ -6,7 +6,7 @@ TEST_DESCRIPTION="root filesystem on NFS with multiple nics" KVERSION=${KVERSION-$(uname -r)} # Uncomment this to debug failures -#DEBUGFAIL="rd.shell" +#DEBUGFAIL="rd.shell rd.break" #SERIAL="tcp:127.0.0.1:9999" run_server() { @@ -154,7 +154,7 @@ test_setup() { ( cd "$initdir"; - mkdir -p -- dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind} + mkdir -p -- dev sys proc run var/run etc tmp var/lib/{dhcpd,rpcbind} mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs} chmod 777 -- var/lib/rpcbind var/lib/nfs ) @@ -217,6 +217,15 @@ test_setup() { ( export initdir="$TESTDIR"/mnt/nfs/client . "$basedir"/dracut-functions.sh + ( + cd "$initdir" + mkdir -p dev sys proc etc run + mkdir -p var/lib/nfs/rpc_pipefs + mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin + for i in bin sbin lib lib64; do + ln -sfnr usr/$i $i + done + ) inst_multiple sh shutdown poweroff stty cat ps ln ip \ mount dmesg mkdir cp ping grep ls for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -225,11 +234,6 @@ test_setup() { inst_multiple -o "${_terminfodir}"/l/linux inst_simple /etc/os-release inst ./client-init.sh /sbin/init - ( - cd "$initdir" - mkdir -p -- dev sys proc etc run - mkdir -p -- var/lib/nfs/rpc_pipefs - ) inst /etc/nsswitch.conf /etc/nsswitch.conf inst /etc/passwd /etc/passwd inst /etc/group /etc/group