Skip to contentSkip to conversation

Enhance NFS test suite (plus one other bug)

PATCH New David Dillow 1 participant 10 messages Jun 6, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover Enhance NFS test suite (plus one other bug)

This series adds functionality to the NFS test suite, and fixes an issue with root parsing that was found during the work. Follow-on work will include adding some rules to the NFS server during the test to verify that the correct server IP is being used, and to test NFS mount options and nfsroot=.

These patches can also be pulled from http://thedillows.org/dracut.git

David Dillow (9):
Have the test framework always run the cleanup script
NFS testing: add forgotten hard-off hook
NFS test: rearrange code to test multiple client configurations NFS test: switch the ISC dhcpd server
NFS test: re-add the fix for the terminal
NFS test: rearrange the server tree so we can differentiate NFSv3 vs
NFSv4
root option parsing belongs in 99base now
NFS test: allow emergency shell while debugging
NFS test: additional option tests

 modules.d/95rootfs-block/install            |    1 -
 modules.d/95rootfs-block/parse-root-opts.sh |   14 ---
 modules.d/99base/install                    |    1 +
 modules.d/99base/parse-root-opts.sh         |   14 +++
 test/TEST-20-NFS/dhcpd.conf                 |   73 ++++++++++++++
 test/TEST-20-NFS/exports                    |    2 +
 test/TEST-20-NFS/hard-off.sh                |    2 +
 test/TEST-20-NFS/hosts                      |    6 +
 test/TEST-20-NFS/server-init                |    9 +-
 test/TEST-20-NFS/test.sh                    |  140 ++++++++++++++++++---------
 test/test-functions                         |   30 ++++---
 11 files changed, 214 insertions(+), 78 deletions(-)
 delete mode 100755 modules.d/95rootfs-block/parse-root-opts.sh
 create mode 100755 modules.d/99base/parse-root-opts.sh
 create mode 100644 test/TEST-20-NFS/dhcpd.conf
 create mode 100644 test/TEST-20-NFS/exports
 create mode 100755 test/TEST-20-NFS/hard-off.sh
 create mode 100644 test/TEST-20-NFS/hosts

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/[email protected]

#2 lore raw

PATCH 1/9 Have the test framework always run the cleanup script

Also remove some extra semicolons, and put the pointer to the test log on its own line.

---
 test/test-functions |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
test/test-functions +18 -12
index 7b219ba..cf0768b 100644
@@ -1,27 +1,33 @@
 while (($# > 0)); do
     case $1 in
         --run) 
-	    echo "TEST RUN: $TEST_DESCRIPTION";
-	    test_run;
+	    echo "TEST RUN: $TEST_DESCRIPTION"
+	    test_run
 	    exit $?;;
         --setup) 
-	    echo "TEST SETUP: $TEST_DESCRIPTION";
-	    test_setup;
+	    echo "TEST SETUP: $TEST_DESCRIPTION"
+	    test_setup
 	    exit $?;;
         --clean) 
-	    echo "TEST CLEANUP: $TEST_DESCRIPTION";
-	    test_cleanup;
+	    echo "TEST CLEANUP: $TEST_DESCRIPTION"
+	    test_cleanup
 	    exit $?;;
         --all) 
 	    echo -n "TEST: $TEST_DESCRIPTION ";
-	    { test_setup && test_run && test_cleanup; } </dev/null >test.log 2>&1;
-	    ret=$?;
+	    (
+		test_setup && test_run
+		ret=$?
+		test_cleanup
+		exit $ret
+	    ) </dev/null >test.log 2>&1
+	    ret=$?
 	    if [ $ret -eq 0 ]; then
-               rm test.log;
-	       echo "[OK]";
+               rm test.log
+	       echo "[OK]"
 	    else
-	       echo "[FAILED] see $(pwd)/test.log";
-	    fi;
+	       echo "[FAILED]"
+	       echo "see $(pwd)/test.log"
+	    fi
 	    exit $ret;;
         *) break ;;
     esac
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/9 NFS testing: add forgotten hard-off hook

In reply to a message not in the archive
---
 test/TEST-20-NFS/hard-off.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100755 test/TEST-20-NFS/hard-off.sh
test/TEST-20-NFS/hard-off.sh new file +2 -0
new file mode 100755
index 0000000..92dd304
@@ -0,0 +1,2 @@
+#!/bin/sh
+poweroff -f
\ No newline at end of file
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 3/9 NFS test: rearrange code to test multiple client configurations

In reply to a message not in the archive

This also gets rid of BASENET, which was an unneeded idea in hindsight.

---
 test/TEST-20-NFS/server-init |    3 +-
 test/TEST-20-NFS/test.sh     |   78 +++++++++++++++++++++++++----------------
 2 files changed, 48 insertions(+), 33 deletions(-)
test/TEST-20-NFS/server-init +1 -2
index d3527f0..f9c822f 100755
@@ -3,11 +3,10 @@ export TERM=linux
 export PS1='nfstest-server:\w\$ '
 stty sane
 echo "made it to the rootfs!"
-. /etc/basenet
 echo server > /proc/sys/kernel/hostname
 ip addr add 127.0.0.1/8 dev lo
 ip link set lo up
-ip addr add $BASENET.1/24 dev eth0
+ip addr add 192.168.50.1/24 dev eth0
 ip link set eth0 up
 rpcbind
 modprobe nfsd
test/TEST-20-NFS/test.sh +47 -31

127 lines not on this page · raw message

Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 4/9 NFS test: switch the ISC dhcpd server

In reply to a message not in the archive

This will let us expand the number of client configs we can test

---
 test/TEST-20-NFS/dhcpd.conf  |   23 +++++++++++++++++++++++
 test/TEST-20-NFS/exports     |    3 +++
 test/TEST-20-NFS/hosts       |    6 ++++++
 test/TEST-20-NFS/server-init |    3 ++-
 test/TEST-20-NFS/test.sh     |   26 +++++---------------------
 5 files changed, 39 insertions(+), 22 deletions(-)
 create mode 100644 test/TEST-20-NFS/dhcpd.conf
 create mode 100644 test/TEST-20-NFS/exports
 create mode 100644 test/TEST-20-NFS/hosts
test/TEST-20-NFS/dhcpd.conf new file +23 -0
new file mode 100644
index 0000000..7ee1cac
@@ -0,0 +1,23 @@
+ddns-update-style none;
+
+use-host-decl-names true;
+
+subnet 192.168.50.0 netmask 255.255.255.0 {
+	option subnet-mask      255.255.255.0;
+	option routers          192.168.50.1;
+	next-server             192.168.50.1;
+	server-identifier       192.168.50.1;
+	option domain-name-servers 192.168.50.1;
+	option domain-search "example.com";
+	option domain-name "other.com";
+
+	group {
+		# NFSv3 root=dhcp or root={/dev/,}nfs, use server-id
+		option root-path "/client";
+
+		host nfs3-1 {
+			hardware ethernet 52:54:00:12:34:00;
+			fixed-address 192.168.50.101;
+		}
+	}
+}
test/TEST-20-NFS/exports new file +3 -0
new file mode 100644
index 0000000..0ec4f0c
@@ -0,0 +1,3 @@
+/       192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
+/client 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
+
test/TEST-20-NFS/hosts new file +6 -0
new file mode 100644
index 0000000..5aca4ed
@@ -0,0 +1,6 @@
+127.0.0.1	localhost
+192.168.50.1	server
+192.168.50.100	workstation1
+192.168.50.101	workstation2
+192.168.50.102	workstation3
+192.168.50.103	workstation4
test/TEST-20-NFS/server-init +2 -1
index f9c822f..397efa2 100755
@@ -13,7 +13,8 @@ modprobe nfsd
 exportfs -r
 rpc.nfsd
 rpc.mountd
-/usr/sbin/dnsmasq
+>/var/lib/dhcpd/dhcpd.leases
+dhcpd
 #sh -i
 # Wait forever for the VM to die
 while sleep 60; do sleep 60; done
test/TEST-20-NFS/test.sh +5 -21
index e641edf..e120f64 100755
@@ -71,34 +71,18 @@ test_setup() {
 	. $basedir/dracut-functions
 	dracut_install sh ls shutdown poweroff stty cat ps ln ip \
 	    /lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
-	    rpcbind modprobe rpc.nfsd rpc.mountd dnsmasq showmount tcpdump \
+	    rpcbind modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \
 	    /etc/netconfig /etc/services sleep
 	instmods nfsd sunrpc
 	inst ./server-init /sbin/init
+	inst ./hosts /etc/hosts
+	inst ./exports /etc/exports
+	inst ./dhcpd.conf /etc/dhcpd.conf
 	(
 	    cd "$initdir";
-	    mkdir -p dev sys proc etc var/run tmp var/lib/{dnsmasq,rpcbind,nfs}
+	    mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind,nfs}
 	    mkdir -p var/lib/nfs/v4recovery
 	    chmod 777 var/lib/rpcbind var/lib/nfs
-
-	    cat > etc/hosts <<EOF 
-127.0.0.1                localhost
-192.168.50.1          server
-192.168.50.100        workstation1
-192.168.50.101        workstation2
-192.168.50.102        workstation3
-192.168.50.103        workstation4
-EOF
-	    cat > etc/dnsmasq.conf <<EOF
-expand-hosts
-domain=test.net
-dhcp-range=192.168.50.100,192.168.50.150,168h
-dhcp-option=17,"192.168.50.1:/client"
-EOF
-            cat > etc/exports <<EOF
-/	192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
-/client	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
-EOF
 	)
 	inst /etc/nsswitch.conf /etc/nsswitch.conf
 	inst /etc/passwd /etc/passwd
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH 5/9 NFS test: re-add the fix for the terminal

In reply to a message not in the archive

When debugging, this is still needed as we won't be redirecting out output to /dev/null or a file. However, we need to guard against not having a terminal.

---
 test/TEST-20-NFS/test.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
test/TEST-20-NFS/test.sh +3 -0
index e120f64..580c4df 100755
@@ -16,6 +16,9 @@ run_server() {
 	-initrd initramfs.server -pidfile server.pid -daemonize || return 1
     sudo chmod 644 server.pid || return 1
 
+    # Cleanup the terminal if we have one
+    tty -s && stty sane
+
     echo Sleeping 10 seconds to give the server a head start
     sleep 10
 }
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH 6/9 NFS test: rearrange the server tree so we can differentiate NFSv3 vs NFSv4

In reply to a message not in the archive
---
 test/TEST-20-NFS/dhcpd.conf |    2 +-
 test/TEST-20-NFS/exports    |    5 ++---
 test/TEST-20-NFS/test.sh    |    4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)
test/TEST-20-NFS/dhcpd.conf +1 -1
index 7ee1cac..79b6a7b 100644
@@ -13,7 +13,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
 
 	group {
 		# NFSv3 root=dhcp or root={/dev/,}nfs, use server-id
-		option root-path "/client";
+		option root-path "/nfs/client";
 
 		host nfs3-1 {
 			hardware ethernet 52:54:00:12:34:00;
test/TEST-20-NFS/exports +2 -3
index 0ec4f0c..2701877 100644
@@ -1,3 +1,2 @@
-/       192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
-/client 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
-
+/nfs		192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
+/nfs/client	192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
test/TEST-20-NFS/test.sh +2 -2
index 580c4df..5ec2341 100755
@@ -99,8 +99,8 @@ test_setup() {
     )
 
     # Make client root inside server root
-    initdir=mnt/client
-    mkdir $initdir
+    initdir=mnt/nfs/client
+    mkdir -p $initdir
 
     (
 	. $basedir/dracut-functions
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

PATCH 7/9 root option parsing belongs in 99base now

In reply to a message not in the archive

We use this for NFS root as well, and NFSv4 was getting broken when it wasn't present.

---
 modules.d/95rootfs-block/install            |    1 -
 modules.d/95rootfs-block/parse-root-opts.sh |   14 --------------
 modules.d/99base/install                    |    1 +
 modules.d/99base/parse-root-opts.sh         |   14 ++++++++++++++
 4 files changed, 15 insertions(+), 15 deletions(-)
 delete mode 100755 modules.d/95rootfs-block/parse-root-opts.sh
 create mode 100755 modules.d/99base/parse-root-opts.sh
modules.d/95rootfs-block/install +0 -1
index b977f9b..618d357 100755
@@ -1,5 +1,4 @@
 #!/bin/sh
-inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
 inst_hook cmdline 95 "$moddir/parse-block.sh"
 inst_hook pre-udev 30 "$moddir/block-genrules.sh"
 inst_hook mount 99 "$moddir/mount-root.sh"
modules.d/95rootfs-block/parse-root-opts.sh deleted +0 -14
deleted file mode 100755
index 7fc4f47..0000000
@@ -1,14 +0,0 @@
-root=$(getarg root=)
-
-if rflags="$(getarg rootflags=)"; then
-    getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
-else
-    getarg rw && rflags=rw || rflags=ro
-fi
-
-fstype="$(getarg rootfstype=)"
-if [ -z "$fstype" ]; then
-    fstype="auto"
-fi
-
-export fstype rflags root
modules.d/99base/install +1 -0
index 428eaf9..97dd2d3 100755
@@ -14,4 +14,5 @@ else
     inst "$moddir/switch_root" "/sbin/switch_root"
 fi
 inst "$moddir/dracut-lib" "/lib/dracut-lib"
+inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
 inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
modules.d/99base/parse-root-opts.sh new file +14 -0
new file mode 100755
index 0000000..7fc4f47
@@ -0,0 +1,14 @@
+root=$(getarg root=)
+
+if rflags="$(getarg rootflags=)"; then
+    getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
+else
+    getarg rw && rflags=rw || rflags=ro
+fi
+
+fstype="$(getarg rootfstype=)"
+if [ -z "$fstype" ]; then
+    fstype="auto"
+fi
+
+export fstype rflags root
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

PATCH 8/9 NFS test: allow emergency shell while debugging

In reply to a message not in the archive
---
 test/TEST-20-NFS/hard-off.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
test/TEST-20-NFS/hard-off.sh +1 -1
index 92dd304..85fd849 100755
@@ -1,2 +1,2 @@
 #!/bin/sh
-poweroff -f
\ No newline at end of file
+getarg rdinitdebug || poweroff -f
Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

PATCH 9/9 NFS test: additional option tests

In reply to a message not in the archive

Test additional combinations of command line and DHCP option formats. This is by no means the complete list, but gets us started with some common ones.

---
 test/TEST-20-NFS/dhcpd.conf  |   50 ++++++++++++++++++++++++++++++++++++++
 test/TEST-20-NFS/server-init |    3 ++
 test/TEST-20-NFS/test.sh     |   55 ++++++++++++++++++++++++++++++++++++-----
 3 files changed, 101 insertions(+), 7 deletions(-)
test/TEST-20-NFS/dhcpd.conf +50 -0
index 79b6a7b..14fee3e 100644
@@ -20,4 +20,54 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
 			fixed-address 192.168.50.101;
 		}
 	}
+
+	group {
+		# NFSv3 root=dhcp or root={/dev/,}nfs, use given IP
+		option root-path "192.168.50.1:/nfs/client";
+
+		host nfs3-2 {
+			hardware ethernet 52:54:00:12:34:01;
+			fixed-address 192.168.50.101;
+		}
+	}
+
+	group {
+		# NFSv3 root=dhcp, use protocol from root-path
+		option root-path "nfs:192.168.50.1:/nfs/client";
+
+		host nfs3-3 {
+			hardware ethernet 52:54:00:12:34:02;
+			fixed-address 192.168.50.101;
+		}
+	}
+
+	group {
+		# NFSv4 root={/dev/,}nfs4, use server-id
+		option root-path "/client";
+
+		host nfs4-1 {
+			hardware ethernet 52:54:00:12:34:03;
+			fixed-address 192.168.50.101;
+		}
+	}
+
+	group {
+		# NFSv4 root={/dev/,}nfs4, use given IP
+		option root-path "192.168.50.1:/client";
+
+		host nfs4-2 {
+			hardware ethernet 52:54:00:12:34:04;
+			fixed-address 192.168.50.101;
+		}
+	}
+
+	group {
+		# NFSv4 root=dhcp, use profocol from root-path
+		option root-path "nfs4:192.168.50.1:/client";
+
+		host nfs4-3 {
+			hardware ethernet 52:54:00:12:34:05;
+			fixed-address 192.168.50.101;
+		}
+	}
 }
test/TEST-20-NFS/server-init +3 -0
index 397efa2..f6d3891 100755
@@ -8,8 +8,11 @@ ip addr add 127.0.0.1/8 dev lo
 ip link set lo up
 ip addr add 192.168.50.1/24 dev eth0
 ip link set eth0 up
+modprobe sunrpc
+mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
 rpcbind
 modprobe nfsd
+mount -t nfsd nfsd /proc/fs/nfsd
 exportfs -r
 rpc.nfsd
 rpc.mountd
test/TEST-20-NFS/test.sh +48 -7

94 lines not on this page · raw message

Signature · 6 lines
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html