Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/sys/kern Add a regression test to check that forced ...



details:   https://anonhg.NetBSD.org/src/rev/c63e6ada2038
branches:  trunk
changeset: 545693:c63e6ada2038
user:      erh <erh%NetBSD.org@localhost>
date:      Tue Apr 15 06:19:57 2003 +0000

description:
Add a regression test to check that forced unmounts work correctly.
Bug described in PR kern/5683

diffstat:

 regress/sys/kern/Makefile               |   4 +-
 regress/sys/kern/umount/Makefile        |  53 +++++++++++++++++++++++++++++++++
 regress/sys/kern/umount/check_umount.sh |  33 ++++++++++++++++++++
 regress/sys/kern/umount/disktab         |   7 ++++
 4 files changed, 95 insertions(+), 2 deletions(-)

diffs (117 lines):

diff -r c76ef58c5727 -r c63e6ada2038 regress/sys/kern/Makefile
--- a/regress/sys/kern/Makefile Mon Apr 14 23:42:21 2003 +0000
+++ b/regress/sys/kern/Makefile Tue Apr 15 06:19:57 2003 +0000
@@ -1,6 +1,6 @@
-#      $NetBSD: Makefile,v 1.21 2003/01/30 19:47:00 thorpej Exp $
+#      $NetBSD: Makefile,v 1.22 2003/04/15 06:19:57 erh Exp $
 
 SUBDIR+= execve extent getcwd ipf kqueue lock lockf pipe poll ras \
-       sigtramp sysvmsg sysvsem sysvshm ucontext unfdpass writev
+       sigtramp sysvmsg sysvsem sysvshm ucontext umount unfdpass writev
 
 .include <bsd.subdir.mk>
diff -r c76ef58c5727 -r c63e6ada2038 regress/sys/kern/umount/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/umount/Makefile  Tue Apr 15 06:19:57 2003 +0000
@@ -0,0 +1,53 @@
+# $NetBSD: Makefile,v 1.1 2003/04/15 06:19:59 erh Exp $
+#
+#  This test creates and mounts a temporary filesystem.  Then it
+#  forcibly unmounts it while in the mount point and checks that
+#  things work as expected.
+#
+
+.include <bsd.own.mk>
+
+TMPMP=${.OBJDIR}/umount-f_mount
+TMPIM=${.OBJDIR}/umount-f.im
+
+VND?= vnd0
+BVND= /dev/${VND}
+CVND= /dev/r${VND}
+MPART?= a
+
+regress: mountfs run_script clean
+
+clean:
+       @echo "***  Cleaning up ${TMPMP}, ${TMPIM}."
+       -umount -f "${TMPMP}"
+       -vnconfig -u "${VND}"
+       -rm -rf "${TMPMP}" "${TMPIM}"
+
+mountfs:
+       @mkdir ${TMPMP}
+       @touch ${TMPMP}/under_the_mount
+       @echo "***  Creating a dummy directory tree at ${TMPMP} monted on" \
+           "${TMPIM}"
+       @dd if=/dev/zero of=${TMPIM} count=5860
+       @vnconfig -v ${VND} ${TMPIM}
+       @disklabel -f ${.CURDIR}/disktab -rw ${VND} floppy288
+       @newfs -i 500 -b 8192 -f 1024 ${CVND}${MPART}
+       @mount -o async ${BVND}${MPART} ${TMPMP}
+       @touch ${TMPMP}/in_mounted_directory
+
+
+run_script:
+       @echo "***  Testing forced unmount"
+       @if [ ! -e "${TMPMP}/in_mounted_directory" ] ; then \
+               echo "Test file not present in mounted directory!" ;\
+               false ;\
+       fi
+       @cd "${TMPMP}" && umount -f "${BVND}${MPART}" && \
+        sh ${.CURDIR}/check_umount.sh
+       @if [ ! -e "${TMPMP}/under_the_mount" ]; then \
+               echo "Original mount point dissapeared!" ;\
+               false ;\
+       fi
+       @echo "***  SUCCESS"
+
+.include <bsd.obj.mk>
diff -r c76ef58c5727 -r c63e6ada2038 regress/sys/kern/umount/check_umount.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/umount/check_umount.sh   Tue Apr 15 06:19:57 2003 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+# $NetBSD: check_umount.sh,v 1.1 2003/04/15 06:19:59 erh Exp $
+
+# This script expects to be run with the current directory
+# set to a location that has just been forcibly unmounted.
+
+retval=0
+
+checkit()
+{
+       OUTPUT=`$CMD 2>&1`
+       if [ "$OUTPUT" != "$EXPECT" ] ; then
+               retval=1
+               echo "Command \"$CMD\" failed:"
+               echo "OUTPUT: $OUTPUT"
+               echo "EXPECTED: $EXPECT"
+       fi
+}
+
+CMD="ls ."
+EXPECT="ls: .: No such file or directory"
+checkit
+CMD="ls .."
+EXPECT="ls: ..: No such file or directory"
+checkit
+CMD="cd ."
+EXPECT="cd: can't cd to ."
+checkit
+CMD="cd .."
+EXPECT="cd: can't cd to .."
+checkit
+
+exit $retval
diff -r c76ef58c5727 -r c63e6ada2038 regress/sys/kern/umount/disktab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/umount/disktab   Tue Apr 15 06:19:57 2003 +0000
@@ -0,0 +1,7 @@
+#      $NetBSD: disktab,v 1.1 2003/04/15 06:19:59 erh Exp $
+
+floppy288|2.88MB 3.5in Extra High Density Floppy:\
+       :ty=floppy:se#512:nt#2:rm#300:ns#36:nc#80:\
+       :pa#5760:oa#0:ba#4096:fa#512:ta=4.2BSD:\
+       :pb#5760:ob#0:\
+       :pc#5760:oc#0:



Home | Main Index | Thread Index | Old Index