summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:33:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:33:11 +0000
commit203af7302854f453fa4a05ecefd4403b6c8a4f8d (patch)
tree967fdacafe332baabd12b57725505c138d0f3bbf /test
parentAdding upstream version 102. (diff)
downloaddracut-upstream/103.tar.xz
dracut-upstream/103.zip
Adding upstream version 103.upstream/103upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile1
-rwxr-xr-xtest/TEST-01-BASIC/test.sh6
-rwxr-xr-xtest/TEST-02-SYSTEMD/test.sh6
-rwxr-xr-xtest/TEST-03-USR-MOUNT/test.sh6
-rwxr-xr-xtest/TEST-04-FULL-SYSTEMD/create-root.sh26
-rw-r--r--test/TEST-04-FULL-SYSTEMD/fstab2
-rwxr-xr-xtest/TEST-04-FULL-SYSTEMD/test-init.sh4
-rwxr-xr-xtest/TEST-04-FULL-SYSTEMD/test.sh40
-rwxr-xr-xtest/TEST-10-RAID/test.sh14
-rwxr-xr-xtest/TEST-11-LVM/test.sh6
-rwxr-xr-xtest/TEST-12-RAID-DEG/test.sh19
-rwxr-xr-xtest/TEST-13-ENC-RAID-LVM/test.sh12
-rwxr-xr-xtest/TEST-14-IMSM/test.sh6
-rwxr-xr-xtest/TEST-15-BTRFSRAID/test.sh6
-rwxr-xr-xtest/TEST-16-DMSQUASH/create-root.sh12
-rwxr-xr-xtest/TEST-16-DMSQUASH/test.sh44
-rwxr-xr-xtest/TEST-17-LVM-THIN/test.sh6
-rwxr-xr-xtest/TEST-18-UEFI/test.sh4
-rwxr-xr-xtest/TEST-20-NFS/client-init.sh6
-rw-r--r--test/TEST-20-NFS/hosts5
-rwxr-xr-xtest/TEST-20-NFS/test.sh11
-rwxr-xr-xtest/TEST-30-ISCSI/client-init.sh2
-rw-r--r--test/TEST-30-ISCSI/hosts8
-rwxr-xr-xtest/TEST-30-ISCSI/test.sh17
-rwxr-xr-xtest/TEST-35-ISCSI-MULTI/client-init.sh2
-rw-r--r--test/TEST-35-ISCSI-MULTI/hosts8
-rwxr-xr-xtest/TEST-35-ISCSI-MULTI/test.sh25
-rwxr-xr-xtest/TEST-40-NBD/client-init.sh2
-rw-r--r--test/TEST-40-NBD/hosts8
-rwxr-xr-xtest/TEST-40-NBD/test.sh42
-rwxr-xr-xtest/TEST-50-MULTINIC/client-init.sh2
-rw-r--r--test/TEST-50-MULTINIC/hosts5
-rwxr-xr-xtest/TEST-50-MULTINIC/test.sh9
-rw-r--r--test/TEST-60-BONDBRIDGEVLAN/hosts5
-rwxr-xr-xtest/TEST-60-BONDBRIDGEVLAN/test.sh6
-rwxr-xr-xtest/TEST-98-GETARG/test.sh7
-rw-r--r--test/container/Dockerfile-Arch1
-rw-r--r--test/container/Dockerfile-Debian2
-rw-r--r--test/container/Dockerfile-Fedora-latest1
-rw-r--r--test/container/Dockerfile-Gentoo2
-rw-r--r--test/container/Dockerfile-OpenSuse-latest2
-rw-r--r--test/container/Dockerfile-Ubuntu2
-rw-r--r--test/container/Dockerfile-Void1
-rw-r--r--test/container/Dockerfile-alpine1
-rwxr-xr-xtest/run-qemu14
-rw-r--r--test/test-functions30
46 files changed, 234 insertions, 212 deletions
diff --git a/test/Makefile b/test/Makefile
index 518e7d6..c19f0c2 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -19,4 +19,3 @@ clean:
done
all:
-
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 252c3f9..78fa730 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -14,7 +14,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append 'rw "root=LABEL= rdinit=/bin/sh" rd.retry=3' \
+ -append "$TEST_KERNEL_CMDLINE rw \"root=LABEL= rdinit=/bin/sh\" rd.retry=3" \
-initrd "$TESTDIR"/initramfs.testing || return 1
test_marker_check || return 1
@@ -32,7 +32,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "test-makeroot" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay
@@ -45,7 +45,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
index 4d48fd2..0a7d05a 100755
--- a/test/TEST-02-SYSTEMD/test.sh
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -17,7 +17,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=LABEL=dracut rw systemd.log_target=console rd.retry=3 init=/sbin/init" \
+ -append "$TEST_KERNEL_CMDLINE 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
@@ -35,7 +35,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "test-makeroot" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
--nomdadmconf \
--no-hostonly-cmdline -N \
@@ -50,7 +50,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index c64a582..22e9d4d 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -22,7 +22,7 @@ client_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=LABEL=dracut $client_opts rd.retry=3" \
+ -append "$TEST_KERNEL_CMDLINE root=LABEL=dracut $client_opts rd.retry=3" \
-initrd "$TESTDIR"/initramfs.testing || return 1
if ! test_marker_check; then
@@ -51,7 +51,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "test-makeroot" \
-I "mkfs.btrfs" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
@@ -67,7 +67,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
if ! test_marker_check dracut-root-block-created; then
diff --git a/test/TEST-04-FULL-SYSTEMD/create-root.sh b/test/TEST-04-FULL-SYSTEMD/create-root.sh
index 734f377..0436c18 100755
--- a/test/TEST-04-FULL-SYSTEMD/create-root.sh
+++ b/test/TEST-04-FULL-SYSTEMD/create-root.sh
@@ -13,21 +13,37 @@ set -e
udevadm settle
modprobe btrfs || :
mkfs.btrfs -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
+printf test > keyfile
+cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_crypt /keyfile
+cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_crypt dracut_crypt_test < /keyfile
+mkfs.btrfs -q -L dracut_crypt /dev/mapper/dracut_crypt_test
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/mapper/dracut_crypt_test
btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr
-mkdir -p /root
+mkdir -p /root /root_crypt
mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
+mount -t btrfs /dev/mapper/dracut_crypt_test /root_crypt
[ -d /root/usr ] || mkdir -p /root/usr
+[ -d /root-crypt/usr ] || mkdir -p /root_crypt/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/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr
+mount --bind /root/usr /root_crypt/usr
cp -a -t /root /source/*
-mkdir -p /root/run
+cp -a -t /root_crypt /source/*
+mkdir -p /root/run /root_crypt/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/scsi-0QEMU_QEMU_HARDDISK_marker status=none
+btrfs filesystem sync /root_crypt/usr
+btrfs filesystem sync /root_crypt
+umount /root/usr /root_crypt/usr
+umount /root /root_crypt
+cryptsetup luksClose /dev/mapper/dracut_crypt_test
+eval "$(udevadm info --query=property --name=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_crypt | 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/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
deleted file mode 100644
index 114f945..0000000
--- a/test/TEST-04-FULL-SYSTEMD/fstab
+++ /dev/null
@@ -1,2 +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 eeec8a2..c60c0ff 100755
--- a/test/TEST-04-FULL-SYSTEMD/test-init.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test-init.sh
@@ -5,7 +5,7 @@ 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
+systemctl --failed --no-legend --no-pager > /run/failed
ismounted() {
findmnt "$1" > /dev/null 2>&1
@@ -14,7 +14,7 @@ ismounted() {
if ! ismounted /usr; then
echo "**************************FAILED**************************"
echo "/usr not mounted!!"
- cat /proc/mounts >> /failed
+ cat /proc/mounts >> /run/failed
echo "**************************FAILED**************************"
fi
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
index afd7645..c9a0826 100755
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
@@ -10,7 +10,6 @@ test_check() {
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break"
#DEBUGOUT="quiet systemd.log_level=debug systemd.log_target=console loglevel=77 rd.info rd.debug"
-DEBUGOUT="loglevel=0 "
client_run() {
local test_name="$1"
shift
@@ -22,12 +21,13 @@ client_run() {
declare -i disk_index=0
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"/root_crypt.btrfs root_crypt
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 rd.multipath=0 root=LABEL=dracut $client_opts rd.retry=3 $DEBUGOUT" \
+ -append "$TEST_KERNEL_CMDLINE systemd.unit=testsuite.target systemd.mask=systemd-firstboot systemd.mask=systemd-vconsole-setup root=LABEL=dracut mount.usr=LABEL=dracutusr mount.usrfstype=btrfs mount.usrflags=subvol=usr,ro $client_opts rd.retry=3 $DEBUGOUT" \
-initrd "$TESTDIR"/initramfs.testing || return 1
if ! test_marker_check; then
@@ -35,13 +35,23 @@ client_run() {
return 1
fi
echo "CLIENT TEST END: $test_name [OK]"
-
}
test_run() {
client_run "no option specified" || return 1
client_run "readonly root" "ro" || return 1
client_run "writeable root" "rw" || return 1
+
+ # volatile mode
+ client_run "volatile=overlayfs root" "systemd.volatile=overlayfs" || return 1
+ client_run "volatile=state root" "systemd.volatile=state" || return 1
+
+ # shellcheck source=$TESTDIR/luks.uuid
+ . "$TESTDIR"/luks.uuid
+
+ # luks
+ client_run "encrypted root with rd.luks.uuid" "root=LABEL=dracut_crypt rd.luks.uuid=$ID_FS_UUID rd.luks.key=/etc/key" || return 1
+ client_run "encrypted root with rd.luks.name" "root=/dev/mapper/crypt rd.luks.name=$ID_FS_UUID=crypt rd.luks.key=/etc/key" || return 1
return 0
}
@@ -55,8 +65,6 @@ test_setup() {
-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 \
-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
@@ -117,8 +125,8 @@ EOF
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash btrfs" \
- -I "mkfs.btrfs" \
+ -a "test-makeroot btrfs" \
+ -I "mkfs.btrfs cryptsetup" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay/*
@@ -129,26 +137,22 @@ EOF
declare -i disk_index=0
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"/root_crypt.btrfs root_crypt 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 \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
+ test_marker_check dracut-root-block-created || return 1
- if ! test_marker_check dracut-root-block-created; then
- echo "Could not create root filesystem"
- return 1
- fi
-
- [ -e /etc/machine-id ] && EXTRA_MACHINE="/etc/machine-id"
- [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info"
+ grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img > "$TESTDIR"/luks.uuid
+ echo -n test > /tmp/key
test_dracut \
- -a "systemd i18n qemu" \
- -d "btrfs" \
- ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \
+ -m "btrfs dracut-systemd i18n systemd-ac-power systemd-coredump systemd-creds systemd-cryptsetup systemd-integritysetup systemd-ldconfig systemd-pcrphase systemd-pstore systemd-repart systemd-sysext systemd-veritysetup" \
+ -i "/tmp/key" "/etc/key" \
"$TESTDIR"/initramfs.testing
rm -rf -- "$TESTDIR"/overlay
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 0a2d094..17d2c68 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -16,7 +16,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rd.auto rw" \
+ -append "$TEST_KERNEL_CMDLINE root=/dev/dracut/root rd.auto rw" \
-initrd "$TESTDIR"/initramfs.testing || return 1
test_marker_check || return 1
@@ -33,8 +33,8 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash crypt lvm mdraid kernel-modules" \
- -I "grep" \
+ -a "test-makeroot bash crypt lvm mdraid kernel-modules" \
+ -I "grep cryptsetup" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay
@@ -43,13 +43,13 @@ test_setup() {
declare -a disk_args=()
declare -i disk_index=0
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
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 80
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 80
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 80
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/cannotreach rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/cannotreach rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-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)"
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index fb76ab9..dcbf96b 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -17,7 +17,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rd.auto=1 rd.retry=3" \
+ -append "$TEST_KERNEL_CMDLINE root=/dev/dracut/root rw rd.auto=1 rd.retry=3" \
-initrd "$TESTDIR"/initramfs.testing || return 1
test_marker_check || return 1
@@ -35,7 +35,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash lvm mdraid kernel-modules" \
+ -a "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
@@ -51,7 +51,7 @@ test_setup() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index 5c1b94e..be6cb73 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -21,7 +21,7 @@ client_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "$* systemd.log_target=kmsg root=LABEL=root rw log_buf_len=2M" \
+ -append "$TEST_KERNEL_CMDLINE $* systemd.log_target=kmsg root=LABEL=root rw log_buf_len=2M systemd.mask=systemd-vconsole-setup" \
-initrd "$TESTDIR"/initramfs.testing
if ! test_marker_check; then
@@ -55,7 +55,7 @@ test_run() {
}
test_setup() {
- "$basedir"/dracut.sh -N -l --keep --tmpdir "$TESTDIR" \
+ "$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.*
@@ -65,8 +65,8 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash crypt lvm mdraid kernel-modules" \
- -I "grep" \
+ -a "test-makeroot bash crypt lvm mdraid kernel-modules" \
+ -I "grep cryptsetup" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay
@@ -75,13 +75,13 @@ test_setup() {
declare -a disk_args=()
declare -i disk_index=0
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
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 80
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 80
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 80
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
@@ -97,7 +97,8 @@ test_setup() {
chmod 0600 /tmp/key
test_dracut \
- -m "crypt lvm mdraid" \
+ -a "crypt lvm mdraid" \
+ -o "systemd" \
-i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \
-i "/tmp/mdadm.conf" "/etc/mdadm.conf" \
-i "/tmp/crypttab" "/etc/crypttab" \
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index 5129bcc..b3e5291 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -22,7 +22,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rd.auto rd.retry=20 rootwait $LUKSARGS" \
+ -append "$TEST_KERNEL_CMDLINE root=/dev/dracut/root ro rd.auto rd.retry=20 rootwait $LUKSARGS" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
echo "CLIENT TEST END: [OK]"
@@ -32,7 +32,7 @@ test_run() {
echo "CLIENT TEST START: Any LUKS"
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rd.auto rd.retry=20" \
+ -append "$TEST_KERNEL_CMDLINE root=/dev/dracut/root rw rd.auto rd.retry=20" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
echo "CLIENT TEST END: [OK]"
@@ -42,7 +42,7 @@ test_run() {
echo "CLIENT TEST START: Wrong LUKS UUID"
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rd.auto rd.luks.uuid=failme" \
+ -append "$TEST_KERNEL_CMDLINE 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]"
@@ -63,8 +63,8 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash crypt lvm mdraid kernel-modules" \
- -I "grep" \
+ -a "test-makeroot bash crypt lvm mdraid kernel-modules" \
+ -I "grep cryptsetup" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay
@@ -79,7 +79,7 @@ test_setup() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
cryptoUUIDS=$(grep -F --binary-files=text -m 3 ID_FS_UUID "$TESTDIR"/marker.img)
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index fc3e429..3d43154 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -18,7 +18,7 @@ client_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "$* root=LABEL=root rw rd.retry=5" \
+ -append "$TEST_KERNEL_CMDLINE $* root=LABEL=root rw rd.retry=5" \
-initrd "$TESTDIR"/initramfs.testing || return 1
if ! test_marker_check; then
@@ -60,7 +60,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash lvm mdraid dmraid kernel-modules" \
+ -a "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" \
-I "grep sfdisk realpath" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
@@ -77,7 +77,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)"
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index 2745950..2d8c9d9 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -16,7 +16,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=LABEL=root rw rd.retry=3" \
+ -append "$TEST_KERNEL_CMDLINE root=LABEL=root rw rd.retry=3" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
}
@@ -38,7 +38,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash btrfs rootfs-block kernel-modules" \
+ -a "test-makeroot bash btrfs rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-I "mkfs.btrfs" \
-i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
@@ -58,7 +58,7 @@ test_setup() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
diff --git a/test/TEST-16-DMSQUASH/create-root.sh b/test/TEST-16-DMSQUASH/create-root.sh
index b424a1a..042d974 100755
--- a/test/TEST-16-DMSQUASH/create-root.sh
+++ b/test/TEST-16-DMSQUASH/create-root.sh
@@ -27,6 +27,18 @@ cp -a -t /root /source/*
echo "Creating squashfs"
mksquashfs /source /root/testdir/rootfs.img -quiet
+# Write the erofs compressed filesystem to the partition
+if [ -e "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_erofs" ]; then
+ sfdisk /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_erofs << EOF
+2048,161792
+EOF
+
+ udevadm settle
+
+ echo "Creating erofs"
+ mkfs.erofs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_erofs-part1 /source
+fi
+
# Copy rootfs.img to the NTFS drive if exists
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
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
index 6087ccd..4245c20 100755
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -12,6 +12,11 @@ test_run() {
qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker
qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root
+ # erofs drive
+ if modprobe erofs &> /dev/null && command -v mkfs.erofs &> /dev/null; then
+ qemu_add_drive disk_index disk_args "$TESTDIR"/root_erofs.img root_erofs
+ fi
+
# NTFS drive
if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then
qemu_add_drive disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs
@@ -21,16 +26,28 @@ test_run() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
-boot order=d \
- -append "rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut" \
+ -append "$TEST_KERNEL_CMDLINE rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
+ # Run the erofs test only if mkfs.ntfs is available
+ if modprobe erofs &> /dev/null && command -v mkfs.erofs &> /dev/null; then
+ test_marker_reset
+ "$testdir"/run-qemu \
+ "${disk_args[@]}" \
+ -boot order=d \
+ -append "$TEST_KERNEL_CMDLINE rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_erofs-part1" \
+ -initrd "$TESTDIR"/initramfs.testing
+
+ test_marker_check || return 1
+ fi
+
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
-boot order=d \
- -append "rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut" \
+ -append "$TEST_KERNEL_CMDLINE rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
@@ -39,7 +56,7 @@ 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" \
+ -append "$TEST_KERNEL_CMDLINE rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
@@ -50,7 +67,7 @@ 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_ntfs quiet rd.info rd.shell=0" \
+ -append "$TEST_KERNEL_CMDLINE rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs" \
-initrd "$TESTDIR"/initramfs.testing
test_marker_check || return 1
@@ -63,7 +80,7 @@ test_run() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
-boot order=d \
- -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" \
+ -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 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]')
@@ -92,8 +109,8 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- --modules "test-makeroot" \
- --install "sfdisk mkfs.ntfs mksquashfs" \
+ --add "test-makeroot" \
+ --install "sfdisk mkfs.ntfs mksquashfs mkfs.erofs" \
--drivers "ntfs3" \
--include ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
--force "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
@@ -105,6 +122,11 @@ test_setup() {
qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 160
+ # erofs drive
+ if modprobe erofs &> /dev/null && command -v mkfs.erofs &> /dev/null; then
+ qemu_add_drive disk_index disk_args "$TESTDIR"/root_erofs.img root_erofs 160
+ fi
+
# 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
@@ -114,7 +136,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
if ! test_marker_check dracut-root-block-created; then
@@ -128,14 +150,16 @@ SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
EOF
test_dracut \
- --modules "dash dmsquash-live qemu" \
+ --add "dash dmsquash-live qemu" \
+ --omit "systemd" \
--drivers "ntfs3" \
--install "mkfs.ext4" \
--include /tmp/ntfs3.rules /lib/udev/rules.d/ntfs3.rules \
"$TESTDIR"/initramfs.testing
test_dracut \
- --modules "dmsquash-live-autooverlay qemu" \
+ --add "dmsquash-live-autooverlay qemu" \
+ --omit "systemd" \
--install "mkfs.ext4" \
"$TESTDIR"/initramfs.testing-autooverlay
diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh
index 9326433..0cc9c1f 100755
--- a/test/TEST-17-LVM-THIN/test.sh
+++ b/test/TEST-17-LVM-THIN/test.sh
@@ -16,7 +16,7 @@ test_run() {
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rd.auto=1 rd.driver.pre=dm_thin_pool rd.retry=3" \
+ -append "$TEST_KERNEL_CMDLINE 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
}
@@ -35,7 +35,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot bash lvm mdraid kernel-modules" \
+ -a "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
@@ -52,7 +52,7 @@ test_setup() {
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
diff --git a/test/TEST-18-UEFI/test.sh b/test/TEST-18-UEFI/test.sh
index 769a0e3..7e75590 100755
--- a/test/TEST-18-UEFI/test.sh
+++ b/test/TEST-18-UEFI/test.sh
@@ -44,7 +44,7 @@ test_setup() {
mkdir -p "$TESTDIR"/ESP/EFI/BOOT
test_dracut \
- --modules 'rootfs-block' \
+ --add 'rootfs-block' \
--kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \
--drivers 'squashfs' \
--uefi \
@@ -52,7 +52,7 @@ test_setup() {
test_dracut \
--hostonly \
- --modules 'rootfs-block' \
+ --add 'rootfs-block' \
--kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \
--drivers 'squashfs' \
--uefi \
diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh
index 04fb6a7..f50d0e2 100755
--- a/test/TEST-20-NFS/client-init.sh
+++ b/test/TEST-20-NFS/client-init.sh
@@ -13,13 +13,13 @@ stty sane
if getargbool 0 rd.shell; then
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
+ setsid ${CTTY:+"${CTTY}"} sh -i
fi
echo "made it to the rootfs! Powering down."
while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
- [ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue
+ [ "$fstype" != "nfs" ] && [ "$fstype" != "nfs4" ] && continue
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
@@ -31,7 +31,7 @@ if grep -qF 'rd.live.overlay' /proc/cmdline; then
fi
fi
-if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then
+if [ "$fstype" = "nfs" ] || [ "$fstype" = "nfs4" ]; then
serverip=${dev%:*}
path=${dev#*:}
diff --git a/test/TEST-20-NFS/hosts b/test/TEST-20-NFS/hosts
deleted file mode 100644
index 36be908..0000000
--- a/test/TEST-20-NFS/hosts
+++ /dev/null
@@ -1,5 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.2 server-ip
-192.168.50.3 server-proto-ip
-192.168.50.101 workstation2
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 1be5a73..efbfcf3 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -25,7 +25,7 @@ run_server() {
-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"}" \
- -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
+ -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 $SERVER_DEBUG" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 "$TESTDIR"/server.pid || return 1
@@ -66,7 +66,7 @@ client_test() {
"${disk_args[@]}" \
-net nic,macaddr="$mac",model=e1000 \
-net socket,connect=127.0.0.1:12320 \
- -append "$cmdline ro" \
+ -append "$TEST_KERNEL_CMDLINE $cmdline ro" \
-initrd "$TESTDIR"/initramfs.testing
# shellcheck disable=SC2181
@@ -267,7 +267,6 @@ test_setup() {
instmods nfsd sunrpc ipv6 lockd af_packet
inst ./server-init.sh /sbin/init
inst_simple /etc/os-release
- inst ./hosts /etc/hosts
inst ./exports /etc/exports
inst ./dhcpd.conf /etc/dhcpd.conf
inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
@@ -366,7 +365,7 @@ test_setup() {
# 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"/server/overlay / \
- -m "bash rootfs-block kernel-modules qemu" \
+ -a "bash rootfs-block kernel-modules qemu" \
-d "piix ide-gd_mod ata_piix ext4 sd_mod" \
--nomdadmconf \
--no-hostonly-cmdline -N \
@@ -382,7 +381,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
@@ -416,7 +415,7 @@ test_setup() {
)
# Make server's dracut image
"$DRACUT" -l -i "$TESTDIR"/overlay / \
- -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \
+ -a "bash rootfs-block debug kernel-modules watchdog qemu ${USE_NETWORK}" \
-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 d7f1370..ab70d17 100755
--- a/test/TEST-30-ISCSI/client-init.sh
+++ b/test/TEST-30-ISCSI/client-init.sh
@@ -17,7 +17,7 @@ done < /proc/mounts
if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
+ setsid ${CTTY:+"${CTTY}"} sh -i
fi
sync
diff --git a/test/TEST-30-ISCSI/hosts b/test/TEST-30-ISCSI/hosts
deleted file mode 100644
index f8c18b6..0000000
--- a/test/TEST-30-ISCSI/hosts
+++ /dev/null
@@ -1,8 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.2 server-ip
-192.168.50.3 server-proto-ip
-192.168.50.100 workstation1
-192.168.50.101 workstation2
-192.168.50.102 workstation3
-192.168.50.103 workstation4
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index f4bf33e..ca56a9d 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -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/scsi-0QEMU_QEMU_HARDDISK_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 $SERVER_DEBUG" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 "$TESTDIR"/server.pid || return 1
@@ -62,7 +62,7 @@ run_client() {
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
-acpitable file=ibft.table \
- -append "$*" \
+ -append "$TEST_KERNEL_CMDLINE $*" \
-initrd "$TESTDIR"/initramfs.testing
# shellcheck disable=SC2181
@@ -149,7 +149,7 @@ test_setup() {
# 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" \
+ -a "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 \
@@ -166,20 +166,19 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
# Create what will eventually be the server root filesystem onto an overlay
"$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
- -m "test-root network-legacy" \
+ -m "test-root ${USE_NETWORK}" \
-d "iscsi_tcp crc32c ipv6" \
-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 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" \
-f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.*
@@ -192,7 +191,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "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
@@ -206,14 +205,14 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
# Make server's dracut image
"$DRACUT" -l \
- -a "dash rootfs-block test kernel-modules network-legacy" \
+ -a "dash rootfs-block test kernel-modules ${USE_NETWORK}" \
-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 \
diff --git a/test/TEST-35-ISCSI-MULTI/client-init.sh b/test/TEST-35-ISCSI-MULTI/client-init.sh
index d7f1370..ab70d17 100755
--- a/test/TEST-35-ISCSI-MULTI/client-init.sh
+++ b/test/TEST-35-ISCSI-MULTI/client-init.sh
@@ -17,7 +17,7 @@ done < /proc/mounts
if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
+ setsid ${CTTY:+"${CTTY}"} sh -i
fi
sync
diff --git a/test/TEST-35-ISCSI-MULTI/hosts b/test/TEST-35-ISCSI-MULTI/hosts
deleted file mode 100644
index f8c18b6..0000000
--- a/test/TEST-35-ISCSI-MULTI/hosts
+++ /dev/null
@@ -1,8 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.2 server-ip
-192.168.50.3 server-proto-ip
-192.168.50.100 workstation1
-192.168.50.101 workstation2
-192.168.50.102 workstation3
-192.168.50.103 workstation4
diff --git a/test/TEST-35-ISCSI-MULTI/test.sh b/test/TEST-35-ISCSI-MULTI/test.sh
index f807798..20fc7b0 100755
--- a/test/TEST-35-ISCSI-MULTI/test.sh
+++ b/test/TEST-35-ISCSI-MULTI/test.sh
@@ -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/scsi-0QEMU_QEMU_HARDDISK_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 $SERVER_DEBUG" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 "$TESTDIR"/server.pid || return 1
@@ -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 "rw rd.auto rd.retry=50 $*" \
+ -append "$TEST_KERNEL_CMDLINE 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]"
@@ -163,7 +163,7 @@ test_setup() {
# 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" \
+ -a "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 \
@@ -173,28 +173,27 @@ test_setup() {
declare -a disk_args=()
declare -i disk_index=0
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
+ qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 800
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 400
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 400
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
rm -rf -- "$TESTDIR"/overlay
"$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
- -m "test-root network-legacy iscsi" \
+ -m "test-root ${USE_NETWORK} 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.*
@@ -207,7 +206,7 @@ test_setup() {
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "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
@@ -215,12 +214,12 @@ test_setup() {
declare -a disk_args=()
declare -i disk_index=0
qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120
+ 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 \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
@@ -233,7 +232,7 @@ test_setup() {
# Make server's dracut image
"$DRACUT" -l -i "$TESTDIR"/overlay / \
- -a "test dash rootfs-block debug kernel-modules network-legacy" \
+ -a "test dash rootfs-block debug kernel-modules ${USE_NETWORK}" \
-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" \
diff --git a/test/TEST-40-NBD/client-init.sh b/test/TEST-40-NBD/client-init.sh
index 9de7436..b8637f0 100755
--- a/test/TEST-40-NBD/client-init.sh
+++ b/test/TEST-40-NBD/client-init.sh
@@ -20,7 +20,7 @@ echo "made it to the rootfs! Powering down."
if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
+ setsid ${CTTY:+"${CTTY}"} sh -i
fi
mount -n -o remount,ro /
diff --git a/test/TEST-40-NBD/hosts b/test/TEST-40-NBD/hosts
deleted file mode 100644
index f8c18b6..0000000
--- a/test/TEST-40-NBD/hosts
+++ /dev/null
@@ -1,8 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.2 server-ip
-192.168.50.3 server-proto-ip
-192.168.50.100 workstation1
-192.168.50.101 workstation2
-192.168.50.102 workstation3
-192.168.50.103 workstation4
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index e935f53..a8efabe 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -37,7 +37,7 @@ run_server() {
-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/scsi-0QEMU_QEMU_HARDDISK_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 $SERVER_DEBUG" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 "$TESTDIR"/server.pid || return 1
@@ -80,11 +80,11 @@ client_test() {
"${disk_args[@]}" \
-net nic,macaddr="$mac",model=e1000 \
-net socket,connect=127.0.0.1:12340 \
- -append "$cmdline rd.auto ro" \
+ -append "$cmdline rd.auto ro console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.testing
# shellcheck disable=SC2181
- if [[ $? -ne 0 ]] || ! test_marker_check nbd-OK "$TESTDIR"/marker.img; then
+ if [[ $? -ne 0 ]] || ! test_marker_check nbd-OK; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
return 1
fi
@@ -120,7 +120,9 @@ test_run() {
return 1
fi
client_run
+ local res="$?"
kill_server
+ return "$res"
}
client_run() {
@@ -145,23 +147,22 @@ client_run() {
client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
"root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" || return 1
- client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype" \
- 52:54:00:12:34:02 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 || return 1
+ # BROKEN
+ #client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype" \
+ # 52:54:00:12:34:02 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 || return 1
client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port::fsopts" \
52:54:00:12:34:03 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext4 errors=panic || return 1
- client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
- 52:54:00:12:34:04 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 errors=panic || return 1
+ # BROKEN
+ #client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
+ # 52:54:00:12:34:04 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 errors=panic || return 1
# netroot handling
client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \
"root=LABEL=dracut netroot=nbd:192.168.50.1:raw ip=dhcp rd.luks=0" || return 1
- client_test "NBD root=/dev/root netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
- 52:54:00:12:34:04 "root=/dev/root netroot=dhcp ip=dhcp rd.luks=0" ext2 errors=panic || return 1
-
# Encrypted root handling via LVM/LUKS over NBD
# shellcheck source=$TESTDIR/luks.uuid
@@ -203,7 +204,8 @@ make_encrypted_root() {
# 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" \
+ -a "test-makeroot crypt lvm mdraid" \
+ -I "cryptsetup" \
-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
@@ -217,7 +219,7 @@ make_encrypted_root() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img > "$TESTDIR"/luks.uuid
@@ -240,7 +242,7 @@ make_client_root() {
# 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" \
+ -a "test-makeroot" \
-i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \
--nomdadmconf \
--no-hostonly-cmdline -N \
@@ -254,7 +256,7 @@ make_client_root() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -fr "$TESTDIR"/overlay
@@ -276,14 +278,12 @@ bs = 4096
EOF
"$DRACUT" -l --keep --tmpdir "$TESTDIR" \
- -m "test-root network-legacy" \
- -d "nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan" \
+ -a "test-root ${USE_NETWORK}" \
-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
@@ -297,7 +297,7 @@ EOF
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -m "test-makeroot" \
+ -a "test-makeroot ${USE_NETWORK}" \
-i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
--nomdadmconf \
--no-hostonly-cmdline -N \
@@ -306,12 +306,12 @@ EOF
declare -a disk_args=()
declare -i disk_index=0
qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240
+ qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 480
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -fr "$TESTDIR"/overlay
@@ -340,7 +340,7 @@ test_setup() {
"$TESTDIR"/initramfs.testing
"$DRACUT" -N -l -i "$TESTDIR"/overlay / \
- -a "test rootfs-block debug kernel-modules network-legacy" \
+ -a "test rootfs-block debug kernel-modules ${USE_NETWORK}" \
-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" \
diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh
index 8495913..09db5b3 100755
--- a/test/TEST-50-MULTINIC/client-init.sh
+++ b/test/TEST-50-MULTINIC/client-init.sh
@@ -23,7 +23,7 @@ for i in /sys/class/net/*; do
done
for i in /run/initramfs/net.*.did-setup; do
- # booting with network-legacy module
+ # booting with network module
[ -f "$i" ] || continue
strglobin "$i" ":*:*:*:*:" && continue
i=${i%.did-setup}
diff --git a/test/TEST-50-MULTINIC/hosts b/test/TEST-50-MULTINIC/hosts
deleted file mode 100644
index d02a4e9..0000000
--- a/test/TEST-50-MULTINIC/hosts
+++ /dev/null
@@ -1,5 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.100 client-if1
-192.168.50.101 client-if2
-192.168.50.102 client-if3
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index e2aa5a3..71a6271 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -26,7 +26,7 @@ run_server() {
-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"}" \
- -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \
+ -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
@@ -76,7 +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 \
- -append "$cmdline rd.retry=5 ro init=/sbin/init systemd.log_target=console" \
+ -append "$TEST_KERNEL_CMDLINE $cmdline rd.retry=5 ro init=/sbin/init systemd.log_target=console" \
-initrd "$TESTDIR"/initramfs.testing || return 1
{
@@ -208,7 +208,6 @@ test_setup() {
instmods nfsd sunrpc ipv6 lockd af_packet
inst ./server-init.sh /sbin/init
inst_simple /etc/os-release
- inst ./hosts /etc/hosts
inst ./exports /etc/exports
inst ./dhcpd.conf /etc/dhcpd.conf
inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
@@ -319,7 +318,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
@@ -355,7 +354,7 @@ test_setup() {
)
# Make server's dracut image
"$DRACUT" -l -i "$TESTDIR"/overlay / \
- -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \
+ -m "bash rootfs-block debug kernel-modules watchdog qemu ${USE_NETWORK}" \
-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/hosts b/test/TEST-60-BONDBRIDGEVLAN/hosts
deleted file mode 100644
index d02a4e9..0000000
--- a/test/TEST-60-BONDBRIDGEVLAN/hosts
+++ /dev/null
@@ -1,5 +0,0 @@
-127.0.0.1 localhost
-192.168.50.1 server
-192.168.50.100 client-if1
-192.168.50.101 client-if2
-192.168.50.102 client-if3
diff --git a/test/TEST-60-BONDBRIDGEVLAN/test.sh b/test/TEST-60-BONDBRIDGEVLAN/test.sh
index be4cb6d..2ac6d63 100755
--- a/test/TEST-60-BONDBRIDGEVLAN/test.sh
+++ b/test/TEST-60-BONDBRIDGEVLAN/test.sh
@@ -49,7 +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"}" \
- -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \
+ -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 -- "$TESTDIR"/server.pid || return 1
@@ -92,6 +92,7 @@ client_test() {
-netdev hubport,id=n5,hubid=1 -device virtio-net-pci,mac=52:54:00:12:34:05,netdev=n5 \
-hda "$TESTDIR"/client.img \
-append "
+ $TEST_KERNEL_CMDLINE
ifname=net1:52:54:00:12:34:01
ifname=net2:52:54:00:12:34:02
ifname=net3:52:54:00:12:34:03
@@ -246,7 +247,6 @@ test_setup() {
instmods nfsd sunrpc ipv6 lockd af_packet 8021q bonding
inst_simple /etc/os-release
inst ./server-init.sh /sbin/init
- inst ./hosts /etc/hosts
inst ./exports /etc/exports
inst ./dhcpd.conf /etc/dhcpd.conf
inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc {,/usr}/etc/protocols
@@ -348,7 +348,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81" \
-initrd "$TESTDIR"/initramfs.makeroot || return 1
test_marker_check dracut-root-block-created || return 1
rm -- "$TESTDIR"/marker.img
diff --git a/test/TEST-98-GETARG/test.sh b/test/TEST-98-GETARG/test.sh
index 8f628a2..e7337d9 100755
--- a/test/TEST-98-GETARG/test.sh
+++ b/test/TEST-98-GETARG/test.sh
@@ -91,14 +91,17 @@ test_run() {
. dracut-dev-lib.sh
. dracut-lib.sh
+ # shellcheck disable=SC2317 # overwrites debug_off from dracut-lib.sh
debug_off() {
:
}
+ # shellcheck disable=SC2317 # overwrites debug_on from dracut-lib.sh
debug_on() {
:
}
+ # shellcheck disable=SC2317 # called later by getarg in dracut-lib.sh
getcmdline() {
echo "rdbreak=cmdline rd.lvm rd.auto=0 rd.auto rd.retry=10"
}
@@ -108,6 +111,7 @@ test_run() {
getargbool 1 rd.lvm -d -n rd_NO_LVM || ret=$((ret + 1))
getargbool 0 rd.auto || ret=$((ret + 1))
+ # shellcheck disable=SC2317 # called later by getarg in dracut-lib.sh
getcmdline() {
echo "rd.break=cmdlined rd.lvm=0 rd.auto rd.auto=1 rd.auto=0"
}
@@ -115,6 +119,7 @@ test_run() {
getargbool 1 rd.lvm -d -n rd_NO_LVM && ret=$((ret + 1))
getargbool 0 rd.auto && ret=$((ret + 1))
+ # shellcheck disable=SC2317 # called later by getarg in dracut-lib.sh
getcmdline() {
echo "ip=a ip=b ip=dhcp6"
}
@@ -126,6 +131,7 @@ test_run() {
[[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
done
+ # shellcheck disable=SC2317 # called later by getarg in dracut-lib.sh
getcmdline() {
echo "bridge bridge=val"
}
@@ -136,6 +142,7 @@ test_run() {
[[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
done
+ # shellcheck disable=SC2317 # called later by getarg in dracut-lib.sh
getcmdline() {
echo "rd.break rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf942 rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf943 rd.shell"
}
diff --git a/test/container/Dockerfile-Arch b/test/container/Dockerfile-Arch
index 2af810a..cc2cb3f 100644
--- a/test/container/Dockerfile-Arch
+++ b/test/container/Dockerfile-Arch
@@ -16,6 +16,7 @@ RUN pacman --noconfirm -Syu \
dhcp \
dmraid \
elfutils \
+ erofs-utils \
f2fs-tools \
git \
glibc \
diff --git a/test/container/Dockerfile-Debian b/test/container/Dockerfile-Debian
index 7e7e6d4..37a83a5 100644
--- a/test/container/Dockerfile-Debian
+++ b/test/container/Dockerfile-Debian
@@ -21,6 +21,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq --
docbook \
docbook-xml \
docbook-xsl \
+ erofs-utils \
fdisk \
g++ \
gawk \
@@ -57,6 +58,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq --
squashfs-tools \
strace \
systemd-boot-efi \
+ systemd-coredump \
tcpdump \
tgt \
thin-provisioning-tools \
diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest
index 106af17..70ea199 100644
--- a/test/container/Dockerfile-Fedora-latest
+++ b/test/container/Dockerfile-Fedora-latest
@@ -19,6 +19,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \
dhcp-server \
dmraid \
e2fsprogs \
+ erofs-utils \
f2fs-tools \
fcoe-utils \
fuse3 \
diff --git a/test/container/Dockerfile-Gentoo b/test/container/Dockerfile-Gentoo
index 7b4eb2a..a832752 100644
--- a/test/container/Dockerfile-Gentoo
+++ b/test/container/Dockerfile-Gentoo
@@ -9,7 +9,7 @@ RUN echo "EMERGE_DEFAULT_OPTS=\"-j$(nproc) -l$(nproc)\"" >> /etc/portage/make.co
RUN echo "FEATURES=\"getbinpkg binpkg-ignore-signature parallel-fetch parallel-install pkgdir-index-trusted\"" >> /etc/portage/make.conf
# systemd-boot, no need to install intramfs with kernel
-RUN echo "USE=\"boot kernel-install -initramfs\"" >> /etc/portage/make.conf
+RUN echo "USE=\"boot kernel-install pkcs7 pkcs11 tpm -initramfs\"" >> /etc/portage/make.conf
# Use debian's installkernel
RUN echo 'sys-kernel/installkernel -systemd' >> /etc/portage/package.use/kernel
diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest
index a5fb7de..3ea5b10 100644
--- a/test/container/Dockerfile-OpenSuse-latest
+++ b/test/container/Dockerfile-OpenSuse-latest
@@ -14,8 +14,10 @@ RUN dnf -y install --setopt=install_weak_deps=False \
dhcp-server \
dmraid \
e2fsprogs \
+ erofs-utils \
gcc \
git \
+ hmaccalc \
iproute \
iputils \
iscsiuio \
diff --git a/test/container/Dockerfile-Ubuntu b/test/container/Dockerfile-Ubuntu
index ef15a67..6a0f928 100644
--- a/test/container/Dockerfile-Ubuntu
+++ b/test/container/Dockerfile-Ubuntu
@@ -20,6 +20,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \
docbook \
docbook-xml \
docbook-xsl \
+ erofs-utils \
fdisk \
g++ \
gawk \
@@ -56,6 +57,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \
squashfs-tools \
strace \
systemd-boot-efi \
+ systemd-coredump \
systemd-ukify \
tcpdump \
tgt \
diff --git a/test/container/Dockerfile-Void b/test/container/Dockerfile-Void
index 99044c3..9f75547 100644
--- a/test/container/Dockerfile-Void
+++ b/test/container/Dockerfile-Void
@@ -23,6 +23,7 @@ RUN xbps-install -Syu xbps && xbps-install -yu \
e2fsprogs \
edk2-ovmf \
elfutils \
+ erofs-utils \
eudev \
f2fs-tools \
git \
diff --git a/test/container/Dockerfile-alpine b/test/container/Dockerfile-alpine
index 4f28c95..c2db721 100644
--- a/test/container/Dockerfile-alpine
+++ b/test/container/Dockerfile-alpine
@@ -19,6 +19,7 @@ RUN apk add --no-cache \
dmraid \
dosfstools \
e2fsprogs \
+ erofs-utils \
eudev \
findmnt \
gawk \
diff --git a/test/run-qemu b/test/run-qemu
index 149a407..5c9ee5d 100755
--- a/test/run-qemu
+++ b/test/run-qemu
@@ -4,13 +4,6 @@
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")
@@ -43,12 +36,17 @@ 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 i6300esb -watchdog-action poweroff -device virtio-rng-pci)
+ARGS+=(-smp 2 -m 2048 -nodefaults -vga none -display none -no-reboot -watchdog-action poweroff -device virtio-rng-pci)
if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then
ARGS+=(-serial stdio)
fi
+# virtual hardware watchdog not available on s390x
+if [[ $ARCH != "s390x" ]]; then
+ ARGS+=(-device i6300esb)
+fi
+
KVERSION=${KVERSION-$(uname -r)}
VMLINUZ="/lib/modules/${KVERSION}/vmlinuz"
diff --git a/test/test-functions b/test/test-functions
index b664fb0..2b32821 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -12,13 +12,18 @@ export TESTDIR
KVERSION=${KVERSION-$(uname -r)}
-[ -z "$USE_NETWORK" ] && USE_NETWORK="network-legacy"
+[ -z "$USE_NETWORK" ] && USE_NETWORK="network"
if [[ -z $basedir ]]; then basedir="$(realpath ../..)"; fi
DRACUT=${DRACUT-${basedir}/dracut.sh}
PKGLIBDIR=${PKGLIBDIR-$basedir}
+TEST_KERNEL_CMDLINE+=" panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot console=ttyS0,115200n81 $DEBUGFAIL "
+if [[ $V != "1" && $V != "2" ]]; then
+ TEST_KERNEL_CMDLINE+="quiet "
+fi
+
test_dracut() {
TEST_DRACUT_ARGS+=" --local --no-hostonly --no-hostonly-cmdline --no-early-microcode --add test --force --kver $KVERSION"
@@ -31,7 +36,7 @@ test_dracut() {
IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS"
"$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" \
+ --kernel-cmdline "rd.retry=10 rd.info rd.shell=0" \
"${TEST_DRACUT_ARGS_ARRAY[@]}" \
"$@" || return 1
}
@@ -143,20 +148,11 @@ while (($# > 0)); do
else
echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_SUCCESS" "[STARTED]" "$COLOR_NORMAL"
fi
- if [[ $V == "1" ]]; then
- set -o pipefail
- (
- test_setup && test_run
- ret=$?
- test_cleanup
- if ((ret != 0)) && [[ -f "$TESTDIR"/server.log ]]; then
- mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
- fi
- rm -fr -- "$TESTDIR"
- rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
- exit $ret
- ) < /dev/null 2>&1 | tee "test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
- elif [[ $V == "2" ]]; then
+ if [[ $V == "1" || $V == "2" ]]; then
+ tee_command="tee"
+ if [[ $V == "2" && -x "$basedir/logtee" ]]; then
+ tee_command="$basedir/logtee"
+ fi
set -o pipefail
(
test_setup && test_run
@@ -168,7 +164,7 @@ while (($# > 0)); do
rm -fr -- "$TESTDIR"
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
exit $ret
- ) < /dev/null 2>&1 | "$basedir/logtee" "test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
+ ) < /dev/null 2>&1 | "$tee_command" "test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
else
(
test_setup && test_run