diff options
Diffstat (limited to '')
94 files changed, 917 insertions, 1730 deletions
diff --git a/test/Makefile b/test/Makefile index dfaa450..518e7d6 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,6 @@ .PHONY: all check clean $(wildcard TEST-??-*) $(wildcard TEST-??-*): - @[ "$(shell id -u)" = 0 ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } @{ \ [ -d $@ ] || exit 0; \ [ -f $@/Makefile ] || exit 0; \ diff --git a/test/TEST-01-BASIC/create-root.sh b/test/TEST-01-BASIC/create-root.sh index 633b11f..0fe0f67 100755 --- a/test/TEST-01-BASIC/create-root.sh +++ b/test/TEST-01-BASIC/create-root.sh @@ -12,11 +12,11 @@ udevadm settle set -ex -mkfs.ext4 -L ' rdinit=/bin/sh' /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L ' rdinit=/bin/sh' /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 status=none of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker poweroff -f diff --git a/test/TEST-01-BASIC/test-init.sh b/test/TEST-01-BASIC/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-01-BASIC/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index b3a8656..252c3f9 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -8,14 +8,13 @@ TEST_DESCRIPTION="root filesystem on a ext4 filesystem" test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot \"root=LABEL= rdinit=/bin/sh\" rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \ + -append 'rw "root=LABEL= rdinit=/bin/sh" rd.retry=3' \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 @@ -23,12 +22,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -36,19 +31,16 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() 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"/root.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 80 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -59,12 +51,9 @@ test_setup() { rm -- "$TESTDIR"/marker.img # make sure --omit-drivers does not filter out drivers using regexp to test for an earlier regression (assuming there is no one letter linux kernel module needed to run the test) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test watchdog" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod i6300esb ib700wdt" \ + test_dracut \ --omit-drivers 'a b c d e f g h i j k l m n o p q r s t u v w x y z' \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-02-SYSTEMD/create-root.sh b/test/TEST-02-SYSTEMD/create-root.sh index c1fbe76..5f82ac3 100755 --- a/test/TEST-02-SYSTEMD/create-root.sh +++ b/test/TEST-02-SYSTEMD/create-root.sh @@ -11,11 +11,11 @@ udevadm control --reload set -e udevadm settle -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 poweroff -f diff --git a/test/TEST-02-SYSTEMD/test-init.sh b/test/TEST-02-SYSTEMD/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-02-SYSTEMD/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh index 40d1b3e..4d48fd2 100755 --- a/test/TEST-02-SYSTEMD/test.sh +++ b/test/TEST-02-SYSTEMD/test.sh @@ -11,13 +11,13 @@ test_check() { test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=dracut rw systemd.log_target=console rd.retry=3 init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 @@ -25,12 +25,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -38,9 +34,8 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ @@ -49,8 +44,8 @@ test_setup() { declare -a disk_args=() 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"/root.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 80 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -62,14 +57,11 @@ test_setup() { # systemd-analyze.sh calls man indirectly # make the man command succeed always - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test systemd" \ - -o "network kernel-network-modules" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + test_dracut \ + -a "systemd" \ -i ./systemd-analyze.sh /lib/dracut/hooks/pre-pivot/00-systemd-analyze.sh \ -i "/bin/true" "/usr/bin/man" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-03-USR-MOUNT/create-root.sh b/test/TEST-03-USR-MOUNT/create-root.sh index 411fa99..734f377 100755 --- a/test/TEST-03-USR-MOUNT/create-root.sh +++ b/test/TEST-03-USR-MOUNT/create-root.sh @@ -12,22 +12,22 @@ set -e udevadm settle modprobe btrfs || : -mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root -mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr -btrfs device scan /dev/disk/by-id/ata-disk_root -btrfs device scan /dev/disk/by-id/ata-disk_usr +mkfs.btrfs -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +mkfs.btrfs -q -L dracutusr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr mkdir -p /root -mount -t btrfs /dev/disk/by-id/ata-disk_root /root +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root [ -d /root/usr ] || mkdir -p /root/usr -mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr btrfs subvolume create /root/usr/usr umount /root/usr -mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs -o subvol=usr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr cp -a -t /root /source/* mkdir -p /root/run btrfs filesystem sync /root/usr btrfs filesystem sync /root umount /root/usr 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 poweroff -f diff --git a/test/TEST-03-USR-MOUNT/fstab b/test/TEST-03-USR-MOUNT/fstab index feac57a..114f945 100644 --- a/test/TEST-03-USR-MOUNT/fstab +++ b/test/TEST-03-USR-MOUNT/fstab @@ -1,2 +1,2 @@ -/dev/disk/by-id/ata-disk_root / btrfs defaults 0 0 -/dev/disk/by-id/ata-disk_usr /usr btrfs subvol=usr,ro 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root / btrfs defaults 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /usr btrfs subvol=usr,ro 0 0 diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-03-USR-MOUNT/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh index 69ffda3..c64a582 100755 --- a/test/TEST-03-USR-MOUNT/test.sh +++ b/test/TEST-03-USR-MOUNT/test.sh @@ -15,15 +15,14 @@ client_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts loglevel=7 rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=dracut $client_opts rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -41,13 +40,9 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ -i ./fstab /etc/fstab \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -55,22 +50,19 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ -I "mkfs.btrfs" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --nohardlink \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank file to use as a root filesystem declare -a disk_args=() 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"/root.btrfs root 160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -83,12 +75,9 @@ test_setup() { return 1 fi - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test watchdog" \ - -o "network kernel-network-modules" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -d "btrfs" \ + "$TESTDIR"/initramfs.testing rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-04-FULL-SYSTEMD/create-root.sh b/test/TEST-04-FULL-SYSTEMD/create-root.sh index 411fa99..734f377 100755 --- a/test/TEST-04-FULL-SYSTEMD/create-root.sh +++ b/test/TEST-04-FULL-SYSTEMD/create-root.sh @@ -12,22 +12,22 @@ set -e udevadm settle modprobe btrfs || : -mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root -mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr -btrfs device scan /dev/disk/by-id/ata-disk_root -btrfs device scan /dev/disk/by-id/ata-disk_usr +mkfs.btrfs -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +mkfs.btrfs -q -L dracutusr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr mkdir -p /root -mount -t btrfs /dev/disk/by-id/ata-disk_root /root +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root [ -d /root/usr ] || mkdir -p /root/usr -mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr btrfs subvolume create /root/usr/usr umount /root/usr -mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs -o subvol=usr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr cp -a -t /root /source/* mkdir -p /root/run btrfs filesystem sync /root/usr btrfs filesystem sync /root umount /root/usr 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 poweroff -f diff --git a/test/TEST-04-FULL-SYSTEMD/fstab b/test/TEST-04-FULL-SYSTEMD/fstab index feac57a..114f945 100644 --- a/test/TEST-04-FULL-SYSTEMD/fstab +++ b/test/TEST-04-FULL-SYSTEMD/fstab @@ -1,2 +1,2 @@ -/dev/disk/by-id/ata-disk_root / btrfs defaults 0 0 -/dev/disk/by-id/ata-disk_usr /usr btrfs subvol=usr,ro 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root / btrfs defaults 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /usr btrfs subvol=usr,ro 0 0 diff --git a/test/TEST-04-FULL-SYSTEMD/test-init.sh b/test/TEST-04-FULL-SYSTEMD/test-init.sh index b7261b5..eeec8a2 100755 --- a/test/TEST-04-FULL-SYSTEMD/test-init.sh +++ b/test/TEST-04-FULL-SYSTEMD/test-init.sh @@ -1,41 +1,21 @@ #!/bin/sh : > /dev/watchdog -. /lib/dracut-lib.sh - export PATH=/usr/sbin:/usr/bin:/sbin:/bin command -v plymouth > /dev/null 2>&1 && plymouth --quit exec > /dev/console 2>&1 systemctl --failed --no-legend --no-pager > /failed +ismounted() { + findmnt "$1" > /dev/null 2>&1 +} + if ! ismounted /usr; then echo "**************************FAILED**************************" echo "/usr not mounted!!" - cat /proc/mounts + cat /proc/mounts >> /failed echo "**************************FAILED**************************" -else - if [ -s /failed ]; then - echo "**************************FAILED**************************" - cat /failed - echo "**************************FAILED**************************" - - else - echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - echo "All OK" - fi fi -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -systemctl --no-block poweroff -exit 0 +. /sbin/test-init.sh diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh index 160104f..afd7645 100755 --- a/test/TEST-04-FULL-SYSTEMD/test.sh +++ b/test/TEST-04-FULL-SYSTEMD/test.sh @@ -20,14 +20,14 @@ client_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "systemd.unit=testsuite.target systemd.mask=systemd-firstboot panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \ + -append "systemd.unit=testsuite.target systemd.mask=systemd-firstboot rd.multipath=0 root=LABEL=dracut $client_opts rd.retry=3 $DEBUGOUT" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -51,14 +51,12 @@ test_setup() { shopt -q -s globstar # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ - -m "test-root dbus" \ - -I "ldconfig" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root systemd-ldconfig" \ + -i "${PKGLIBDIR}/modules.d/80test-root/test-init.sh" "/sbin/test-init.sh" \ -i ./test-init.sh /sbin/test-init \ + -I "findmnt" \ -i ./fstab /etc/fstab \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && cp -a "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* && export initdir=$TESTDIR/overlay/source @@ -69,6 +67,8 @@ test_setup() { dpkg -L systemd | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l elif type -P pacman &> /dev/null; then pacman -Q -l systemd | while read -r _ a; do printf -- "%s\0" "$a"; done | xargs -0 -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l + elif type -P equery &> /dev/null; then + equery f 'sys-apps/systemd*' | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l else echo "Can't install systemd base" return 1 @@ -116,13 +116,10 @@ EOF # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot bash btrfs" \ -I "mkfs.btrfs" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --nohardlink \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay/* @@ -130,9 +127,9 @@ EOF 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"/root.btrfs root 160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -148,13 +145,11 @@ EOF [ -e /etc/machine-id ] && EXTRA_MACHINE="/etc/machine-id" [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info" - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test systemd i18n qemu" \ + test_dracut \ + -a "systemd i18n qemu" \ + -d "btrfs" \ ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \ - -o "network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules rngd" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh index 05dec0f..865bfae 100755 --- a/test/TEST-10-RAID/create-root.sh +++ b/test/TEST-10-RAID/create-root.sh @@ -10,7 +10,7 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle set -ex -mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123] +mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[123] # wait for the array to finish initializing, otherwise this sometimes fails # randomly. mdadm -W /dev/md0 || : @@ -22,7 +22,7 @@ lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,6 +42,6 @@ eval "$(udevadm info --query=property --name=/dev/md0 | while read -r line || [ echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-10-RAID/finished-false.sh b/test/TEST-10-RAID/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-10-RAID/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-10-RAID/hard-off.sh b/test/TEST-10-RAID/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-10-RAID/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-10-RAID/test-init.sh b/test/TEST-10-RAID/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-10-RAID/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh index 15cbf56..0a2d094 100755 --- a/test/TEST-10-RAID/test.sh +++ b/test/TEST-10-RAID/test.sh @@ -7,117 +7,61 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a RAID-5" #DEBUGFAIL="rd.break rd.shell rd.debug debug" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rd.auto rw" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - inst_multiple grep - inst_multiple -o /lib/systemd/systemd-shutdown - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) - - # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd sync grep - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem 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"/raid-1.img raid1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "root=/dev/cannotreach rw rootfstype=ext4 console=ttyS0,115200n81 selinux=0" \ + -append "root=/dev/cannotreach rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 eval "$(grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img)" - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - echo "testluks UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab - #echo "luks-$ID_FS_UUID /dev/md0 none" > $initdir/etc/crypttab - echo -n "test" > "$initdir"/etc/key - ) + echo "testluks UUID=$ID_FS_UUID /etc/key" > /tmp/crypttab + echo -n "test" > /tmp/key - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-11-LVM/create-root.sh b/test/TEST-11-LVM/create-root.sh index 015bfe7..5c0eff1 100755 --- a/test/TEST-11-LVM/create-root.sh +++ b/test/TEST-11-LVM/create-root.sh @@ -11,18 +11,18 @@ udevadm control --reload udevadm settle set -ex -for dev in /dev/disk/by-id/ata-disk_disk[123]; do +for dev in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do lvm pvcreate -ff -y "$dev" done -lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123] +lvm vgcreate dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123] lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/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 poweroff -f diff --git a/test/TEST-11-LVM/finished-false.sh b/test/TEST-11-LVM/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-11-LVM/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-11-LVM/hard-off.sh b/test/TEST-11-LVM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-11-LVM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-11-LVM/test-init.sh b/test/TEST-11-LVM/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-11-LVM/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh index 2782810..fb76ab9 100755 --- a/test/TEST-11-LVM/test.sh +++ b/test/TEST-11-LVM/test.sh @@ -8,76 +8,35 @@ TEST_DESCRIPTION="root filesystem on LVM PV" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto=1 rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid kernel-modules" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -85,10 +44,10 @@ 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"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -96,21 +55,8 @@ test_setup() { -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-12-RAID-DEG/create-root.sh b/test/TEST-12-RAID-DEG/create-root.sh index 05dec0f..865bfae 100755 --- a/test/TEST-12-RAID-DEG/create-root.sh +++ b/test/TEST-12-RAID-DEG/create-root.sh @@ -10,7 +10,7 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle set -ex -mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123] +mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[123] # wait for the array to finish initializing, otherwise this sometimes fails # randomly. mdadm -W /dev/md0 || : @@ -22,7 +22,7 @@ lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,6 +42,6 @@ eval "$(udevadm info --query=property --name=/dev/md0 | while read -r line || [ echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-12-RAID-DEG/finished-false.sh b/test/TEST-12-RAID-DEG/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-12-RAID-DEG/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-12-RAID-DEG/hard-off.sh b/test/TEST-12-RAID-DEG/hard-off.sh deleted file mode 100755 index 8179d57..0000000 --- a/test/TEST-12-RAID-DEG/hard-off.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -sleep 5 -getargbool 0 rd.shell || poweroff -f -! getargbool 0 rd.break && getargbool 0 failme && poweroff -f diff --git a/test/TEST-12-RAID-DEG/test-init.sh b/test/TEST-12-RAID-DEG/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-12-RAID-DEG/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh index da5177b..5c1b94e 100755 --- a/test/TEST-12-RAID-DEG/test.sh +++ b/test/TEST-12-RAID-DEG/test.sh @@ -11,18 +11,17 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a degraded RAID-5" client_run() { echo "CLIENT TEST START: $*" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker # degrade the RAID - # qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 + # qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* systemd.log_target=kmsg root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 log_buf_len=2M selinux=0 rd.shell=0 $DEBUGFAIL " \ + -append "$* systemd.log_target=kmsg root=LABEL=root rw log_buf_len=2M" \ -initrd "$TESTDIR"/initramfs.testing if ! test_marker_check; then @@ -56,69 +55,29 @@ test_run() { } test_setup() { - kernel=$KVERSION - # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$basedir"/dracut.sh -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd grep sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem 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"/raid-1.img raid1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -132,28 +91,18 @@ test_setup() { eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)" echo "$MD_UUID" > "$TESTDIR"/mduuid - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > "$initdir"/etc/mdadm.conf - echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - chmod 0600 "$initdir"/etc/key - ) - - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > /tmp/mdadm.conf + echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > /tmp/crypttab + echo -n test > /tmp/key + chmod 0600 /tmp/key + + test_dracut \ + -m "crypt lvm mdraid" \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/mdadm.conf" "/etc/mdadm.conf" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-13-ENC-RAID-LVM/create-root.sh b/test/TEST-13-ENC-RAID-LVM/create-root.sh index b681e6b..c51d027 100755 --- a/test/TEST-13-ENC-RAID-LVM/create-root.sh +++ b/test/TEST-13-ENC-RAID-LVM/create-root.sh @@ -13,12 +13,12 @@ udevadm settle set -ex printf test > keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk1 /keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk2 /keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk3 /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk1 dracut_disk1 < /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk2 dracut_disk2 < /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk3 dracut_disk3 < /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1 /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2 /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk3 /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1 dracut_disk1 < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2 dracut_disk2 < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk3 dracut_disk3 < /keyfile mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_disk1 /dev/mapper/dracut_disk2 /dev/mapper/dracut_disk3 # wait for the array to finish initializing, otherwise this sometimes fails # randomly. @@ -28,7 +28,7 @@ lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,9 +42,9 @@ cryptsetup luksClose /dev/mapper/dracut_disk3 { echo "dracut-root-block-created" - for i in /dev/disk/by-id/ata-disk_disk[123]; do + for i in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do udevadm info --query=property --name="$i" | grep -F 'ID_FS_UUID=' done -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/finished-false.sh b/test/TEST-13-ENC-RAID-LVM/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-13-ENC-RAID-LVM/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-13-ENC-RAID-LVM/hard-off.sh b/test/TEST-13-ENC-RAID-LVM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-13-ENC-RAID-LVM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/test-init.sh b/test/TEST-13-ENC-RAID-LVM/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-13-ENC-RAID-LVM/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh index fe79223..5129bcc 100755 --- a/test/TEST-13-ENC-RAID-LVM/test.sh +++ b/test/TEST-13-ENC-RAID-LVM/test.sh @@ -13,17 +13,16 @@ test_run() { echo "CLIENT TEST START: $LUKSARGS" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto rd.retry=20 rootwait $LUKSARGS" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 echo "CLIENT TEST END: [OK]" @@ -33,7 +32,7 @@ test_run() { echo "CLIENT TEST START: Any LUKS" "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto rd.retry=20" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 echo "CLIENT TEST END: [OK]" @@ -43,7 +42,7 @@ test_run() { echo "CLIENT TEST START: Wrong LUKS UUID" "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \ + -append "root=/dev/dracut/root rw rd.auto rd.luks.uuid=failme" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check && return 1 echo "CLIENT TEST END: [OK]" @@ -52,69 +51,31 @@ test_run() { } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem 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"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 80 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -127,31 +88,20 @@ test_setup() { printf ' rd.luks.uuid=luks-%s ' "$ID_FS_UUID" done > "$TESTDIR"/luks.txt - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - i=1 - for uuid in $cryptoUUIDS; do - eval "$uuid" - printf 'luks-%s /dev/disk/by-id/ata-disk_disk%s /etc/key timeout=0\n' "$ID_FS_UUID" $i - ((i += 1)) - done > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - chmod 0600 "$initdir"/etc/key - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + i=1 + for uuid in $cryptoUUIDS; do + eval "$uuid" + printf 'luks-%s /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk%s /etc/key timeout=0\n' "$ID_FS_UUID" $i + ((i += 1)) + done > /tmp/crypttab + echo -n test > /tmp/key + chmod 0600 /tmp/key + + test_dracut \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-14-IMSM/create-root.sh b/test/TEST-14-IMSM/create-root.sh index 97d29d9..5055639 100755 --- a/test/TEST-14-IMSM/create-root.sh +++ b/test/TEST-14-IMSM/create-root.sh @@ -12,7 +12,7 @@ udevadm control --reload udevadm settle # dmraid does not want symlinks in --disk "..." -echo y | dmraid -f isw -C Test0 --type 1 --disk "$(realpath /dev/disk/by-id/ata-disk_disk1) $(realpath /dev/disk/by-id/ata-disk_disk2)" +echo y | dmraid -f isw -C Test0 --type 1 --disk "$(realpath /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1) $(realpath /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2)" udevadm settle SETS=$(dmraid -c -s) @@ -29,9 +29,9 @@ udevadm settle sfdisk -g /dev/mapper/isw*Test0 sfdisk --no-reread /dev/mapper/isw*Test0 << EOF ,4M -,28M -,28M -,28M +,56M +,56M +,56M EOF set -x @@ -59,7 +59,7 @@ lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -72,7 +72,7 @@ echo "MD_UUID=$MD_UUID" { echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none mdadm --wait-clean /dev/md0 sync poweroff -f diff --git a/test/TEST-14-IMSM/hard-off.sh b/test/TEST-14-IMSM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-14-IMSM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-14-IMSM/test-init.sh b/test/TEST-14-IMSM/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-14-IMSM/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh index 06959cd..fc3e429 100755 --- a/test/TEST-14-IMSM/test.sh +++ b/test/TEST-14-IMSM/test.sh @@ -10,16 +10,15 @@ client_run() { echo "CLIENT TEST START: $*" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \ + -append "$* root=LABEL=root rw rd.retry=5" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -50,68 +49,30 @@ test_run() { } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - inst_simple /etc/os-release - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dd sync realpath - inst_hook initqueue 01 ./create-root.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid dmraid kernel-modules qemu" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid dmraid kernel-modules" \ -d "piix ide-gd_mod ata_piix ext4 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \ - --no-hostonly-cmdline -N \ + -I "grep sfdisk realpath" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem 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"/disk-1.img disk1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 200 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -127,21 +88,9 @@ test_setup() { fi echo "$MD_UUID" > "$TESTDIR"/mduuid - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + + test_dracut \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-15-BTRFSRAID/create-root.sh b/test/TEST-15-BTRFSRAID/create-root.sh index 075deac..f416185 100755 --- a/test/TEST-15-BTRFSRAID/create-root.sh +++ b/test/TEST-15-BTRFSRAID/create-root.sh @@ -12,17 +12,17 @@ udevadm settle set -e -mkfs.btrfs -draid10 -mraid10 -L root /dev/disk/by-id/ata-disk_raid[1234] +mkfs.btrfs -q -draid10 -mraid10 -L root /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[1234] udevadm settle btrfs device scan udevadm settle mkdir -p /sysroot -mount -t btrfs /dev/disk/by-id/ata-disk_raid4 /sysroot +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid4 /sysroot cp -a -t /sysroot /source/* umount /sysroot -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-15-BTRFSRAID/finished-false.sh b/test/TEST-15-BTRFSRAID/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-15-BTRFSRAID/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-15-BTRFSRAID/hard-off.sh b/test/TEST-15-BTRFSRAID/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-15-BTRFSRAID/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-15-BTRFSRAID/test-init.sh b/test/TEST-15-BTRFSRAID/test-init.sh deleted file mode 100755 index 068e8f3..0000000 --- a/test/TEST-15-BTRFSRAID/test-init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / - -poweroff -f diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh index 068146e..2745950 100755 --- a/test/TEST-15-BTRFSRAID/test.sh +++ b/test/TEST-15-BTRFSRAID/test.sh @@ -6,18 +6,17 @@ TEST_DESCRIPTION="root filesystem on multiple device btrfs" #DEBUGFAIL="rd.shell" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-4.img raid4 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=root rw rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 } @@ -28,59 +27,21 @@ test_setup() { rm -f -- "$DISKIMAGE" dd if=/dev/zero of="$DISKIMAGE" bs=1M count=1024 - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp sync dd - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst ./test-init.sh /sbin/init - inst_simple /etc/os-release - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.btrfs poweroff cp umount dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash btrfs rootfs-block kernel-modules qemu" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash btrfs rootfs-block kernel-modules" \ -d "piix ide-gd_mod ata_piix btrfs sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + -I "mkfs.btrfs" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -89,11 +50,11 @@ 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"/raid-1.img raid1 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-4.img raid4 150 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -102,21 +63,9 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -d "btrfs" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-16-DMSQUASH/create-root.sh b/test/TEST-16-DMSQUASH/create-root.sh index f17b22f..b424a1a 100755 --- a/test/TEST-16-DMSQUASH/create-root.sh +++ b/test/TEST-16-DMSQUASH/create-root.sh @@ -13,29 +13,29 @@ set -e udevadm settle # create a single partition using 50% of the capacity of the image file created by test_setup() in test.sh -sfdisk /dev/disk/by-id/ata-disk_root << EOF +sfdisk /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root << EOF 2048,161792 EOF udevadm settle -mkfs.ext4 -q -L dracut /dev/disk/by-id/ata-disk_root-part1 +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root-part1 mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root-part1 /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root-part1 /root mkdir -p /root/run /root/testdir cp -a -t /root /source/* echo "Creating squashfs" mksquashfs /source /root/testdir/rootfs.img -quiet # Copy rootfs.img to the NTFS drive if exists -if [ -e "/dev/disk/by-id/ata-disk_root_ntfs" ]; then - mkfs.ntfs -F -L dracut_ntfs /dev/disk/by-id/ata-disk_root_ntfs +if [ -e "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs" ]; then + mkfs.ntfs -q -F -L dracut_ntfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs mkdir -p /root_ntfs - mount -t ntfs3 /dev/disk/by-id/ata-disk_root_ntfs /root_ntfs + mount -t ntfs3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs /root_ntfs mkdir -p /root_ntfs/run /root_ntfs/testdir cp /root/testdir/rootfs.img /root_ntfs/testdir/rootfs.img fi 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 poweroff -f diff --git a/test/TEST-16-DMSQUASH/test-init.sh b/test/TEST-16-DMSQUASH/test-init.sh index 959fa25..2d16b6b 100755 --- a/test/TEST-16-DMSQUASH/test-init.sh +++ b/test/TEST-16-DMSQUASH/test-init.sh @@ -1,13 +1,4 @@ #!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then # Writing to a file in the root filesystem lets test_run() verify that the autooverlay module successfully created @@ -15,17 +6,5 @@ if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then echo "dracut-autooverlay-success" > /overlay-marker fi -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / - -poweroff -f +# call the rest of the init +. /sbin/init diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh index 3fecc92..6087ccd 100755 --- a/test/TEST-16-DMSQUASH/test.sh +++ b/test/TEST-16-DMSQUASH/test.sh @@ -9,19 +9,19 @@ TEST_DESCRIPTION="live root on a squash filesystem" test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root # NTFS drive if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs + qemu_add_drive disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs fi test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -30,7 +30,7 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -39,18 +39,18 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 # Run the NTFS test only if mkfs.ntfs is available if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 + dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 status=none "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs quiet rd.info rd.shell=0" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -63,7 +63,7 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.overlay=LABEL=persist rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "init=/sbin/init-persist rd.live.image rd.live.overlay.overlayfs=1 rd.live.overlay=LABEL=persist rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ -initrd "$TESTDIR"/initramfs.testing-autooverlay rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]') @@ -81,12 +81,9 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ + -i ./test-init.sh /sbin/init-persist \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -94,25 +91,24 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ --modules "test-makeroot" \ - --install "sfdisk mkfs.ext4 mkfs.ntfs mksquashfs" \ + --install "sfdisk mkfs.ntfs mksquashfs" \ --drivers "ntfs3" \ --include ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --no-hostonly --no-hostonly-cmdline --no-early-microcode --nofscks --nomdadmconf --nohardlink --nostrip \ --force "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank file to use as a root filesystem declare -a disk_args=() 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"/root.img root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 160 # NTFS drive if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then dd if=/dev/zero of="$TESTDIR"/root_ntfs.img bs=1MiB count=160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs + qemu_add_drive disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs fi # Invoke KVM and/or QEMU to actually create the target filesystem. @@ -131,22 +127,17 @@ test_setup() { SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3" EOF - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --modules "test dash dmsquash-live qemu" \ - --omit "rngd" \ - --drivers "ext4 ntfs3 sd_mod" \ + test_dracut \ + --modules "dash dmsquash-live qemu" \ + --drivers "ntfs3" \ --install "mkfs.ext4" \ --include /tmp/ntfs3.rules /lib/udev/rules.d/ntfs3.rules \ - --no-hostonly --no-hostonly-cmdline \ - --force "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --modules "test dmsquash-live-autooverlay qemu" \ - --omit "rngd" \ - --drivers "ext4 sd_mod" \ + test_dracut \ + --modules "dmsquash-live-autooverlay qemu" \ --install "mkfs.ext4" \ - --no-hostonly --no-hostonly-cmdline \ - --force "$TESTDIR"/initramfs.testing-autooverlay "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing-autooverlay rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-17-LVM-THIN/create-root.sh b/test/TEST-17-LVM-THIN/create-root.sh index 2547d1c..8c9c298 100755 --- a/test/TEST-17-LVM-THIN/create-root.sh +++ b/test/TEST-17-LVM-THIN/create-root.sh @@ -11,15 +11,16 @@ udevadm control --reload udevadm settle set -ex -for dev in /dev/disk/by-id/ata-disk_disk[123]; do +modprobe dm_thin_pool +for dev in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do lvm pvcreate -ff -y "$dev" done -lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123] +lvm vgcreate dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123] lvm lvcreate --ignoremonitoring -l 100%FREE -T dracut/mythinpool lvm lvcreate --ignoremonitoring -V100M -T dracut/mythinpool -n root lvm vgchange --ignoremonitoring -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -27,7 +28,7 @@ umount /sysroot lvm lvchange -a n /dev/dracut/root if ! dmsetup status | grep -q out_of_data_space; then - 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 fi sync diff --git a/test/TEST-17-LVM-THIN/finished-false.sh b/test/TEST-17-LVM-THIN/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-17-LVM-THIN/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-17-LVM-THIN/hard-off.sh b/test/TEST-17-LVM-THIN/hard-off.sh deleted file mode 100755 index f4d19dc..0000000 --- a/test/TEST-17-LVM-THIN/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getarg failme && poweroff -f diff --git a/test/TEST-17-LVM-THIN/test-init.sh b/test/TEST-17-LVM-THIN/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-17-LVM-THIN/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh index 5010e48..9326433 100755 --- a/test/TEST-17-LVM-THIN/test.sh +++ b/test/TEST-17-LVM-THIN/test.sh @@ -7,75 +7,37 @@ TEST_DESCRIPTION="root filesystem on LVM PV with thin pool" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto=1 rd.driver.pre=dm_thin_pool rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dmsetup dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -83,10 +45,10 @@ 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"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -94,21 +56,9 @@ test_setup() { -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" -I lvs \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -I lvs \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-18-UEFI/test-init.sh b/test/TEST-18-UEFI/test-init.sh deleted file mode 100755 index 03966d2..0000000 --- a/test/TEST-18-UEFI/test-init.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -[ -e /proc/self/mounts ] \ - || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) - -grep -q '^sysfs /sys sysfs' /proc/self/mounts \ - || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) - -grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \ - || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev) - -grep -q '^tmpfs /run tmpfs' /proc/self/mounts \ - || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run) - -: > /dev/watchdog - -exec > /dev/console 2>&1 - -echo "made it to the rootfs! Powering down." -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb -poweroff -f diff --git a/test/TEST-18-UEFI/test.sh b/test/TEST-18-UEFI/test.sh index 4191fed..769a0e3 100755 --- a/test/TEST-18-UEFI/test.sh +++ b/test/TEST-18-UEFI/test.sh @@ -3,16 +3,10 @@ # shellcheck disable=SC2034 TEST_DESCRIPTION="UEFI boot" -# Linux kernel requirements -# CONFIG_BLK_DEV_INITRD for initramfs -# CONFIG_EFI_HANDOVER_PROTOCOL for ovmf (Open Virtual Machine Firmware) -# CONFIG_SATA_AHCI for ahci.ko -# CONFIG_BLK_DEV_SD for sd_mod.ko -# CONFIG_SQUASHFS_ZLIB for squashfs.ko - ovmf_code() { for path in \ "/usr/share/OVMF/OVMF_CODE.fd" \ + "/usr/share/OVMF/OVMF_CODE_4M.fd" \ "/usr/share/edk2/x64/OVMF_CODE.fd" \ "/usr/share/edk2-ovmf/OVMF_CODE.fd" \ "/usr/share/qemu/ovmf-x86_64-4m.bin"; do @@ -24,33 +18,11 @@ test_check() { [[ -n "$(ovmf_code)" ]] } -KVERSION="${KVERSION-$(uname -r)}" - -test_marker_reset() { - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 -} - -test_marker_check() { - grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/marker.img - return $? -} - -test_dracut() { - TEST_DRACUT_ARGS+=" --local --no-hostonly --no-early-microcode --add test --kver $KVERSION" - - # shellcheck disable=SC2162 - IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS" - - "$DRACUT" "$@" \ - --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ - "${TEST_DRACUT_ARGS_ARRAY[@]}" || return 1 -} - test_run() { declare -a disk_args=() declare -i disk_index=1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/squashfs.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/squashfs.img root test_marker_reset "$testdir"/run-qemu "${disk_args[@]}" -net none \ @@ -62,8 +34,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem - "$DRACUT" --local --no-hostonly --no-early-microcode --nofscks \ - --tmpdir "$TESTDIR" --keep --modules "test-root" --include ./test-init.sh /sbin/init \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ "$TESTDIR"/tmp-initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/dracut.*/initramfs/proc @@ -71,15 +43,18 @@ test_setup() { mkdir -p "$TESTDIR"/ESP/EFI/BOOT - if [ -f "/usr/lib/gummiboot/linuxx64.efi.stub" ]; then - TEST_DRACUT_ARGS+=" --uefi-stub /usr/lib/gummiboot/linuxx64.efi.stub " - fi + test_dracut \ + --modules 'rootfs-block' \ + --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \ + --drivers 'squashfs' \ + --uefi \ + "$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi - mkdir -p "$TESTDIR"/ESP/EFI/BOOT test_dracut \ - --modules 'rootfs-block test' \ - --kernel-cmdline 'root=/dev/sdc ro rd.skipfsck rootfstype=squashfs' \ - --drivers 'ahci sd_mod squashfs' \ + --hostonly \ + --modules 'rootfs-block' \ + --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \ + --drivers 'squashfs' \ --uefi \ "$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi } 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 diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh index 46a5e3f..d7f1370 100755 --- a/test/TEST-30-ISCSI/client-init.sh +++ b/test/TEST-30-ISCSI/client-init.sh @@ -11,7 +11,7 @@ stty sane echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "ext4" ] && continue - echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts diff --git a/test/TEST-30-ISCSI/create-client-root.sh b/test/TEST-30-ISCSI/create-client-root.sh index 267c93a..6c6bc9a 100755 --- a/test/TEST-30-ISCSI/create-client-root.sh +++ b/test/TEST-30-ISCSI/create-client-root.sh @@ -12,22 +12,22 @@ udevadm settle set -ex -mkfs.ext4 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot +mkfs.ext4 -q -j -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot mkdir -p /sysroot -mount -t ext4 /dev/disk/by-id/ata-disk_singleroot /sysroot +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot cp -a -t /sysroot /source/* umount /sysroot -mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2 +mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 mdadm -W /dev/md0 || : lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -j -L sysroot /dev/dracut/root +mkfs.ext4 -q -j -L sysroot /dev/dracut/root mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/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-30-ISCSI/create-server-root.sh b/test/TEST-30-ISCSI/create-server-root.sh index 2dbc2da..004e79b 100755 --- a/test/TEST-30-ISCSI/create-server-root.sh +++ b/test/TEST-30-ISCSI/create-server-root.sh @@ -10,11 +10,11 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle -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 poweroff -f diff --git a/test/TEST-30-ISCSI/server-init.sh b/test/TEST-30-ISCSI/server-init.sh index a1c3b7e..f89464e 100755 --- a/test/TEST-30-ISCSI/server-init.sh +++ b/test/TEST-30-ISCSI/server-init.sh @@ -69,9 +69,9 @@ tgtd tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0 tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1 tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2 -tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot -tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1 -tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2 +tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot +tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 +tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101 diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh index ac9f096..f4bf33e 100755 --- a/test/TEST-30-ISCSI/test.sh +++ b/test/TEST-30-ISCSI/test.sh @@ -13,10 +13,10 @@ run_server() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -24,7 +24,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12330 \ - -append "panic=1 oops=panic softlockup_panic=1 quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 quiet root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -53,7 +53,7 @@ run_client() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ @@ -126,28 +126,31 @@ test_check() { echo "Need tgtd and tgtadm from scsi-target-utils" return 1 fi + if ! [ -f /lib/systemd/system/iscsiuio.socket ]; then + echo "Need iscsiuio.socket to run this test" + return 1 + fi } test_setup() { # Create what will eventually be the client root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./client-init.sh /sbin/init \ - -I "ip ping grep setsid" \ + -I "ip grep setsid" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ -m "test-makeroot crypt lvm mdraid" \ - -I "mkfs.ext4 setsid blockdev" \ + -I "setsid blockdev" \ -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 @@ -155,10 +158,10 @@ test_setup() { declare -a disk_args=() 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"/singleroot.img singleroot 200 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -169,40 +172,36 @@ test_setup() { rm -- "$TESTDIR"/marker.img # Create what will eventually be the server root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ - -m "test-root network network-legacy" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy" \ -d "iscsi_tcp crc32c ipv6" \ - -i ./server-init.sh /sbin/init \ -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - -I "modprobe chmod ip ping tcpdump setsid pidof tgtd tgtadm /etc/passwd" \ + -I "modprobe chmod ip tcpdump setsid pidof tgtd tgtadm /etc/passwd" \ --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ -i "./hosts" "/etc/hosts" \ -i "./dhcpd.conf" "/etc/dhcpd.conf" \ - --no-hostonly --no-hostonly-cmdline --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* mkdir -p "$TESTDIR"/overlay/source/var/lib/dhcpd + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay 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 240 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -214,8 +213,8 @@ test_setup() { # Make server's dracut image "$DRACUT" -l \ - -a "dash rootfs-block test kernel-modules network network-legacy" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ + -a "dash rootfs-block test kernel-modules network-legacy" \ + -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg virtio_pci virtio_scsi" \ -i "./server.link" "/etc/systemd/network/01-server.link" \ -i ./wait-if-server.sh /lib/dracut/hooks/pre-mount/99-wait-if-server.sh \ --no-hostonly-cmdline -N \ diff --git a/test/TEST-35-ISCSI-MULTI/client-init.sh b/test/TEST-35-ISCSI-MULTI/client-init.sh index 46a5e3f..d7f1370 100755 --- a/test/TEST-35-ISCSI-MULTI/client-init.sh +++ b/test/TEST-35-ISCSI-MULTI/client-init.sh @@ -11,7 +11,7 @@ stty sane echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "ext4" ] && continue - echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts diff --git a/test/TEST-35-ISCSI-MULTI/create-client-root.sh b/test/TEST-35-ISCSI-MULTI/create-client-root.sh index 267c93a..6c6bc9a 100755 --- a/test/TEST-35-ISCSI-MULTI/create-client-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-client-root.sh @@ -12,22 +12,22 @@ udevadm settle set -ex -mkfs.ext4 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot +mkfs.ext4 -q -j -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot mkdir -p /sysroot -mount -t ext4 /dev/disk/by-id/ata-disk_singleroot /sysroot +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot cp -a -t /sysroot /source/* umount /sysroot -mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2 +mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 mdadm -W /dev/md0 || : lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -j -L sysroot /dev/dracut/root +mkfs.ext4 -q -j -L sysroot /dev/dracut/root mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/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-35-ISCSI-MULTI/create-server-root.sh b/test/TEST-35-ISCSI-MULTI/create-server-root.sh index 2dbc2da..004e79b 100755 --- a/test/TEST-35-ISCSI-MULTI/create-server-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-server-root.sh @@ -10,11 +10,11 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle -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 poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/finished-false.sh b/test/TEST-35-ISCSI-MULTI/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-35-ISCSI-MULTI/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-35-ISCSI-MULTI/hard-off.sh b/test/TEST-35-ISCSI-MULTI/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-35-ISCSI-MULTI/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/server-init.sh b/test/TEST-35-ISCSI-MULTI/server-init.sh index a1c3b7e..f89464e 100755 --- a/test/TEST-35-ISCSI-MULTI/server-init.sh +++ b/test/TEST-35-ISCSI-MULTI/server-init.sh @@ -69,9 +69,9 @@ tgtd tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0 tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1 tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2 -tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot -tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1 -tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2 +tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot +tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 +tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101 diff --git a/test/TEST-35-ISCSI-MULTI/test.sh b/test/TEST-35-ISCSI-MULTI/test.sh index 3e649a8..f807798 100755 --- a/test/TEST-35-ISCSI-MULTI/test.sh +++ b/test/TEST-35-ISCSI-MULTI/test.sh @@ -13,10 +13,10 @@ run_server() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -24,7 +24,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -52,7 +52,7 @@ run_client() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ @@ -60,7 +60,7 @@ run_client() { -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ -net socket,connect=127.0.0.1:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ + -append "rw rd.auto rd.retry=50 $*" \ -initrd "$TESTDIR"/initramfs.testing if ! test_marker_check iscsi-OK; then echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" @@ -138,70 +138,44 @@ test_check() { echo "Need tgtd and tgtadm from scsi-target-utils" return 1 fi + if ! [ -f /lib/systemd/system/iscsiuio.socket ]; then + echo "Need iscsiuio.socket to run this test" + return 1 + fi } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay rm -rf -- "$TESTDIR"/overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - mkdir -p -- var/lib/nfs/rpc_pipefs - ) - inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep setsid dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - inst_simple /etc/os-release - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip grep setsid" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount setsid dd sync blockdev - inst_hook initqueue 01 ./create-client-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot crypt lvm mdraid" \ + -I "setsid blockdev" \ + -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() 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"/singleroot.img singleroot 200 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 400 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 200 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -211,82 +185,37 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # shellcheck disable=SC2031 - export kernel=$KVERSION rm -rf -- "$TESTDIR"/overlay - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi - ) - inst /etc/passwd /etc/passwd - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping modprobe tcpdump setsid \ - sleep mount chmod pidof - inst_multiple tgtd tgtadm - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - instmods iscsi_tcp crc32c ipv6 af_packet - [ -f /etc/netconfig ] && inst_multiple /etc/netconfig - type -P dhcpd > /dev/null && inst_multiple dhcpd - inst ./server-init.sh /sbin/init - inst ./hosts /etc/hosts - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \ - {,/usr}/etc/protocols {,/usr}/etc/services \ - /etc/group /etc/os-release - - _nsslibs=$( - cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \ - | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|' - ) - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy iscsi" \ + -d "iscsi_tcp crc32c ipv6 af_packet" \ + -I "ip grep sleep setsid chmod modprobe pidof tgtd tgtadm" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ + -i /tmp/config /etc/nbd-server/config \ + -i "./hosts" "/etc/hosts" \ + -i "./dhcpd.conf" "/etc/dhcpd.conf" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/iscsi + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd - inst_hook initqueue 01 ./create-server-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot" \ + -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay 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 60 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -296,38 +225,18 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # Make an overlay with needed tools for the test harness - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst_simple ./client.link /etc/systemd/network/01-client.link - ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth dmraid nfs" \ - -a "debug ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 - - ( - # shellcheck disable=SC2031 - export initdir="$TESTDIR"/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - rm "$initdir"/etc/systemd/network/01-client.link - inst_simple ./server.link /etc/systemd/network/01-server.link - inst_hook pre-mount 99 ./wait-if-server.sh - ) + test_dracut \ + --add "$USE_NETWORK" \ + -i "./client.link" "/etc/systemd/network/01-client.link" \ + "$TESTDIR"/initramfs.testing + # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "dash rootfs-block debug kernel-modules network network-legacy" \ + -a "test dash rootfs-block debug kernel-modules network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ + -i "./server.link" "/etc/systemd/network/01-server.link" \ + -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 diff --git a/test/TEST-40-NBD/client-init.sh b/test/TEST-40-NBD/client-init.sh index c5c57a2..9de7436 100755 --- a/test/TEST-40-NBD/client-init.sh +++ b/test/TEST-40-NBD/client-init.sh @@ -9,7 +9,7 @@ exec > /dev/console 2>&1 while read -r dev fs fstype opts rest || [ -n "$dev" ]; do [ "$dev" = "rootfs" ] && continue [ "$fs" != "/" ] && continue - echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none echo "nbd-OK $fstype $opts" break done < /proc/mounts diff --git a/test/TEST-40-NBD/create-client-root.sh b/test/TEST-40-NBD/create-client-root.sh index a214f38..a2114a8 100755 --- a/test/TEST-40-NBD/create-client-root.sh +++ b/test/TEST-40-NBD/create-client-root.sh @@ -11,14 +11,14 @@ udevadm control --reload set -e udevadm settle -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" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-40-NBD/create-encrypted-root.sh b/test/TEST-40-NBD/create-encrypted-root.sh index 0ea90e3..c4b12c2 100755 --- a/test/TEST-40-NBD/create-encrypted-root.sh +++ b/test/TEST-40-NBD/create-encrypted-root.sh @@ -13,15 +13,15 @@ udevadm settle set -ex printf test > keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_root /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /keyfile echo "The passphrase is test" -cryptsetup luksOpen /dev/disk/by-id/ata-disk_root dracut_crypt_test < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root dracut_crypt_test < /keyfile lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay udevadm settle -mkfs.ext4 -L dracut -j /dev/dracut/root +mkfs.ext4 -q -L dracut -j /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -32,10 +32,10 @@ udevadm settle cryptsetup luksClose /dev/mapper/dracut_crypt_test udevadm settle sleep 1 -eval "$(udevadm info --query=property --name=/dev/disk/by-id/ata-disk_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)" +eval "$(udevadm info --query=property --name=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)" { echo "dracut-root-block-created" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-40-NBD/create-server-root.sh b/test/TEST-40-NBD/create-server-root.sh index de4d670..d0c5c30 100755 --- a/test/TEST-40-NBD/create-server-root.sh +++ b/test/TEST-40-NBD/create-server-root.sh @@ -12,15 +12,15 @@ udevadm settle set -e udevadm settle -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" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-40-NBD/finished-false.sh b/test/TEST-40-NBD/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-40-NBD/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-40-NBD/hard-off.sh b/test/TEST-40-NBD/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-40-NBD/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh index 7fd1efc..e935f53 100755 --- a/test/TEST-40-NBD/test.sh +++ b/test/TEST-40-NBD/test.sh @@ -27,18 +27,17 @@ run_server() { echo "NBD TEST SETUP: Starting DHCP/NBD server" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted - qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img encrypted - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot + qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted + qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img encrypted + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot "$testdir"/run-qemu \ "${disk_args[@]}" \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net socket,listen=127.0.0.1:12340 \ - -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -74,14 +73,14 @@ client_test() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ -net nic,macaddr="$mac",model=e1000 \ -net socket,connect=127.0.0.1:12340 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \ + -append "$cmdline rd.auto ro" \ -initrd "$TESTDIR"/initramfs.testing # shellcheck disable=SC2181 @@ -165,7 +164,7 @@ client_run() { # Encrypted root handling via LVM/LUKS over NBD - # shellcheck disable=SC1090 + # shellcheck source=$TESTDIR/luks.uuid . "$TESTDIR"/luks.uuid client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \ @@ -188,73 +187,32 @@ client_run() { make_encrypted_root() { rm -fr "$TESTDIR"/overlay - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc run var/run tmp - ) - - inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - inst_simple /etc/os-release - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip grep" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc tmp var run root - ln -s ../run var/run - ) - inst_multiple mkfs.ext4 poweroff cp umount dd sync - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst_hook initqueue 01 ./create-encrypted-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot crypt lvm mdraid" \ + -i ./create-encrypted-root.sh /lib/dracut/hooks/initqueue/01-create-encrypted-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay 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"/encrypted.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -267,72 +225,31 @@ make_encrypted_root() { make_client_root() { rm -fr "$TESTDIR"/overlay - kernel=$KVERSION - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc run var/run tmp - ) - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping dd mount sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - 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_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - inst_simple /etc/os-release - inst_multiple -o {,/usr}/etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do - [ -e "$i" ] || continue - inst "$i" - done - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd - inst_hook initqueue 01 ./create-client-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot" \ + -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 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"/unencrypted.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -345,90 +262,51 @@ make_client_root() { make_server_root() { rm -fr "$TESTDIR"/overlay - # shellcheck disable=SC2031 - export kernel=$KVERSION - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server - ln -s ../run var/run - ) - cat > "$initdir/etc/nbd-server/config" << EOF + + cat > /tmp/config << EOF [generic] [raw] -exportname = /dev/disk/by-id/ata-disk_unencrypted +exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_unencrypted port = 2000 bs = 4096 [encrypted] -exportname = /dev/disk/by-id/ata-disk_encrypted +exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_encrypted port = 2001 bs = 4096 EOF - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping grep \ - sleep nbd-server chmod modprobe vi pidof - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan - type -P dhcpd > /dev/null && inst_multiple dhcpd - inst ./server-init.sh /sbin/init - inst_simple /etc/os-release - inst ./hosts /etc/hosts - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple -o {,/usr}/etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - _nsslibs=$( - cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \ - | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|' - ) - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) - # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd sync - inst_hook initqueue 01 ./create-server-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy" \ + -d "nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan" \ + -I "ip grep sleep nbd-server chmod modprobe vi pidof" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ + -i /tmp/config /etc/nbd-server/config \ + -i "./hosts" "/etc/hosts" \ + -i "./dhcpd.conf" "/etc/dhcpd.conf" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/nbd-server + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init + # second, install the files needed to make the root filesystem # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot" \ + -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 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 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -446,47 +324,26 @@ test_setup() { rm -fr "$TESTDIR"/overlay # Make the test image - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - - # inst ./debug-shell.service /lib/systemd/system/debug-shell.service - # mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants" - # ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service" - - # shellcheck disable=SC1090 - . "$TESTDIR"/luks.uuid - mkdir -p "$initdir"/etc - echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - inst_simple ./client.link /etc/systemd/network/01-client.link - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth iscsi nfs" \ - -a "debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 - - ( - # shellcheck disable=SC2031 - export initdir="$TESTDIR"/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - rm "$initdir"/etc/systemd/network/01-client.link - inst_simple ./server.link /etc/systemd/network/01-server.link - inst_hook pre-mount 99 ./wait-if-server.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "rootfs-block debug kernel-modules network network-legacy" \ + # shellcheck source=$TESTDIR/luks.uuid + . "$TESTDIR"/luks.uuid + + echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > /tmp/crypttab + echo -n test > /tmp/key + + test_dracut \ + -a "${USE_NETWORK}" \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "./client.link" "/etc/systemd/network/01-client.link" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing + + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -a "test rootfs-block debug kernel-modules network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ - --no-hostonly-cmdline -N \ + -i "./server.link" "/etc/systemd/network/01-server.link" \ + -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh index 4c51e27..8495913 100755 --- a/test/TEST-50-MULTINIC/client-init.sh +++ b/test/TEST-50-MULTINIC/client-init.sh @@ -32,7 +32,7 @@ done { echo "OK" echo "$IFACES" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none getargbool 0 rd.shell && sh -i diff --git a/test/TEST-50-MULTINIC/create-root.sh b/test/TEST-50-MULTINIC/create-root.sh index 8060b00..0518937 100755 --- a/test/TEST-50-MULTINIC/create-root.sh +++ b/test/TEST-50-MULTINIC/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-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh index 4f81235..e2aa5a3 100755 --- a/test/TEST-50-MULTINIC/test.sh +++ b/test/TEST-50-MULTINIC/test.sh @@ -7,6 +7,11 @@ TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK" #DEBUGFAIL="loglevel=7 rd.shell rd.break" #SERIAL="tcp:127.0.0.1:9999" +# skip the test if ifcfg dracut module can not be installed +test_check() { + test -d /etc/sysconfig/network-scripts +} + run_server() { # Start server first echo "MULTINIC TEST SETUP: Starting DHCP/NFS server" @@ -14,14 +19,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 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root "$testdir"/run-qemu \ "${disk_args[@]}" \ -net socket,listen=127.0.0.1:12350 \ -net nic,macaddr=52:54:01:12:34:56,model=e1000 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 @@ -57,7 +61,7 @@ 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 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker cmdline="$cmdline rd.net.timeout.dhcp=30" # Invoke KVM and/or QEMU to actually create the target filesystem. @@ -72,8 +76,7 @@ client_test() { -netdev hubport,id=n2,hubid=2 \ -device e1000,netdev=n1,mac=52:54:00:12:34:98 \ -device e1000,netdev=n2,mac=52:54:00:12:34:99 \ - -device i6300esb -watchdog-action poweroff \ - -append "quiet panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \ + -append "$cmdline rd.retry=5 ro init=/sbin/init systemd.log_target=console" \ -initrd "$TESTDIR"/initramfs.testing || return 1 { @@ -189,7 +192,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 @@ -247,7 +250,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 @@ -291,7 +294,7 @@ test_setup() { export initdir=$TESTDIR/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 ) @@ -310,8 +313,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 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -337,11 +340,9 @@ test_setup() { inst_hook pre-pivot 85 "$PKGLIBDIR/modules.d/45ifcfg/write-ifcfg.sh" ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "ifcfg plymouth" \ - -a "debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "${USE_NETWORK}" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -354,8 +355,8 @@ test_setup() { ) # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ - -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \ + -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \ + -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 diff --git a/test/TEST-60-BONDBRIDGEVLAN/create-root.sh b/test/TEST-60-BONDBRIDGEVLAN/create-root.sh index fe7b515..9164628 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/create-root.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/create-root.sh @@ -11,12 +11,12 @@ udevadm control --reload udevadm settle set -e -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-60-BONDBRIDGEVLAN/server-init.sh b/test/TEST-60-BONDBRIDGEVLAN/server-init.sh index 3b0f55e..e4ddf3f 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/server-init.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/server-init.sh @@ -64,7 +64,7 @@ ip link set dev enx525401123457 name net2 ip link set dev enx525401123458 name net3 ip link set dev enx525401123459 name net4 -modprobe --all -b -q 8021q bonding +modprobe -b -q 8021q && modprobe -b -q bonding : > /dev/watchdog ip addr add 127.0.0.1/8 dev lo diff --git a/test/TEST-60-BONDBRIDGEVLAN/test.sh b/test/TEST-60-BONDBRIDGEVLAN/test.sh index 5110ddb..be4cb6d 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/test.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/test.sh @@ -9,6 +9,11 @@ TEST_DESCRIPTION="root filesystem on NFS with bridging/bonding/vlan with $USE_NE #DEBUGFAIL="rd.shell rd.break" #SERIAL="tcp:127.0.0.1:9999" +# skip the test if ifcfg dracut module can not be installed +test_check() { + test -d /etc/sysconfig/network-scripts +} + # Network topology: # # .---------------------. .---------------. @@ -44,8 +49,7 @@ run_server() { -device virtio-net-pci,netdev=n3,mac=52:54:01:12:34:59 \ -hda "$TESTDIR"/server.ext4 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 rd.debug" \ + -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 -- "$TESTDIR"/server.pid || return 1 @@ -87,16 +91,14 @@ client_test() { -netdev socket,connect=127.0.0.1:12373,id=n4 -device virtio-net-pci,mac=52:54:00:12:34:04,netdev=n4 \ -netdev hubport,id=n5,hubid=1 -device virtio-net-pci,mac=52:54:00:12:34:05,netdev=n5 \ -hda "$TESTDIR"/client.img \ - -device i6300esb -watchdog-action poweroff \ -append " - panic=1 oops=panic softlockup_panic=1 ifname=net1:52:54:00:12:34:01 ifname=net2:52:54:00:12:34:02 ifname=net3:52:54:00:12:34:03 ifname=net4:52:54:00:12:34:04 ifname=net5:52:54:00:12:34:05 - $cmdline rd.net.timeout.dhcp=30 systemd.crash_reboot - $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ + $cmdline rd.net.timeout.dhcp=30 + rd.retry=5 rw init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing || return 1 { @@ -323,7 +325,7 @@ test_setup() { export initdir=$TESTDIR/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 ) @@ -340,8 +342,8 @@ test_setup() { declare -a disk_args=() 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.ext4 root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.ext4 root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -364,12 +366,9 @@ test_setup() { inst_simple ./client.link /etc/systemd/network/01-client.link ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --no-early-microcode \ - -o "plymouth" \ - -a "debug ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "debug ${USE_NETWORK} ifcfg" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -384,7 +383,7 @@ test_setup() { "$DRACUT" -l -i "$TESTDIR"/overlay / \ --no-early-microcode \ -m "rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ - -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd virtio-net i6300esb ib700wdt" \ + -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd virtio-net i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 } diff --git a/test/TEST-62-SKIPCPIO/test.sh b/test/TEST-62-SKIPCPIO/test.sh index 2311da3..ba20a42 100755 --- a/test/TEST-62-SKIPCPIO/test.sh +++ b/test/TEST-62-SKIPCPIO/test.sh @@ -6,7 +6,7 @@ TEST_DESCRIPTION="test skipcpio" test_check() { - cpio dd truncate find sort diff &> /dev/null + (command -v cpio && command -v find && command -v diff) &> /dev/null } skipcpio_simple() { diff --git a/test/TEST-63-DRACUT-CPIO/test.sh b/test/TEST-63-DRACUT-CPIO/test.sh index f9dff10..5bde7b0 100755 --- a/test/TEST-63-DRACUT-CPIO/test.sh +++ b/test/TEST-63-DRACUT-CPIO/test.sh @@ -21,28 +21,23 @@ test_dracut_cpio() { mkdir -p "$tdir" - # VM script to print sentinel on boot - # write to kmsg so that sysrq messages don't race with console output cat > "$tdir/init.sh" << EOF -echo "Image with ${dracut_cpio_params[*]} booted successfully" > /dev/kmsg -echo 1 > /proc/sys/kernel/sysrq -echo o > /proc/sysrq-trigger -sleep 20 +echo "Image with ${dracut_cpio_params[*]} booted successfully" +poweroff -f EOF - "$DRACUT" -l --drivers "" \ + test_dracut \ + --no-kernel --drivers "" \ + --modules "test" \ "${dracut_cpio_params[@]}" \ - --modules "bash base" \ --include "$tdir/init.sh" /lib/dracut/hooks/emergency/00-init.sh \ - --no-hostonly --no-hostonly-cmdline \ - "$tdir/initramfs" \ - || return 1 + --install "poweroff" \ + "$tdir/initramfs" "$testdir"/run-qemu \ - -device i6300esb -watchdog-action poweroff \ -daemonize -pidfile "$tdir/vm.pid" \ -serial "file:$tdir/console.out" \ - -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 console=ttyS0 rd.shell=1" \ + -append "panic=1 oops=panic softlockup_panic=1 console=ttyS0 rd.shell=1" \ -initrd "$tdir/initramfs" || return 1 timeout=120 diff --git a/test/container/Dockerfile-Arch b/test/container/Dockerfile-Arch index f05ce8f..2af810a 100644 --- a/test/container/Dockerfile-Arch +++ b/test/container/Dockerfile-Arch @@ -1,17 +1,52 @@ FROM docker.io/archlinux -MAINTAINER https://github.com/dracutdevs/dracut - -# Install needed packages for the dracut CI container RUN pacman --noconfirm -Syu \ - linux dash strace dhclient asciidoc cpio pigz squashfs-tools \ - qemu btrfs-progs mdadm dmraid nfs-utils nfsidmap lvm2 nbd \ - dhcp networkmanager multipath-tools vi tcpdump open-iscsi connman \ - git shfmt shellcheck astyle which base-devel glibc parted ntfs-3g && yes | pacman -Scc - -RUN useradd -m build -RUN su build -c 'cd && git clone https://aur.archlinux.org/perl-config-general.git && cd perl-config-general && makepkg -s --noconfirm' -RUN pacman -U --noconfirm ~build/perl-config-general/*.pkg.tar.* -RUN su build -c 'cd && git clone https://aur.archlinux.org/tgt.git && cd tgt && makepkg -s --noconfirm' -RUN pacman -U --noconfirm ~build/tgt/*.pkg.tar.* -RUN rm -fr ~build + asciidoc \ + astyle \ + base-devel \ + bluez \ + btrfs-progs \ + busybox \ + cargo \ + cifs-utils \ + connman \ + cpio \ + dash \ + dhclient \ + dhcp \ + dmraid \ + elfutils \ + f2fs-tools \ + git \ + glibc \ + jq \ + linux \ + lvm2 \ + lzop \ + mdadm \ + multipath-tools \ + nbd \ + networkmanager \ + nfsidmap \ + nfs-utils \ + ntfs-3g \ + nvme-cli \ + open-iscsi \ + openssh \ + parted \ + pigz \ + plymouth \ + qemu \ + qrencode \ + rng-tools \ + sbsigntools \ + shellcheck \ + shfmt \ + squashfs-tools \ + strace \ + systemd-ukify \ + tcpdump \ + tgt \ + tpm2-tools \ + vi \ + && yes | pacman -Scc diff --git a/test/container/Dockerfile-Debian b/test/container/Dockerfile-Debian index 9ba3a1f..7e7e6d4 100644 --- a/test/container/Dockerfile-Debian +++ b/test/container/Dockerfile-Debian @@ -1,7 +1,5 @@ FROM docker.io/debian:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container # Install dracut as a linux-initramfs-tool provider so that the default initramfs-tool package does not get installed # Uninstall initramfs-tools-core as a workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994492 @@ -9,17 +7,16 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \ asciidoc \ astyle \ + bluez \ btrfs-progs \ busybox-static \ bzip2 \ ca-certificates \ + cargo \ console-setup \ cpio \ cryptsetup \ curl \ - dash \ - debhelper \ - debhelper-compat \ dmraid \ docbook \ docbook-xml \ @@ -32,6 +29,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- iputils-ping \ isc-dhcp-client \ isc-dhcp-server \ + iscsiuio \ kmod \ less \ libdmraid-dev \ @@ -52,16 +50,17 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- pigz \ pkg-config \ procps \ - qemu-system-x86 \ - quilt \ + qemu-kvm \ + rng-tools5 \ shellcheck \ + sbsigntool \ squashfs-tools \ strace \ - sudo \ systemd-boot-efi \ tcpdump \ tgt \ thin-provisioning-tools \ + tpm2-tools \ vim \ wget \ && apt-get clean && dpkg -P --force-depends dracut dracut-core initramfs-tools-core diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest index 2ce3975..106af17 100644 --- a/test/container/Dockerfile-Fedora-latest +++ b/test/container/Dockerfile-Fedora-latest @@ -1,16 +1,15 @@ FROM registry.fedoraproject.org/fedora:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container RUN dnf -y install --setopt=install_weak_deps=False \ asciidoc \ + astyle \ bash-completion \ - biosdevname \ bluez \ btrfs-progs \ busybox \ bzip2 \ + cargo \ cifs-utils \ cryptsetup \ dash \ @@ -28,6 +27,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ iproute \ iputils \ iscsi-initiator-utils \ + jq \ kbd \ kernel \ kmod-devel \ @@ -49,7 +49,8 @@ RUN dnf -y install --setopt=install_weak_deps=False \ parted \ pcsc-lite \ pigz \ - qemu-system-x86-core \ + qemu \ + qrencode \ rng-tools \ rpm-build \ sbsigntools \ @@ -58,14 +59,13 @@ RUN dnf -y install --setopt=install_weak_deps=False \ shfmt \ squashfs-tools \ strace \ - sudo \ systemd-boot-unsigned \ systemd-networkd \ systemd-resolved \ + systemd-ukify \ tar \ tcpdump \ tpm2-tools \ wget \ - which \ xz \ && dnf -y remove dracut --noautoremove && dnf -y update && dnf clean all diff --git a/test/container/Dockerfile-Gentoo b/test/container/Dockerfile-Gentoo index f2bb555..7b4eb2a 100644 --- a/test/container/Dockerfile-Gentoo +++ b/test/container/Dockerfile-Gentoo @@ -1,57 +1,59 @@ -ARG TAG=musl FROM docker.io/gentoo/portage:latest as portage -# uefi stub in a separate builder -FROM docker.io/gentoo/stage3 as efistub +FROM docker.io/gentoo/stage3:systemd COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -# systemd-boot -RUN echo 'sys-apps/systemd-utils boot' > /etc/portage/package.use/systemd-utils && \ - emerge -qv sys-apps/systemd-utils +# Speed-up using binpkgs +RUN echo "MAKEOPTS=\"-j$(nproc) -l$(nproc)\"" >> /etc/portage/make.conf +RUN echo "EMERGE_DEFAULT_OPTS=\"-j$(nproc) -l$(nproc)\"" >> /etc/portage/make.conf +RUN echo "FEATURES=\"getbinpkg binpkg-ignore-signature parallel-fetch parallel-install pkgdir-index-trusted\"" >> /etc/portage/make.conf -# kernel and its dependencies in a separate builder -FROM docker.io/gentoo/stage3:$TAG as kernel -COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -# disable initramfs generation, only need the kernel image itself -RUN echo 'sys-kernel/gentoo-kernel-bin -initramfs' > /etc/portage/package.use/kernel -RUN emerge -qv sys-kernel/gentoo-kernel-bin - -FROM docker.io/gentoo/stage3:$TAG -COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -COPY --from=kernel /boot /boot -COPY --from=kernel /lib/modules /lib/modules -COPY --from=efistub /usr/lib/systemd/boot/efi /usr/lib/systemd/boot/efi -ARG TAG +# systemd-boot, no need to install intramfs with kernel +RUN echo "USE=\"boot kernel-install -initramfs\"" >> /etc/portage/make.conf -MAINTAINER https://github.com/dracutdevs/dracut +# Use debian's installkernel +RUN echo 'sys-kernel/installkernel -systemd' >> /etc/portage/package.use/kernel -# required by sys-fs/dmraid -RUN echo 'sys-fs/lvm2 lvm thin' > /etc/portage/package.use/lvm2 +# Enable ukify and cryptsetup tools (includes unit generator for crypttab) +RUN echo 'sys-apps/systemd ukify cryptsetup' >> /etc/portage/package.use/systemd -# workaround for https://bugs.gentoo.org/734022 whereby Gentoo does not support NFS4 with musl -RUN if [[ "$TAG" == 'musl' ]]; then echo 'net-fs/nfs-utils -nfsv4' > /etc/portage/package.use/nfs-utils ; fi +# Support thin volumes and build all of LVM2 including daemons and tools like lvchange +RUN echo 'sys-fs/lvm2 thin lvm' >> /etc/portage/package.use/lvm2 -# workaround for packages do not compile on musl -# https://bugs.gentoo.org/713490 for tgt -# https://bugs.gentoo.org/908587 for open-iscsi -RUN if [[ "$TAG" != 'musl' ]]; then emerge -qv sys-block/tgt sys-block/open-iscsi ; fi - -# Install needed packages for the dracut CI container -RUN emerge -qv \ +RUN emerge --quiet --deep --autounmask-continue=y --with-bdeps=n \ + app-admin/rsyslog \ app-arch/cpio \ + app-crypt/tpm2-tools \ + app-crypt/sbsigntools \ app-emulation/qemu \ + app-misc/jq \ + app-portage/gentoolkit \ app-shells/dash \ + dev-lang/rust-bin \ + net-fs/cifs-utils \ net-fs/nfs-utils \ net-misc/dhcp \ + net-wireless/bluez \ + sys-apps/biosdevname \ sys-apps/busybox \ + sys-apps/nvme-cli \ + sys-apps/rng-tools \ + sys-apps/systemd \ sys-block/nbd \ + sys-block/open-iscsi \ sys-block/parted \ + sys-block/tgt \ sys-fs/btrfs-progs \ sys-fs/cryptsetup \ sys-fs/dmraid \ - sys-fs/lvm2 \ sys-fs/mdadm \ sys-fs/multipath-tools \ sys-fs/ntfs3g \ sys-fs/squashfs-tools \ + sys-kernel/gentoo-kernel-bin \ + sys-libs/libxcrypt \ + sys-libs/glibc \ + virtual/pkgconfig \ && rm -rf /var/cache/* /usr/share/doc/* /usr/share/man/* + +RUN emerge --depclean --with-bdeps=n diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest index 3e7cefc..a5fb7de 100644 --- a/test/container/Dockerfile-OpenSuse-latest +++ b/test/container/Dockerfile-OpenSuse-latest @@ -1,13 +1,52 @@ FROM registry.opensuse.org/opensuse/tumbleweed-dnf:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container RUN dnf -y install --setopt=install_weak_deps=False \ - dash asciidoc mdadm lvm2 dmraid cryptsetup nfs-utils nbd dhcp-server \ - strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \ - sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \ - tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \ - iscsiuio open-iscsi which ShellCheck shfmt procps pigz parted squashfs ntfsprogs \ - multipath-tools util-linux-systemd systemd-boot \ - && dnf -y remove dracut && dnf -y update && dnf clean all + asciidoc \ + bash-completion \ + btrfsprogs \ + bzip2 \ + cargo \ + cryptsetup \ + dash \ + dbus-broker \ + dhcp-client \ + dhcp-server \ + dmraid \ + e2fsprogs \ + gcc \ + git \ + iproute \ + iputils \ + iscsiuio \ + kbd \ + kernel \ + libkmod-devel \ + lvm2 \ + make \ + mdadm \ + nbd \ + NetworkManager \ + nfs-utils \ + open-iscsi \ + parted \ + pigz \ + procps \ + qemu-kvm \ + rng-tools \ + rpm-build \ + sbsigntools \ + ShellCheck \ + shfmt \ + squashfs \ + strace \ + systemd-boot \ + tar \ + tcpdump \ + tgt \ + tpm2.0-tools \ + /usr/bin/qemu-system-$(uname -m) \ + util-linux-systemd \ + wget \ + xz \ + && rpm -e --nodeps dracut && dnf -y update && dnf clean all diff --git a/test/container/Dockerfile-Ubuntu b/test/container/Dockerfile-Ubuntu index 0fb7f20..ef15a67 100644 --- a/test/container/Dockerfile-Ubuntu +++ b/test/container/Dockerfile-Ubuntu @@ -1,17 +1,17 @@ FROM docker.io/ubuntu:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container # The Linux kernel is only readable by root. See https://launchpad.net/bugs/759725 RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \ asciidoc \ astyle \ + bluez \ btrfs-progs \ busybox-static \ bzip2 \ ca-certificates \ + cargo \ console-setup \ cpio \ cryptsetup \ @@ -28,6 +28,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ iputils-ping \ isc-dhcp-client \ isc-dhcp-server \ + iscsiuio \ kmod \ less \ libdmraid-dev \ @@ -49,14 +50,17 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ pkg-config \ procps \ qemu-kvm \ + rng-tools5 \ + sbsigntool \ shellcheck \ squashfs-tools \ strace \ - sudo \ - systemd \ + systemd-boot-efi \ + systemd-ukify \ tcpdump \ tgt \ thin-provisioning-tools \ + tpm2-tools \ vim \ wget \ && apt-get clean \ diff --git a/test/container/Dockerfile-Void b/test/container/Dockerfile-Void new file mode 100644 index 0000000..99044c3 --- /dev/null +++ b/test/container/Dockerfile-Void @@ -0,0 +1,64 @@ +FROM ghcr.io/void-linux/void-glibc-full + +RUN xbps-install -Syu xbps && xbps-install -yu \ + asciidoc \ + astyle \ + base-devel \ + bash \ + binutils \ + bluez \ + btrfs-progs \ + busybox \ + cargo \ + cifs-utils \ + connman \ + cpio \ + cryptsetup \ + curl \ + dash \ + dhclient \ + dhcp \ + dmraid \ + dosfstools \ + e2fsprogs \ + edk2-ovmf \ + elfutils \ + eudev \ + f2fs-tools \ + git \ + glibc \ + gnupg \ + iputils \ + jq \ + kbd \ + libkmod-devel \ + linux \ + lvm2 \ + lzop \ + make \ + mdadm \ + mtools \ + nbd \ + NetworkManager \ + nfs-utils \ + ntfs-3g \ + nvme-cli \ + open-iscsi \ + openssh \ + parted \ + pigz \ + plymouth \ + qemu \ + rng-tools \ + sbsigntool \ + shellcheck \ + shfmt \ + squashfs-tools \ + strace \ + systemd-boot-efistub \ + tcpdump \ + tgt \ + tpm2-tools \ + ukify \ + xz \ + && rm -rf /var/cache/xbps diff --git a/test/container/Dockerfile-alpine b/test/container/Dockerfile-alpine new file mode 100644 index 0000000..4f28c95 --- /dev/null +++ b/test/container/Dockerfile-alpine @@ -0,0 +1,62 @@ +FROM docker.io/alpine:latest + +RUN apk add --no-cache \ + alpine-sdk \ + asciidoc \ + bash \ + binutils \ + blkid \ + btrfs-progs \ + busybox \ + bzip2 \ + cargo \ + coreutils \ + cpio \ + cryptsetup \ + curl \ + dash \ + dhclient \ + dmraid \ + dosfstools \ + e2fsprogs \ + eudev \ + findmnt \ + gawk \ + git \ + gpg \ + grep \ + iputils \ + kbd \ + kmod-dev \ + linux-virt \ + losetup \ + lvm2 \ + make \ + mdadm \ + mtools \ + multipath-tools \ + musl-fts-dev \ + nbd \ + ntfs-3g-progs \ + open-iscsi \ + openssh \ + parted \ + partx \ + pigz \ + procps \ + qemu-img \ + qemu-system-x86_64 \ + rng-tools \ + sed \ + sfdisk \ + squashfs-tools \ + sudo \ + util-linux-misc \ + xz + +RUN \ + cp /usr/lib/udev/rules.d/* /lib/udev/rules.d/ && \ + ln -sf /sbin/poweroff /sbin/shutdown && \ + ln -sf /usr/bin/dash /bin/dash && \ + ln -sf /bin/sh /usr/bin/sh && \ + ln -sf /boot/vmlinuz-virt /boot/vmlinuz-$(cd /lib/modules; ls -1 | tail -1) diff --git a/test/run-qemu b/test/run-qemu index 41d458a..149a407 100755 --- a/test/run-qemu +++ b/test/run-qemu @@ -4,6 +4,13 @@ export PATH=/usr/sbin:/usr/bin:/sbin:/bin ARCH="${ARCH-$(uname -m)}" + +case "$ARCH" in + amd64 | i?86 | x86_64) + QEMU_CPU="IvyBridge-v2" + ;; +esac + QEMU_CPU="${QEMU_CPU:-max}" [[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=(-cpu "$QEMU_CPU") @@ -36,7 +43,7 @@ case "$ARCH" in esac # Provide rng device sourcing the hosts /dev/urandom and other standard parameters -ARGS+=(-smp 2 -m 1024 -nodefaults -vga none -display none -no-reboot -device virtio-rng-pci) +ARGS+=(-smp 2 -m 1024 -nodefaults -vga none -display none -no-reboot -device i6300esb -watchdog-action poweroff -device virtio-rng-pci) if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then ARGS+=(-serial stdio) @@ -58,6 +65,8 @@ if ! [ -f "$VMLINUZ" ]; then VMLINUZ="/boot/vmlinuz-${KVERSION}" elif [ -f "/boot/vmlinux-${KVERSION}" ]; then VMLINUZ="/boot/vmlinux-${KVERSION}" + elif [ -f "/boot/kernel-${KVERSION}" ]; then + VMLINUZ="/boot/kernel-${KVERSION}" else echo "Could not find a Linux kernel version $KVERSION to test with!" >&2 echo "Please install linux." >&2 diff --git a/test/test-functions b/test/test-functions index f76d930..b664fb0 100644 --- a/test/test-functions +++ b/test/test-functions @@ -20,14 +20,20 @@ DRACUT=${DRACUT-${basedir}/dracut.sh} PKGLIBDIR=${PKGLIBDIR-$basedir} test_dracut() { - TEST_DRACUT_ARGS+=" --local --no-hostonly --no-early-microcode --add test --kver $KVERSION" + TEST_DRACUT_ARGS+=" --local --no-hostonly --no-hostonly-cmdline --no-early-microcode --add test --force --kver $KVERSION" + + # include $TESTDIR"/overlay if exists + if [ -d "$TESTDIR"/overlay ]; then + TEST_DRACUT_ARGS+=" --include $TESTDIR/overlay /" + fi # shellcheck disable=SC2162 IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS" - "$DRACUT" "$@" \ - --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ - "${TEST_DRACUT_ARGS_ARRAY[@]}" || return 1 + "$DRACUT" \ + --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot quiet rd.retry=10 rd.info rd.shell=0 selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ + "${TEST_DRACUT_ARGS_ARRAY[@]}" \ + "$@" || return 1 } command -v test_check &> /dev/null || test_check() { @@ -52,23 +58,14 @@ COLOR_FAILURE='\033[0;31m' COLOR_WARNING='\033[0;33m' COLOR_NORMAL='\033[0;39m' -check_root() { - if ((EUID != 0)); then - SETCOLOR_FAILURE - echo "Tests must be run as root! Please use 'sudo'." - SETCOLOR_NORMAL - exit 1 - fi -} - # generate qemu arguments for named raw disks # -# qemu_add_drive_args <index> <args> <filename> <id-name> [<bootindex>] +# qemu_add_drive <index> <args> <filename> <id-name> [<bootindex>] # # index: name of the index variable (set to 0 at start) # args: name of the argument array variable (set to () at start) # filename: filename of the raw disk image -# id-name: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/ata-disk_$name +# id-name: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_$name # size: optional file size in MiB (0 implies size is not set) # bootindex: optional bootindex number # @@ -81,13 +78,13 @@ check_root() { # ``` # declare -a disk_args=() # declare -i disk_index=0 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.ext3 root 0 1 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/client.img client -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk2.img iscsidisk2 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk3.img iscsidisk3 +# qemu_add_drive disk_index disk_args "$TESTDIR"/root.ext3 root 0 1 +# qemu_add_drive disk_index disk_args "$TESTDIR"/client.img client +# qemu_add_drive disk_index disk_args "$TESTDIR"/iscsidisk2.img iscsidisk2 +# qemu_add_drive disk_index disk_args "$TESTDIR"/iscsidisk3.img iscsidisk3 # qemu "${disk_args[@]}" # ``` -qemu_add_drive_args() { +qemu_add_drive() { local index=${!1} local file=$3 local name=${4:-$index} @@ -95,12 +92,13 @@ qemu_add_drive_args() { local bootindex=$6 if [ "${size}" -ne 0 ]; then - dd if=/dev/zero of="${file}" bs=1MiB count="${size}" + dd if=/dev/zero of="${file}" bs=1MiB count="${size}" status=none fi eval "${2}"'+=(' \ - -drive "if=none,format=raw,file=${file},id=drive-sata${index}" \ - -device "ide-hd,bus=ide.${index},drive=drive-sata${index},id=sata${index},${bootindex:+bootindex=$bootindex,}model=disk,serial=${name}" \ + -device "virtio-scsi-pci,id=scsi${index}" \ + -drive "if=none,format=raw,file=${file},id=drive-data${index}" \ + -device "scsi-hd,bus=scsi${index}.0,drive=drive-data${index},id=data${index},${bootindex:+bootindex=$bootindex,}serial=${name}" \ ')' # shellcheck disable=SC2219 @@ -108,7 +106,7 @@ qemu_add_drive_args() { } test_marker_reset() { - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 + dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 status=none } test_marker_check() { @@ -122,13 +120,11 @@ test_marker_check() { while (($# > 0)); do case $1 in --run) - check_root echo "TEST RUN: $TEST_DESCRIPTION" test_check && test_run exit $? ;; --setup) - check_root echo "TEST SETUP: $TEST_DESCRIPTION" test_check && test_setup exit $? @@ -141,7 +137,6 @@ while (($# > 0)); do exit $? ;; --all) - check_root if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_WARNING" "[SKIPPED]" "$COLOR_NORMAL" exit 0 |