diff --git a/regress/sys/kern/Makefile b/regress/sys/kern/Makefile index c7fbcc36701e..1e7e326cde9e 100644 --- a/regress/sys/kern/Makefile +++ b/regress/sys/kern/Makefile @@ -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 diff --git a/regress/sys/kern/umount/Makefile b/regress/sys/kern/umount/Makefile new file mode 100644 index 000000000000..397564a6e88b --- /dev/null +++ b/regress/sys/kern/umount/Makefile @@ -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 + +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 diff --git a/regress/sys/kern/umount/check_umount.sh b/regress/sys/kern/umount/check_umount.sh new file mode 100755 index 000000000000..0a746823ee0c --- /dev/null +++ b/regress/sys/kern/umount/check_umount.sh @@ -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 --git a/regress/sys/kern/umount/disktab b/regress/sys/kern/umount/disktab new file mode 100644 index 000000000000..d316aa77cae5 --- /dev/null +++ b/regress/sys/kern/umount/disktab @@ -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: