1 # $NetBSD: t_umount.sh,v 1.5 2010/11/07 17:51:19 jmmv Exp $
3 # Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
36 atf_test_case umount cleanup
39 atf_set
"descr" "Checks forced unmounting"
40 atf_set
"require.user" "root"
45 floppy288|2.88MB 3.5in Extra High Density Floppy:\
46 :ty=floppy:se#512:nt#2:rm#300:ns#36:nc#80:\
47 :pa#5760:oa#0:ba#4096:fa#512:ta=4.2BSD:\
52 echo "*** Creating a dummy directory tree at" \
53 "${TMPMP} mounted on ${TMPIM}"
55 atf_check
-o ignore
-e ignore mkdir
${TMPMP}
56 atf_check
-o ignore
-e ignore
touch ${TMPMP}/under_the_mount
57 atf_check
-o ignore
-e ignore
dd if=/dev
/zero of
=${TMPIM} count
=5860
58 atf_check
-o ignore
-e ignore vnconfig
-v ${VND} ${TMPIM}
59 atf_check
-o ignore
-e ignore disklabel
-f disktab
-rw ${VND} floppy288
60 atf_check
-o ignore
-e ignore newfs
-i 500 -b 8192 -f 1024 ${CVND}${MPART}
61 atf_check
-o ignore
-e ignore mount
-o async
${BVND}${MPART} ${TMPMP}
62 atf_check
-o ignore
-e ignore
touch ${TMPMP}/in_mounted_directory
64 echo "*** Testing forced unmount"
65 test -e "${TMPMP}/in_mounted_directory" || \
66 atf_fail
"Test file not present in mounted directory!"
70 atf_check
-o ignore
-e ignore umount
-f "${BVND}${MPART}"
72 atf_check
-s ne
:0 -e inline
:"ls: .: No such file or directory\n" ls .
73 atf_check
-s ne
:0 -e inline
:"ls: ..: No such file or directory\n" ls ..
75 atf_check
-s ne
:0 -e ignore
-o inline
:"cd: can't cd to .\n" \
77 atf_check
-s ne
:0 -e ignore
-o inline
:"cd: can't cd to ..\n" \
82 test -e "${TMPMP}/under_the_mount" || \
83 atf_fail
"Original mount point dissapeared!"
87 echo "*** Cleaning up ${TMPMP}, ${TMPIM}."
94 atf_add_test_case umount