diff options
Diffstat (limited to 'test/TEST-20-NFS')
-rwxr-xr-x | test/TEST-20-NFS/client-init.sh | 13 | ||||
-rwxr-xr-x | test/TEST-20-NFS/create-root.sh | 6 | ||||
-rwxr-xr-x | test/TEST-20-NFS/test.sh | 43 |
3 files changed, 35 insertions, 27 deletions
diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh index 061a2b1..04fb6a7 100755 --- a/test/TEST-20-NFS/client-init.sh +++ b/test/TEST-20-NFS/client-init.sh @@ -20,10 +20,17 @@ echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue - echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts +# fail the test of rd.live.overlay did not worked as expected +if grep -qF 'rd.live.overlay' /proc/cmdline; then + if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then + echo "nfs-FAIL" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none + fi +fi + if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then serverip=${dev%:*} @@ -36,11 +43,11 @@ if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then echo test:nfs_fetch_url nfs::"${serverip}":"${path}"/root/fetchfile if nfs_fetch_url nfs::"${serverip}":"${path}"/root/fetchfile /run/nfsfetch.out; then echo nfsfetch-OK - echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker2 + echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker2 status=none fi else echo nfsfetch-BYPASS fstype="${fstype}" - echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker2 + echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker2 status=none fi : > /dev/watchdog diff --git a/test/TEST-20-NFS/create-root.sh b/test/TEST-20-NFS/create-root.sh index 8060b00..0518937 100755 --- a/test/TEST-20-NFS/create-root.sh +++ b/test/TEST-20-NFS/create-root.sh @@ -12,12 +12,12 @@ udevadm settle set -ex -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh index b7cca75..1be5a73 100755 --- a/test/TEST-20-NFS/test.sh +++ b/test/TEST-20-NFS/test.sh @@ -3,9 +3,13 @@ # shellcheck disable=SC2034 TEST_DESCRIPTION="root filesystem on NFS with $USE_NETWORK" +test_check() { + command -v exportfs &> /dev/null +} + # Uncomment this to debug failures #DEBUGFAIL="rd.debug loglevel=7 rd.break=initqueue rd.shell" -SERVER_DEBUG="rd.debug loglevel=7" +#SERVER_DEBUG="rd.debug loglevel=7" #SERIAL="unix:/tmp/server.sock" run_server() { @@ -14,14 +18,13 @@ run_server() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 0 1 "$testdir"/run-qemu \ "${disk_args[@]}" \ -net socket,listen=127.0.0.1:12320 \ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 @@ -55,16 +58,15 @@ client_test() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker2.img marker2 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker2.img marker2 1 cmdline="$cmdline rd.net.timeout.dhcp=30" "$testdir"/run-qemu \ "${disk_args[@]}" \ -net nic,macaddr="$mac",model=e1000 \ -net socket,connect=127.0.0.1:12320 \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=10 quiet ro console=ttyS0,115200n81 selinux=0" \ + -append "$cmdline ro" \ -initrd "$TESTDIR"/initramfs.testing # shellcheck disable=SC2181 @@ -213,8 +215,9 @@ test_run() { return 1 fi - test_nfsv3 \ - && test_nfsv4 + # focus on NFSv4 testing, disable NFSv3 tests + #test_nfsv3 + test_nfsv4 ret=$? @@ -247,7 +250,7 @@ test_setup() { ) inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping exportfs \ + dmesg mkdir cp exportfs \ modprobe rpc.nfsd rpc.mountd showmount tcpdump \ sleep mount chmod rm for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -307,7 +310,7 @@ test_setup() { ) inst_multiple sh shutdown poweroff stty cat ps ln ip dd \ - mount dmesg mkdir cp ping grep setsid ls vi less cat sync + mount dmesg mkdir cp grep setsid ls vi less cat sync for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do if [ -f "${_terminfodir}"/l/linux ]; then inst_multiple -o "${_terminfodir}"/l/linux @@ -318,7 +321,7 @@ test_setup() { inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/45url-lib/url-lib.sh" "/lib/url-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/40network/net-lib.sh" "/lib/net-lib.sh" + inst_simple "${PKGLIBDIR}/modules.d/45net-lib/net-lib.sh" "/lib/net-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/95nfs/nfs-lib.sh" "/lib/nfs-lib.sh" inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" @@ -354,7 +357,7 @@ test_setup() { export initdir=$TESTDIR/server/overlay # shellcheck disable=SC1090 . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd + inst_multiple mkfs.ext4 poweroff cp umount sync dd inst_hook initqueue 01 ./create-root.sh inst_hook initqueue/finished 01 ./finished-false.sh ) @@ -373,8 +376,8 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -398,11 +401,9 @@ test_setup() { ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth" \ - -a "dmsquash-live debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "dmsquash-live ${USE_NETWORK}" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -415,7 +416,7 @@ test_setup() { ) # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ + -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 |