Package: nfs-utils Version: 1.2.8-9 Severity: wishlist Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu ubuntu-patch vivid User: autopkgtest-de...@lists.alioth.debian.org Usertags: autopkgtest
Hello, I was recently systemd'ifying Ubuntu's nfs-utils package (see https://launchpad.net/bugs/1312976 and https://launchpad.net/bugs/1428487) and as part of that I wrote an autopkgtest to check that a simple server and client setup on localhost works. This found a surprising number of issues with the current upstream systemd units (I sent some fixes upstream). The test runs successfully in a sid VM on the current sid nfs-{common,kernel-server} packages with the init.d scrips: | $ adt-run -B nfs-utils_1.2.8-10.dsc --- qemu /srv/vm/adt-sid.img | [...] | adt-run [11:16:46]: test local-server-client: [----------------------- | bash: line 1: 3223 Killed /tmp/adt-run.E6bGah/build.wsp/nfs-utils-1.2.8/debian/tests/local-server-client 2> >(tee -a /tmp/adt-run.E6bGah/local-server-client-stderr >&2) > >(tee -a /tmp/adt-run.E6bGah/local-server-client-stdout) | adt-run [11:16:47]: test process requested reboot with marker boot1 | localhost:/home on /mnt/nfs_home type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1) | localhost:/var/log on /mnt/nfs_log type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1) | adt-run [11:18:38]: test local-server-client: -----------------------] | adt-run [11:18:39]: test local-server-client: - - - - - - - - - - results - - - - - - - - - - | local-server-client PASS Thanks for considering, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
diff -Nru nfs-utils-1.2.8/debian/changelog nfs-utils-1.2.8/debian/changelog --- nfs-utils-1.2.8/debian/changelog 2014-08-13 02:12:43.000000000 +0200 +++ nfs-utils-1.2.8/debian/changelog 2015-03-05 11:15:47.000000000 +0100 @@ -1,3 +1,10 @@ +nfs-utils (1:1.2.8-10) UNRELEASED; urgency=medium + + * Add autopkgtest for installing server and client on localhost, setting up + two exports, rebooting, and ensuring that the NFS mounts work. + + -- Martin Pitt <mp...@debian.org> Thu, 05 Mar 2015 11:15:21 +0100 + nfs-utils (1:1.2.8-9) unstable; urgency=medium * debian/patches/22-mountd-fix-segfault-in-add_name-with-newer-gcc- diff -Nru nfs-utils-1.2.8/debian/tests/control nfs-utils-1.2.8/debian/tests/control --- nfs-utils-1.2.8/debian/tests/control 1970-01-01 01:00:00.000000000 +0100 +++ nfs-utils-1.2.8/debian/tests/control 2015-03-05 11:15:16.000000000 +0100 @@ -0,0 +1,4 @@ +Tests: local-server-client +Depends: nfs-kernel-server +# we need machine isolation as we need to modprobe stuff +Restrictions: needs-root, isolation-machine, breaks-testbed diff -Nru nfs-utils-1.2.8/debian/tests/local-server-client nfs-utils-1.2.8/debian/tests/local-server-client --- nfs-utils-1.2.8/debian/tests/local-server-client 1970-01-01 01:00:00.000000000 +0100 +++ nfs-utils-1.2.8/debian/tests/local-server-client 2015-03-05 11:15:16.000000000 +0100 @@ -0,0 +1,65 @@ +#!/bin/sh +# install server and client, do some mounts, verify that it boots and works +set -e + +if ! [ -x /tmp/autopkgtest-reboot ]; then + echo "SKIP: testbed does not support rebooting" + exit 0 +fi + +pre_boot_setup() { + # set up some exports + cat <<EOF >> /etc/exports +/home localhost(rw,no_root_squash,no_subtree_check) +/var/log/ localhost(ro,no_root_squash,subtree_check) +EOF + + # set up client mounts + mkdir -p /mnt/nfs_home /mnt/nfs_log + cat << EOF >> /etc/fstab +localhost:/home /mnt/nfs_home nfs defaults,nofail 0 0 +localhost:/var/log /mnt/nfs_log nfs defaults,nofail 0 0 +EOF +} + +fail() { + echo "FAIL: $1" >&2 + exit 1 +} + +post_boot_tests() { + # ensure we have our mounts + mount | grep 'localhost:.*nfs_home' || fail "nfs_home not mounted" + mount | grep 'localhost:.*nfs_log' || fail "nfs_log not mounted" + + # test that we can write to NFS export and get it in /home + [ ! -e /home/hello.txt ] || fail "/home/hello.txt already exists" + echo world > /mnt/nfs_home/hello.txt + sync + [ -e /home/hello.txt ] || fail "/home/hello.txt does not exist" + [ "$(cat /home/hello.txt)" = "world" ] || fail "/home/hello.txt has wrong contents" + + # test that we can write to /home and get it in NFS + rm /home/hello.txt + sync + [ ! -e /mnt/nfs_home/hello.txt ] || fail "/mnt/nfs_home/hello.txt exists after removal" + + # read-only, should fail + ! touch /mnt/nfs_log/pwned 2>/dev/null || fail "writing to r/o /mnt/nfs_log succeeded" + + # our systemd jobs have a rather delicate dependency structure and run + # early; ensure that we did not run into any cycles + if [ -d /run/systemd/system ]; then + if journalctl | grep 'Found ordering cycle'; then + journalctl -p warning || true + fail "found ordering cycle in units" + fi + fi +} + +if [ -z "$ADT_REBOOT_MARK" ]; then + pre_boot_setup + /tmp/autopkgtest-reboot boot1 +else + post_boot_tests +fi
signature.asc
Description: Digital signature