@ -14,7 +14,7 @@ TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK"
@@ -14,7 +14,7 @@ TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK"
KVERSION=${KVERSION-$(uname -r)}
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break"
#DEBUGFAIL="loglevel=7 rd.shell rd.break"
#SERIAL="tcp:127.0.0.1:9999"
run_server() {
@ -32,7 +32,7 @@ run_server() {
@@ -32,7 +32,7 @@ run_server() {
-net nic,macaddr=52:54:01:12:34:56,model=e1000 \
-serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
-watchdog i6300esb -watchdog-action poweroff \
-append "panic=1 hung_task_panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot loglevel=7 root=LABEL=dracut rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
-append "panic=1 hung_task_panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
@ -70,6 +70,10 @@ client_test() {
@@ -70,6 +70,10 @@ client_test() {
declare -i disk_index=0
qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
if dhclient --help 2>&1 | grep -q -F -- '--timeout' 2> /dev/null; then
cmdline="$cmdline rd.net.timeout.dhcp=3"
fi
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
@ -82,7 +86,7 @@ client_test() {
@@ -82,7 +86,7 @@ client_test() {
-device e1000,netdev=n1,mac=52:54:00:12:34:98 \
-device e1000,netdev=n2,mac=52:54:00:12:34:99 \
-watchdog i6300esb -watchdog-action poweroff \
-append "quiet rd.net.timeout.dhcp=3 panic=1 hung_task_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 "quiet panic=1 hung_task_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" \
-initrd "$TESTDIR"/initramfs.testing || return 1
{
@ -180,7 +184,9 @@ test_client() {
@@ -180,7 +184,9 @@ test_client() {
}
test_setup() {
kernel=$KVERSION
export kernel=$KVERSION
export srcmods="/lib/modules/$kernel/"
rm -rf -- "$TESTDIR"/overlay
(
mkdir -p "$TESTDIR"/overlay/source
# shellcheck disable=SC2030
@ -190,61 +196,53 @@ test_setup() {
@@ -190,61 +196,53 @@ test_setup() {
(
cd "$initdir" || exit
mkdir -p -- dev sys proc run var/run etc tmp var/lib/{dhcpd,rpcbind}
mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs}
chmod 777 -- var/lib/rpcbind var/lib/nfs
mkdir -p dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
chmod 777 var/lib/rpcbind var/lib/nfs
)
for _f in modules.builtin.bin modules.builtin; do
[[ -f $srcmods/$_f ]] && break
done || {
dfatal "No modules.builtin.bin and modules.builtin found!"
return 1
}
for _f in modules.builtin.bin modules.builtin modules.order; do
[[ -f $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping exportfs \
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
/etc/services sleep mount chmod
sleep mount chmod rm
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f "${_terminfodir}"/l/linux ] && break
if [ -f "${_terminfodir}"/l/linux ]; then
inst_multiple -o "${_terminfodir}"/l/linux
break
fi
done
inst_multiple -o "${_terminfodir}"/l/linux
type -P portmap > /dev/null && inst_multiple portmap
type -P rpcbind > /dev/null && inst_multiple rpcbind
[ -f /etc/netconfig ] && inst_multiple /etc/netconfig
type -P dhcpd > /dev/null && inst_multiple dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6 lockd af_packet
inst_simple /etc/os-release
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 /etc/nsswitch.conf /etc/rpc /etc/protocols
inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
{,/usr}/etc/protocols {,/usr}/etc/services
inst_multiple rpc.idmapd /etc/idmapd.conf
inst_libdir_file 'libnfsidmap_nsswitch.so*'
inst_libdir_file 'libnfsidmap/*.so*'
inst_libdir_file 'libnfsidmap*.so*'
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_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*'
inst /etc/nsswitch.conf /etc/nsswitch.conf
inst /etc/passwd /etc/passwd
inst /etc/group /etc/group
cp -a -- /etc/ld.so.conf* "$initdir"/etc
cp -a /etc/ld.so.conf* "$initdir"/etc
ldconfig -r "$initdir"
dracut_kernel_post
)
@ -256,22 +254,20 @@ test_setup() {
@@ -256,22 +254,20 @@ test_setup() {
export initdir=$TESTDIR/overlay/source/nfs/client
# shellcheck disable=SC1090
. "$basedir"/dracut-init.sh
(
cd "$initdir" || exit
mkdir -p dev sys proc etc run
mkdir -p var/lib/nfs/rpc_pipefs
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
for i in bin sbin lib lib64; do
ln -sfnr usr/$i $i
done
mkdir -p dev sys proc etc run root usr var/lib/nfs/rpc_pipefs
)
inst_multiple sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping grep ls dd sync
inst_multiple sh shutdown poweroff stty cat ps ln ip dd \
mount dmesg mkdir cp ping grep setsid ls vi less cat sync
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[[ -f ${_terminfodir}/l/linux ]] && break
if [ -f "${_terminfodir}"/l/linux ]; then
inst_multiple -o "${_terminfodir}"/l/linux
break
fi
done
inst_multiple -o "${_terminfodir}"/l/linux
inst_simple /etc/os-release
inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
@ -279,23 +275,25 @@ test_setup() {
@@ -279,23 +275,25 @@ test_setup() {
ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
inst ./client-init.sh /sbin/init
inst /etc/nsswitch.conf /etc/nsswitch.conf
inst_simple /etc/os-release
inst_multiple -o {,/usr}/etc/nsswitch.conf
inst /etc/passwd /etc/passwd
inst /etc/group /etc/group
inst_multiple rpc.idmapd /etc/idmapd.conf
inst_libdir_file 'libnfsidmap_nsswitch.so*'
inst_libdir_file 'libnfsidmap/*.so*'
inst_libdir_file 'libnfsidmap*.so*'
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_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
cp -a /etc/ld.so.conf* "$initdir"/etc
ldconfig -r "$initdir"
)
@ -320,7 +318,7 @@ test_setup() {
@@ -320,7 +318,7 @@ test_setup() {
--nomdadmconf \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -fr "$TESTDIR"/overlay
rm -rf -- "$TESTDIR"/overlay
dd if=/dev/zero of="$TESTDIR"/server.img bs=1MiB count=120
dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
@ -340,31 +338,42 @@ test_setup() {
@@ -340,31 +338,42 @@ test_setup() {
# Make an overlay with needed tools for the test harness
(
# shellcheck disable=SC2031
# shellcheck disable=SC2030
export initdir="$TESTDIR"/overlay
mkdir -p "$TESTDIR"/overlay
# shellcheck disable=SC1090
. "$basedir"/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-default.link /etc/systemd/network/99-default.link
inst_simple ./client.link /etc/systemd/network/01-client.link
inst_binary awk
inst_hook pre-pivot 85 "$basedir/modules.d/45ifcfg/write-ifcfg.sh"
)
# Make client's dracut image
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
-o "ifcfg plymouth dash ${OMIT_NETWORK}" \
-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
. "$basedir"/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
)
# Make server's dracut image
"$basedir"/dracut.sh \
-l -i "$TESTDIR"/overlay / \
-m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu" \
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
-m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu network network-legacy" \
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
# Make client's dracut image
"$basedir"/dracut.sh \
-l -i "$TESTDIR"/overlay / \
-o "plymouth ${OMIT_NETWORK}" \
-a "debug ${USE_NETWORK}" \
-d "af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
}
kill_server() {