* [PATCH 1/9] Have the test framework always run the cleanup script
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 2/9] NFS testing: add forgotten hard-off hook David Dillow
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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(-)
diff --git a/test/test-functions b/test/test-functions
index 7b219ba..cf0768b 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -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
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/9] NFS testing: add forgotten hard-off hook
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-06 9:23 ` [PATCH 1/9] Have the test framework always run the cleanup script David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 3/9] NFS test: rearrange code to test multiple client configurations David Dillow
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
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
diff --git a/test/TEST-20-NFS/hard-off.sh b/test/TEST-20-NFS/hard-off.sh
new file mode 100755
index 0000000..92dd304
--- /dev/null
+++ b/test/TEST-20-NFS/hard-off.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+poweroff -f
\ No newline at end of file
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/9] NFS test: rearrange code to test multiple client configurations
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-06 9:23 ` [PATCH 1/9] Have the test framework always run the cleanup script David Dillow
2009-06-06 9:23 ` [PATCH 2/9] NFS testing: add forgotten hard-off hook David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 4/9] NFS test: switch the ISC dhcpd server David Dillow
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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(-)
diff --git a/test/TEST-20-NFS/server-init b/test/TEST-20-NFS/server-init
index d3527f0..f9c822f 100755
--- a/test/TEST-20-NFS/server-init
+++ b/test/TEST-20-NFS/server-init
@@ -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
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index df6ec8f..e641edf 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -2,37 +2,60 @@
TEST_DESCRIPTION="root filesystem on NFS"
KVERSION=${KVERSION-$(uname -r)}
-BASENET=${BASENET-192.168.100}
-test_run() {
+run_server() {
# Start server first
+ echo "NFS TEST SETUP: Starting DHCP/NFS server"
+
$testdir/run-qemu -hda server.ext2 -m 512M -nographic \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-serial udp:127.0.0.1:9999 \
-kernel /boot/vmlinuz-$KVERSION \
-append "root=/dev/sda rw quiet console=ttyS0,115200n81" \
- -initrd initramfs.server -pidfile server.pid -daemonize
- sudo chmod 644 server.pid
-
- # Starting the server messes up the terminal, fix that
- stty sane
+ -initrd initramfs.server -pidfile server.pid -daemonize || return 1
+ sudo chmod 644 server.pid || return 1
echo Sleeping 10 seconds to give the server a head start
sleep 10
+}
+
+client_test() {
+ local test_name="$1"
+ local mac=$2
+ local cmdline="$3"
+
+ echo "CLIENT TEST START: $test_name"
+
+ # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
+ if ! dd if=/dev/zero of=client.img bs=1M count=1; then
+ echo "Unable to make client sda image" 1>&2
+ return 1
+ fi
$testdir/run-qemu -hda client.img -m 512M -nographic \
- -net nic,macaddr=52:54:00:12:35:56,model=e1000 \
+ -net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "root=dhcp rw quiet console=ttyS0,115200n81" \
+ -append "$cmdline rw quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
- if [[ -s server.pid ]]; then
- sudo kill -TERM $(cat server.pid)
- rm -f server.pid
+ if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then
+ echo "CLIENT TEST END: $test_name [OK]"
+ return 0
+ else
+ echo "CLIENT TEST END: $test_name [FAILED]"
+ return 1
+ fi
+}
+
+test_run() {
+ if ! run_server; then
+ echo "Failed to start server" 1>&2
+ return 1
fi
- grep -m 1 -q nfs-OK client.img || return 1
+
+ client_test "NFSv3 root=dhcp" 52:54:00:12:34:00 "root=dhcp" || return 1
}
test_setup() {
@@ -60,25 +83,21 @@ test_setup() {
cat > etc/hosts <<EOF
127.0.0.1 localhost
-$BASENET.1 server
-$BASENET.100 workstation1
-$BASENET.101 workstation2
-$BASENET.102 workstation3
-$BASENET.103 workstation4
+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=$BASENET.100,$BASENET.150,168h
-dhcp-option=17,"$BASENET.1:/client"
-EOF
- cat > etc/basenet <<EOF
-BASENET=$BASENET
+dhcp-range=192.168.50.100,192.168.50.150,168h
+dhcp-option=17,"192.168.50.1:/client"
EOF
-
cat > etc/exports <<EOF
-/ $BASENET.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
-/client $BASENET.0/24(ro,insecure,no_subtree_check,no_root_squash)
+/ 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
@@ -131,18 +150,15 @@ EOF
# Make server's dracut image
$basedir/dracut -l -i overlay / \
- -m "dash udev-rules base rootfs-block" \
+ -m "dash udev-rules base rootfs-block debug" \
-d "ata_piix ext2 sd_mod e1000" \
-f initramfs.server $KVERSION || return 1
# Make client's dracut image
$basedir/dracut -l -i overlay / \
- -m "dash udev-rules base network nfs" \
+ -m "dash udev-rules base network nfs debug" \
-d "e1000 nfs sunrpc" \
-f initramfs.testing $KVERSION || return 1
-
- # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
- dd if=/dev/zero of=client.img bs=1M count=1
}
test_cleanup() {
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/9] NFS test: switch the ISC dhcpd server
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (2 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 3/9] NFS test: rearrange code to test multiple client configurations David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 5/9] NFS test: re-add the fix for the terminal David Dillow
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
new file mode 100644
index 0000000..7ee1cac
--- /dev/null
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -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;
+ }
+ }
+}
diff --git a/test/TEST-20-NFS/exports b/test/TEST-20-NFS/exports
new file mode 100644
index 0000000..0ec4f0c
--- /dev/null
+++ b/test/TEST-20-NFS/exports
@@ -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)
+
diff --git a/test/TEST-20-NFS/hosts b/test/TEST-20-NFS/hosts
new file mode 100644
index 0000000..5aca4ed
--- /dev/null
+++ b/test/TEST-20-NFS/hosts
@@ -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
diff --git a/test/TEST-20-NFS/server-init b/test/TEST-20-NFS/server-init
index f9c822f..397efa2 100755
--- a/test/TEST-20-NFS/server-init
+++ b/test/TEST-20-NFS/server-init
@@ -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
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index e641edf..e120f64 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -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
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/9] NFS test: re-add the fix for the terminal
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (3 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 4/9] NFS test: switch the ISC dhcpd server David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 6/9] NFS test: rearrange the server tree so we can differentiate NFSv3 vs NFSv4 David Dillow
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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(-)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index e120f64..580c4df 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -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
}
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/9] NFS test: rearrange the server tree so we can differentiate NFSv3 vs NFSv4
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (4 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 5/9] NFS test: re-add the fix for the terminal David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 7/9] root option parsing belongs in 99base now David Dillow
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
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(-)
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index 7ee1cac..79b6a7b 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -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;
diff --git a/test/TEST-20-NFS/exports b/test/TEST-20-NFS/exports
index 0ec4f0c..2701877 100644
--- a/test/TEST-20-NFS/exports
+++ b/test/TEST-20-NFS/exports
@@ -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)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 580c4df..5ec2341 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -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
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 7/9] root option parsing belongs in 99base now
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (5 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 6/9] NFS test: rearrange the server tree so we can differentiate NFSv3 vs NFSv4 David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 8/9] NFS test: allow emergency shell while debugging David Dillow
2009-06-06 9:23 ` [PATCH 9/9] NFS test: additional option tests David Dillow
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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
diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install
index b977f9b..618d357 100755
--- a/modules.d/95rootfs-block/install
+++ b/modules.d/95rootfs-block/install
@@ -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"
diff --git a/modules.d/95rootfs-block/parse-root-opts.sh b/modules.d/95rootfs-block/parse-root-opts.sh
deleted file mode 100755
index 7fc4f47..0000000
--- a/modules.d/95rootfs-block/parse-root-opts.sh
+++ /dev/null
@@ -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
diff --git a/modules.d/99base/install b/modules.d/99base/install
index 428eaf9..97dd2d3 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -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"
diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh
new file mode 100755
index 0000000..7fc4f47
--- /dev/null
+++ b/modules.d/99base/parse-root-opts.sh
@@ -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
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 8/9] NFS test: allow emergency shell while debugging
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (6 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 7/9] root option parsing belongs in 99base now David Dillow
@ 2009-06-06 9:23 ` David Dillow
2009-06-06 9:23 ` [PATCH 9/9] NFS test: additional option tests David Dillow
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/hard-off.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/TEST-20-NFS/hard-off.sh b/test/TEST-20-NFS/hard-off.sh
index 92dd304..85fd849 100755
--- a/test/TEST-20-NFS/hard-off.sh
+++ b/test/TEST-20-NFS/hard-off.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-poweroff -f
\ No newline at end of file
+getarg rdinitdebug || poweroff -f
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 9/9] NFS test: additional option tests
[not found] ` <cover.1244279679.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (7 preceding siblings ...)
2009-06-06 9:23 ` [PATCH 8/9] NFS test: allow emergency shell while debugging David Dillow
@ 2009-06-06 9:23 ` David Dillow
8 siblings, 0 replies; 10+ messages in thread
From: David Dillow @ 2009-06-06 9:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
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(-)
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index 79b6a7b..14fee3e 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -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;
+ }
+ }
}
diff --git a/test/TEST-20-NFS/server-init b/test/TEST-20-NFS/server-init
index 397efa2..f6d3891 100755
--- a/test/TEST-20-NFS/server-init
+++ b/test/TEST-20-NFS/server-init
@@ -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
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 5ec2341..7fcc47b 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -3,6 +3,9 @@ TEST_DESCRIPTION="root filesystem on NFS"
KVERSION=${KVERSION-$(uname -r)}
+# Uncomment this to debug failures
+#DEBUGFAIL="rdinitdebug rdnetdebug"
+
run_server() {
# Start server first
echo "NFS TEST SETUP: Starting DHCP/NFS server"
@@ -40,7 +43,7 @@ client_test() {
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "$cmdline rw quiet console=ttyS0,115200n81" \
+ -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then
@@ -58,12 +61,50 @@ test_run() {
return 1
fi
- client_test "NFSv3 root=dhcp" 52:54:00:12:34:00 "root=dhcp" || return 1
+ client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
+ "root=dhcp" || return 1
+
+ client_test "NFSv3 root=nfs DHCP path only" 52:54:00:12:34:00 \
+ "root=nfs" || return 1
+
+ client_test "NFSv3 root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
+ "root=/dev/nfs" || return 1
+
+ client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
+ "root=dhcp" || return 1
+
+ client_test "NFSv3 root=nfs DHCP IP:path" 52:54:00:12:34:01 \
+ "root=nfs" || return 1
+
+ client_test "NFSv3 root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
+ "root=/dev/nfs" || return 1
+
+ client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
+ "root=dhcp" || return 1
+
+ # There is a mandatory 90 second recovery when starting the NFSv4
+ # server, so put these later in the list to avoid a pause when doing
+ # switch_root
+
+ client_test "NFSv4 root=nfs4 DHCP path only" 52:54:00:12:34:03 \
+ "root=nfs4" || return 1
+
+ client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:03 \
+ "root=/dev/nfs4" || return 1
+
+ client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:04 \
+ "root=nfs4" || return 1
+
+ client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:04 \
+ "root=/dev/nfs4" || return 1
+
+ client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:05 \
+ "root=dhcp" || return 1
}
test_setup() {
# Make server root
- dd if=/dev/zero of=server.ext2 bs=1M count=20
+ dd if=/dev/zero of=server.ext2 bs=1M count=30
mke2fs -F server.ext2
mkdir mnt
sudo mount -o loop server.ext2 mnt
@@ -75,7 +116,7 @@ test_setup() {
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 dhcpd showmount tcpdump \
- /etc/netconfig /etc/services sleep
+ /etc/netconfig /etc/services sleep mount
instmods nfsd sunrpc
inst ./server-init /sbin/init
inst ./hosts /etc/hosts
@@ -83,14 +124,14 @@ test_setup() {
inst ./dhcpd.conf /etc/dhcpd.conf
(
cd "$initdir";
- mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind,nfs}
- mkdir -p var/lib/nfs/v4recovery
+ mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind}
+ mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
chmod 777 var/lib/rpcbind var/lib/nfs
)
inst /etc/nsswitch.conf /etc/nsswitch.conf
inst /etc/passwd /etc/passwd
inst /etc/group /etc/group
- for i in /lib*/libnss_files*;do
+ for i in /lib*/libnss_files**;do
inst_library $i
done
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread