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