|
|
712866 |
From 323093b621c415cf0d04c48716d77cf9569850d6 Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Wed, 29 Jun 2016 15:51:42 +0200
|
|
|
712866 |
Subject: [PATCH] test: add TEST-60-MTUMAC
|
|
|
712866 |
|
|
|
712866 |
test MTU and MACADDR setting
|
|
|
712866 |
---
|
|
|
712866 |
test/TEST-60-MTUMAC/99-idesymlinks.rules | 8 +
|
|
|
712866 |
test/TEST-60-MTUMAC/Makefile | 10 ++
|
|
|
712866 |
test/TEST-60-MTUMAC/client-init.sh | 22 +++
|
|
|
712866 |
test/TEST-60-MTUMAC/dhcpd.conf | 15 ++
|
|
|
712866 |
test/TEST-60-MTUMAC/exports | 1 +
|
|
|
712866 |
test/TEST-60-MTUMAC/finished-false.sh | 2 +
|
|
|
712866 |
test/TEST-60-MTUMAC/hard-off.sh | 3 +
|
|
|
712866 |
test/TEST-60-MTUMAC/hosts | 5 +
|
|
|
712866 |
test/TEST-60-MTUMAC/server-init.sh | 98 +++++++++++
|
|
|
712866 |
test/TEST-60-MTUMAC/test.sh | 282 +++++++++++++++++++++++++++++++
|
|
|
712866 |
10 files changed, 446 insertions(+)
|
|
|
712866 |
create mode 100644 test/TEST-60-MTUMAC/99-idesymlinks.rules
|
|
|
712866 |
create mode 100644 test/TEST-60-MTUMAC/Makefile
|
|
|
712866 |
create mode 100755 test/TEST-60-MTUMAC/client-init.sh
|
|
|
712866 |
create mode 100644 test/TEST-60-MTUMAC/dhcpd.conf
|
|
|
712866 |
create mode 100644 test/TEST-60-MTUMAC/exports
|
|
|
712866 |
create mode 100755 test/TEST-60-MTUMAC/finished-false.sh
|
|
|
712866 |
create mode 100755 test/TEST-60-MTUMAC/hard-off.sh
|
|
|
712866 |
create mode 100644 test/TEST-60-MTUMAC/hosts
|
|
|
712866 |
create mode 100755 test/TEST-60-MTUMAC/server-init.sh
|
|
|
712866 |
create mode 100755 test/TEST-60-MTUMAC/test.sh
|
|
|
712866 |
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/99-idesymlinks.rules b/test/TEST-60-MTUMAC/99-idesymlinks.rules
|
|
|
712866 |
new file mode 100644
|
|
|
5c6c2a |
index 00000000..d557790a
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/99-idesymlinks.rules
|
|
|
712866 |
@@ -0,0 +1,8 @@
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
|
|
|
712866 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/Makefile b/test/TEST-60-MTUMAC/Makefile
|
|
|
712866 |
new file mode 100644
|
|
|
5c6c2a |
index 00000000..aad27059
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/Makefile
|
|
|
712866 |
@@ -0,0 +1,10 @@
|
|
|
712866 |
+all:
|
|
|
712866 |
+ @$(MAKE) -s --no-print-directory -C ../.. all
|
|
|
712866 |
+ @V=$(V) basedir=../.. testdir=../ ./test.sh --all
|
|
|
712866 |
+setup:
|
|
|
712866 |
+ @$(MAKE) --no-print-directory -C ../.. all
|
|
|
712866 |
+ @basedir=../.. testdir=../ ./test.sh --setup
|
|
|
712866 |
+clean:
|
|
|
712866 |
+ @basedir=../.. testdir=../ ./test.sh --clean
|
|
|
712866 |
+run:
|
|
|
712866 |
+ @basedir=../.. testdir=../ ./test.sh --run
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/client-init.sh b/test/TEST-60-MTUMAC/client-init.sh
|
|
|
712866 |
new file mode 100755
|
|
|
5c6c2a |
index 00000000..a45c3123
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/client-init.sh
|
|
|
712866 |
@@ -0,0 +1,22 @@
|
|
|
712866 |
+#!/bin/sh
|
|
|
712866 |
+exec >/dev/console 2>&1
|
|
|
712866 |
+set -x
|
|
|
712866 |
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
712866 |
+strstr() { [ "${1#*$2*}" != "$1" ]; }
|
|
|
712866 |
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
|
|
|
712866 |
+export TERM=linux
|
|
|
712866 |
+export PS1='initramfs-test:\w\$ '
|
|
|
712866 |
+stty sane
|
|
|
712866 |
+echo "made it to the rootfs! Powering down."
|
|
|
712866 |
+
|
|
|
712866 |
+(
|
|
|
712866 |
+ echo OK
|
|
|
712866 |
+ cd /sys/class/net
|
|
|
712866 |
+ for i in ens*; do
|
|
|
712866 |
+ echo "$i" "$(cat $i/mtu)" "$(cat $i/address)"
|
|
|
712866 |
+ done
|
|
|
712866 |
+ echo END
|
|
|
712866 |
+) > /dev/sda
|
|
|
712866 |
+
|
|
|
712866 |
+strstr "$CMDLINE" "rd.shell" && sh -i
|
|
|
712866 |
+poweroff -f
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/dhcpd.conf b/test/TEST-60-MTUMAC/dhcpd.conf
|
|
|
712866 |
new file mode 100644
|
|
|
5c6c2a |
index 00000000..cba28233
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/dhcpd.conf
|
|
|
712866 |
@@ -0,0 +1,15 @@
|
|
|
712866 |
+ddns-update-style none;
|
|
|
712866 |
+
|
|
|
712866 |
+use-host-decl-names true;
|
|
|
712866 |
+
|
|
|
712866 |
+subnet 192.168.50.0 netmask 255.255.255.0 {
|
|
|
712866 |
+ option subnet-mask 255.255.255.0;
|
|
|
712866 |
+ option routers 192.168.50.1;
|
|
|
712866 |
+ next-server 192.168.50.1;
|
|
|
712866 |
+ server-identifier 192.168.50.1;
|
|
|
712866 |
+ option domain-name-servers 192.168.50.1;
|
|
|
712866 |
+ option domain-search "example.com";
|
|
|
712866 |
+ option domain-name "other.com";
|
|
|
712866 |
+ option root-path "nfs:192.168.50.1:/nfs/client";
|
|
|
712866 |
+ range 192.168.50.10 192.168.50.100;
|
|
|
712866 |
+}
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/exports b/test/TEST-60-MTUMAC/exports
|
|
|
712866 |
new file mode 100644
|
|
|
5c6c2a |
index 00000000..ff5f29b1
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/exports
|
|
|
712866 |
@@ -0,0 +1 @@
|
|
|
712866 |
+/nfs/client 192.168.50.0/24(rw,insecure,no_subtree_check,no_root_squash)
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/finished-false.sh b/test/TEST-60-MTUMAC/finished-false.sh
|
|
|
712866 |
new file mode 100755
|
|
|
5c6c2a |
index 00000000..ecdbef95
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/finished-false.sh
|
|
|
712866 |
@@ -0,0 +1,2 @@
|
|
|
712866 |
+#!/bin/sh
|
|
|
712866 |
+exit 1
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/hard-off.sh b/test/TEST-60-MTUMAC/hard-off.sh
|
|
|
712866 |
new file mode 100755
|
|
|
5c6c2a |
index 00000000..12c3d5ac
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/hard-off.sh
|
|
|
712866 |
@@ -0,0 +1,3 @@
|
|
|
712866 |
+#!/bin/sh
|
|
|
712866 |
+getarg rd.shell || poweroff -f
|
|
|
712866 |
+getarg failme && poweroff -f
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/hosts b/test/TEST-60-MTUMAC/hosts
|
|
|
712866 |
new file mode 100644
|
|
|
5c6c2a |
index 00000000..d02a4e9b
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/hosts
|
|
|
712866 |
@@ -0,0 +1,5 @@
|
|
|
712866 |
+127.0.0.1 localhost
|
|
|
712866 |
+192.168.50.1 server
|
|
|
712866 |
+192.168.50.100 client-if1
|
|
|
712866 |
+192.168.50.101 client-if2
|
|
|
712866 |
+192.168.50.102 client-if3
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/server-init.sh b/test/TEST-60-MTUMAC/server-init.sh
|
|
|
712866 |
new file mode 100755
|
|
|
5c6c2a |
index 00000000..88ef2128
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/server-init.sh
|
|
|
712866 |
@@ -0,0 +1,98 @@
|
|
|
712866 |
+#!/bin/sh
|
|
|
712866 |
+exec </dev/console >/dev/console 2>&1
|
|
|
712866 |
+set -x
|
|
|
712866 |
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
712866 |
+export TERM=linux
|
|
|
712866 |
+export PS1='nfstest-server:\w\$ '
|
|
|
712866 |
+stty sane
|
|
|
712866 |
+echo "made it to the rootfs!"
|
|
|
712866 |
+echo server > /proc/sys/kernel/hostname
|
|
|
712866 |
+
|
|
|
712866 |
+wait_for_if_link() {
|
|
|
712866 |
+ local cnt=0
|
|
|
712866 |
+ local li
|
|
|
712866 |
+ while [ $cnt -lt 600 ]; do
|
|
|
712866 |
+ li=$(ip -o link show dev $1 2>/dev/null)
|
|
|
712866 |
+ [ -n "$li" ] && return 0
|
|
|
712866 |
+ sleep 0.1
|
|
|
712866 |
+ cnt=$(($cnt+1))
|
|
|
712866 |
+ done
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+wait_for_if_up() {
|
|
|
712866 |
+ local cnt=0
|
|
|
712866 |
+ local li
|
|
|
712866 |
+ while [ $cnt -lt 200 ]; do
|
|
|
712866 |
+ li=$(ip -o link show up dev $1)
|
|
|
712866 |
+ [ -n "$li" ] && return 0
|
|
|
712866 |
+ sleep 0.1
|
|
|
712866 |
+ cnt=$(($cnt+1))
|
|
|
712866 |
+ done
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+wait_for_route_ok() {
|
|
|
712866 |
+ local cnt=0
|
|
|
712866 |
+ while [ $cnt -lt 200 ]; do
|
|
|
712866 |
+ li=$(ip route show)
|
|
|
712866 |
+ [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
|
|
712866 |
+ sleep 0.1
|
|
|
712866 |
+ cnt=$(($cnt+1))
|
|
|
712866 |
+ done
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+linkup() {
|
|
|
712866 |
+ wait_for_if_link $1 2>/dev/null\
|
|
|
712866 |
+ && ip link set $1 up 2>/dev/null\
|
|
|
712866 |
+ && wait_for_if_up $1 2>/dev/null
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+ip addr add 127.0.0.1/8 dev lo
|
|
|
712866 |
+linkup lo
|
|
|
712866 |
+ip link set dev eth0 name ens3
|
|
|
712866 |
+ip addr add 192.168.50.1/24 dev ens3
|
|
|
712866 |
+linkup ens3
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+modprobe af_packet
|
|
|
712866 |
+> /dev/watchdog
|
|
|
712866 |
+modprobe sunrpc
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+[ -x /sbin/portmap ] && portmap
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+[ -x /sbin/rpcbind ] && rpcbind
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+modprobe nfsd
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+mount -t nfsd nfsd /proc/fs/nfsd
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+exportfs -r
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+rpc.nfsd
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+rpc.mountd
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+rpc.idmapd
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+exportfs -r
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+>/var/lib/dhcpd/dhcpd.leases
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+chmod 777 /var/lib/dhcpd/dhcpd.leases
|
|
|
712866 |
+>/dev/watchdog
|
|
|
712866 |
+dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases
|
|
|
712866 |
+#echo -n 'V' > /dev/watchdog
|
|
|
712866 |
+#sh -i
|
|
|
712866 |
+#tcpdump -i ens3
|
|
|
712866 |
+# Wait forever for the VM to die
|
|
|
712866 |
+echo "Serving NFS mounts"
|
|
|
712866 |
+while :; do
|
|
|
712866 |
+ sleep 10
|
|
|
712866 |
+ >/dev/watchdog
|
|
|
712866 |
+done
|
|
|
712866 |
+mount -n -o remount,ro /
|
|
|
712866 |
+poweroff -f
|
|
|
712866 |
diff --git a/test/TEST-60-MTUMAC/test.sh b/test/TEST-60-MTUMAC/test.sh
|
|
|
712866 |
new file mode 100755
|
|
|
5c6c2a |
index 00000000..7633ac13
|
|
|
712866 |
--- /dev/null
|
|
|
712866 |
+++ b/test/TEST-60-MTUMAC/test.sh
|
|
|
712866 |
@@ -0,0 +1,282 @@
|
|
|
712866 |
+#!/bin/bash
|
|
|
712866 |
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
|
712866 |
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
712866 |
+TEST_DESCRIPTION="root filesystem on NFS with multiple nics"
|
|
|
712866 |
+KVERSION=${KVERSION-$(uname -r)}
|
|
|
712866 |
+
|
|
|
712866 |
+# Uncomment this to debug failures
|
|
|
712866 |
+#DEBUGFAIL="rd.shell rd.break"
|
|
|
712866 |
+#SERIAL="tcp:127.0.0.1:9999"
|
|
|
712866 |
+
|
|
|
712866 |
+run_server() {
|
|
|
712866 |
+ # Start server first
|
|
|
712866 |
+ echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
|
|
|
712866 |
+
|
|
|
712866 |
+ fsck -a "$TESTDIR"/server.ext3 || return 1
|
|
|
712866 |
+ $testdir/run-qemu \
|
|
|
712866 |
+ -hda "$TESTDIR"/server.ext3 \
|
|
|
712866 |
+ -m 512M -smp 2 \
|
|
|
712866 |
+ -display none \
|
|
|
712866 |
+ -net socket,listen=127.0.0.1:12350 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:01:12:34:56,model=e1000 \
|
|
|
712866 |
+ ${SERIAL:+-serial "$SERIAL"} \
|
|
|
712866 |
+ -watchdog i6300esb -watchdog-action poweroff \
|
|
|
712866 |
+ -kernel /boot/vmlinuz-"$KVERSION" \
|
|
|
712866 |
+ -append "loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
|
|
712866 |
+ -initrd "$TESTDIR"/initramfs.server \
|
|
|
712866 |
+ -pidfile "$TESTDIR"/server.pid -daemonize || return 1
|
|
|
712866 |
+ sudo chmod 644 -- "$TESTDIR"/server.pid || return 1
|
|
|
712866 |
+
|
|
|
712866 |
+ # Cleanup the terminal if we have one
|
|
|
712866 |
+ tty -s && stty sane
|
|
|
712866 |
+
|
|
|
712866 |
+ echo Sleeping 10 seconds to give the server a head start
|
|
|
712866 |
+ sleep 10
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+client_test() {
|
|
|
712866 |
+ local test_name="$1"
|
|
|
712866 |
+ local cmdline="$2"
|
|
|
712866 |
+ local check="$3"
|
|
|
712866 |
+
|
|
|
712866 |
+ echo "CLIENT TEST START: $test_name"
|
|
|
712866 |
+
|
|
|
712866 |
+ # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
|
|
|
712866 |
+ if ! dd if=/dev/zero of="$TESTDIR"/client.img bs=1M count=1; then
|
|
|
712866 |
+ echo "Unable to make client sda image" 1>&2
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ $testdir/run-qemu -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
|
|
712866 |
+ -net socket,connect=127.0.0.1:12350 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:00:12:34:02,model=e1000 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:00:12:34:03,model=e1000 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:00:12:34:04,model=e1000 \
|
|
|
712866 |
+ -net nic,macaddr=52:54:00:12:34:05,model=e1000 \
|
|
|
712866 |
+ -watchdog i6300esb -watchdog-action poweroff \
|
|
|
712866 |
+ -kernel /boot/vmlinuz-"$KVERSION" \
|
|
|
712866 |
+ -append "$cmdline $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \
|
|
|
712866 |
+ -initrd "$TESTDIR"/initramfs.testing
|
|
|
712866 |
+
|
|
|
712866 |
+ {
|
|
|
712866 |
+ read OK
|
|
|
712866 |
+ if [[ "$OK" != "OK" ]]; then
|
|
|
712866 |
+ echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ while read IFACE MTU MAC; do
|
|
|
712866 |
+ [[ $IFACE == END ]] && break
|
|
|
712866 |
+ IFACES+="${IFACE}-${MTU}-${MAC} "
|
|
|
712866 |
+ done
|
|
|
712866 |
+ } < "$TESTDIR"/client.img || return 1
|
|
|
712866 |
+
|
|
|
712866 |
+ echo "$IFACES"
|
|
|
712866 |
+
|
|
|
712866 |
+ for i in $check; do
|
|
|
712866 |
+ if [[ " $IFACES " != *\ $i\ * ]]; then
|
|
|
712866 |
+ echo "$i not in '$IFACES'"
|
|
|
712866 |
+ echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ done
|
|
|
712866 |
+
|
|
|
712866 |
+ for i in $IFACES; do
|
|
|
712866 |
+ if [[ " $check " != *\ $i\ * ]]; then
|
|
|
712866 |
+ echo "$i in '$IFACES', but should not be"
|
|
|
712866 |
+ echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ done
|
|
|
712866 |
+
|
|
|
712866 |
+ echo "CLIENT TEST END: $test_name [OK]"
|
|
|
712866 |
+ return 0
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+
|
|
|
712866 |
+test_run() {
|
|
|
712866 |
+ if ! run_server; then
|
|
|
712866 |
+ echo "Failed to start server" 1>&2
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ test_client || { kill_server; return 1; }
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+test_client() {
|
|
|
712866 |
+ client_test "MTUMAC format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]" \
|
|
|
712866 |
+ "
|
|
|
712866 |
+ip=ens3:dhcp:1000
|
|
|
712866 |
+ip=ens4:dhcp::54:52:00:ab:cd:01
|
|
|
712866 |
+ip=ens5:dhcp::[54:52:00:ab:cd:02]
|
|
|
712866 |
+ip=ens6:dhcp:1000:54:52:00:ab:cd:03
|
|
|
712866 |
+ip=ens7:dhcp:1000:[54:52:00:ab:cd:04]
|
|
|
712866 |
+rd.neednet=1
|
|
|
712866 |
+root=nfs:192.168.50.1:/nfs/client bootdev=ens3
|
|
|
712866 |
+" \
|
|
|
712866 |
+ "ens3-1000-52:54:00:12:34:01 ens4-1500-54:52:00:ab:cd:01 ens5-1500-54:52:00:ab:cd:02 ens6-1000-54:52:00:ab:cd:03 ens7-1000-54:52:00:ab:cd:04" || return 1
|
|
|
712866 |
+ client_test "MTUMAC format: format: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]" \
|
|
|
712866 |
+ "
|
|
|
712866 |
+ip=192.168.50.2::192.168.50.1:24:test:ens3:none:1000
|
|
|
712866 |
+ip=192.168.50.3::192.168.50.1:24:test:ens4:none::54:52:00:ab:cd:01
|
|
|
712866 |
+ip=192.168.50.4::192.168.50.1:24:test:ens5:none::[54:52:00:ab:cd:02]
|
|
|
712866 |
+ip=192.168.50.5::192.168.50.1:24:test:ens6:none:1000:54:52:00:ab:cd:03
|
|
|
712866 |
+ip=192.168.50.6::192.168.50.1:24:test:ens7:none:1000:[54:52:00:ab:cd:04]
|
|
|
712866 |
+rd.neednet=1
|
|
|
712866 |
+root=nfs:192.168.50.1:/nfs/client bootdev=ens3
|
|
|
712866 |
+" \
|
|
|
712866 |
+ "ens3-1000-52:54:00:12:34:01 ens4-1500-54:52:00:ab:cd:01 ens5-1500-54:52:00:ab:cd:02 ens6-1000-54:52:00:ab:cd:03 ens7-1000-54:52:00:ab:cd:04" || return 1
|
|
|
712866 |
+
|
|
|
712866 |
+ kill_server
|
|
|
712866 |
+ return 0
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+test_setup() {
|
|
|
712866 |
+ # Make server root
|
|
|
712866 |
+ dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
|
|
|
712866 |
+ mke2fs -j -F -- "$TESTDIR"/server.ext3
|
|
|
712866 |
+ mkdir -- "$TESTDIR"/mnt
|
|
|
712866 |
+ sudo mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
|
|
712866 |
+
|
|
|
712866 |
+ (
|
|
|
712866 |
+ export initdir="$TESTDIR"/mnt
|
|
|
712866 |
+ . "$basedir"/dracut-init.sh
|
|
|
712866 |
+
|
|
|
712866 |
+ (
|
|
|
712866 |
+ cd "$initdir";
|
|
|
712866 |
+ mkdir -p -- dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
|
|
|
712866 |
+ mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs}
|
|
|
712866 |
+ chmod 777 -- var/lib/rpcbind var/lib/nfs
|
|
|
712866 |
+ )
|
|
|
712866 |
+
|
|
|
712866 |
+ for _f in modules.builtin.bin modules.builtin; do
|
|
|
712866 |
+ [[ $srcmods/$_f ]] && break
|
|
|
712866 |
+ done || {
|
|
|
712866 |
+ dfatal "No modules.builtin.bin and modules.builtin found!"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ }
|
|
|
712866 |
+
|
|
|
712866 |
+ for _f in modules.builtin.bin modules.builtin modules.order; do
|
|
|
712866 |
+ [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
|
|
712866 |
+ done
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
|
|
712866 |
+ dmesg mkdir cp ping exportfs \
|
|
|
712866 |
+ modprobe rpc.nfsd rpc.mountd showmount tcpdump \
|
|
|
712866 |
+ /etc/services sleep mount chmod
|
|
|
712866 |
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
|
|
712866 |
+ [ -f "${_terminfodir}"/l/linux ] && break
|
|
|
712866 |
+ done
|
|
|
712866 |
+ inst_multiple -o "${_terminfodir}"/l/linux
|
|
|
712866 |
+ type -P portmap >/dev/null && inst_multiple portmap
|
|
|
712866 |
+ type -P rpcbind >/dev/null && inst_multiple rpcbind
|
|
|
712866 |
+ [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
|
|
|
712866 |
+ type -P dhcpd >/dev/null && inst_multiple dhcpd
|
|
|
712866 |
+ [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
|
|
|
712866 |
+ instmods nfsd sunrpc ipv6 lockd af_packet
|
|
|
712866 |
+ inst_simple /etc/os-release
|
|
|
712866 |
+ inst ./server-init.sh /sbin/init
|
|
|
712866 |
+ inst ./hosts /etc/hosts
|
|
|
712866 |
+ inst ./exports /etc/exports
|
|
|
712866 |
+ inst ./dhcpd.conf /etc/dhcpd.conf
|
|
|
712866 |
+ inst_multiple /etc/nsswitch.conf /etc/rpc /etc/protocols
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_multiple rpc.idmapd /etc/idmapd.conf
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap_nsswitch.so*'
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap/*.so*'
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap*.so*'
|
|
|
712866 |
+
|
|
|
712866 |
+ _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
|
|
712866 |
+ | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
|
|
712866 |
+ _nsslibs=${_nsslibs#|}
|
|
|
712866 |
+ _nsslibs=${_nsslibs%|}
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
|
|
|
712866 |
+
|
|
|
712866 |
+ inst /etc/nsswitch.conf /etc/nsswitch.conf
|
|
|
712866 |
+ inst /etc/passwd /etc/passwd
|
|
|
712866 |
+ inst /etc/group /etc/group
|
|
|
712866 |
+
|
|
|
712866 |
+ cp -a -- /etc/ld.so.conf* "$initdir"/etc
|
|
|
712866 |
+ ldconfig -r "$initdir"
|
|
|
712866 |
+ dracut_kernel_post
|
|
|
712866 |
+ )
|
|
|
712866 |
+
|
|
|
712866 |
+ # Make client root inside server root
|
|
|
712866 |
+ (
|
|
|
712866 |
+ export initdir="$TESTDIR"/mnt/nfs/client
|
|
|
712866 |
+ . "$basedir"/dracut-init.sh
|
|
|
712866 |
+ inst_multiple sh shutdown poweroff stty cat ps ln ip \
|
|
|
712866 |
+ mount dmesg mkdir cp ping grep ls
|
|
|
712866 |
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
|
|
712866 |
+ [[ -f ${_terminfodir}/l/linux ]] && break
|
|
|
712866 |
+ done
|
|
|
712866 |
+ inst_multiple -o "${_terminfodir}"/l/linux
|
|
|
712866 |
+ inst_simple /etc/os-release
|
|
|
712866 |
+ inst ./client-init.sh /sbin/init
|
|
|
712866 |
+ (
|
|
|
712866 |
+ cd "$initdir"
|
|
|
712866 |
+ mkdir -p -- dev sys proc etc run
|
|
|
712866 |
+ mkdir -p -- var/lib/nfs/rpc_pipefs
|
|
|
712866 |
+ )
|
|
|
712866 |
+ inst /etc/nsswitch.conf /etc/nsswitch.conf
|
|
|
712866 |
+ inst /etc/passwd /etc/passwd
|
|
|
712866 |
+ inst /etc/group /etc/group
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_multiple rpc.idmapd /etc/idmapd.conf
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap_nsswitch.so*'
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap/*.so*'
|
|
|
712866 |
+ inst_libdir_file 'libnfsidmap*.so*'
|
|
|
712866 |
+
|
|
|
712866 |
+ _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \
|
|
|
712866 |
+ | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
|
|
712866 |
+ _nsslibs=${_nsslibs#|}
|
|
|
712866 |
+ _nsslibs=${_nsslibs%|}
|
|
|
712866 |
+
|
|
|
712866 |
+ inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
|
|
|
712866 |
+
|
|
|
712866 |
+ cp -a -- /etc/ld.so.conf* "$initdir"/etc
|
|
|
712866 |
+ sudo ldconfig -r "$initdir"
|
|
|
712866 |
+ )
|
|
|
712866 |
+
|
|
|
712866 |
+ sudo umount "$TESTDIR"/mnt
|
|
|
712866 |
+ rm -fr -- "$TESTDIR"/mnt
|
|
|
712866 |
+
|
|
|
712866 |
+ # Make an overlay with needed tools for the test harness
|
|
|
712866 |
+ (
|
|
|
712866 |
+ export initdir="$TESTDIR"/overlay
|
|
|
712866 |
+ . "$basedir"/dracut-init.sh
|
|
|
712866 |
+ inst_multiple poweroff shutdown
|
|
|
712866 |
+ inst_hook emergency 000 ./hard-off.sh
|
|
|
712866 |
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
|
|
712866 |
+ )
|
|
|
712866 |
+
|
|
|
712866 |
+ # Make server's dracut image
|
|
|
712866 |
+ $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
|
|
712866 |
+ --no-early-microcode \
|
|
|
712866 |
+ -m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \
|
|
|
712866 |
+ -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" \
|
|
|
712866 |
+ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
|
|
|
712866 |
+
|
|
|
712866 |
+ # Make client's dracut image
|
|
|
712866 |
+ $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
|
|
712866 |
+ --no-early-microcode \
|
|
|
712866 |
+ -o "plymouth" \
|
|
|
712866 |
+ -a "debug" \
|
|
|
712866 |
+ -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" \
|
|
|
712866 |
+ -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+kill_server() {
|
|
|
712866 |
+ if [[ -s "$TESTDIR"/server.pid ]]; then
|
|
|
712866 |
+ sudo kill -TERM -- $(cat "$TESTDIR"/server.pid)
|
|
|
712866 |
+ rm -f -- "$TESTDIR"/server.pid
|
|
|
712866 |
+ fi
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+test_cleanup() {
|
|
|
712866 |
+ kill_server
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+. "$testdir"/test-functions
|