1 #! /usr/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 . ${STF_SUITE}/include/nfsgen.kshlib
29
30 readonly FILE=$(whence -p ${0})
31 readonly NAME=$(basename $0)
32 readonly DIR=$(dirname $0)
33
34 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
35 && set -x
36
37 if [[ $SHRDIR == "/" ]]; then
38 echo "As SHRDIR is set '/', the case can't run 'ls' in MNTDIR"
39 exit $STF_UNTESTED
40 fi
41
42 echo "\n $NAME: looping mount/ls in ${SERVER}:$SHRDIR mounting <${MNTOPT}>"
43 echo "\t START TIME: `date`\n"
44
45 #
46 # Default of 500 iterations unless 1st parameter to
47 # testcase sez otherwise.
48 #
49 ST05_ITER=${ST05_ITER:-500}
50 echo "\t ==> Going to loop thru ${ST05_ITER} times"
51
52 # create a tmp dir as a mount point
53 TMPMNT=${ZONE_PATH}${STF_TMPDIR}/${NAME}.mnt.$$
54 mkdir -p ${TMPMNT}
55 [[ $MNTOPT == "" ]] && MNTOPT="rw"
56 typeset i=0
57 while (( $i < ${ST05_ITER} )); do
58 # Do the mount
59 mount -o ${MNTOPT} ${SERVER}:${SHRDIR} ${TMPMNT} > ${STF_TMPDIR}/mnt.$i.$$ 2>&1
60 if (( $? != 0 )); then
61 echo "ERROR: KID=$i, Mount failed"
62 cat ${STF_TMPDIR}/mnt.$i.$$
63 cleanup $STF_FAIL
64 fi
65
66 ls -lR ${TMPMNT} > $STF_TMPDIR/ls.$i.$$ 2>&1
67 if (( $? != 0 )); then
68 echo "ERROR: KID=$i, ls -lR ${TMPMNT} failed"
69 cat $STF_TMPDIR/ls.$i.$$
70 umount -f ${TMPMNT}
71 cleanup $STF_FAIL
72 fi
73
74 umount ${TMPMNT} > ${STF_TMPDIR}/umnt.$i.$$ 2>&1
75 if (( $? != 0 )); then
76 echo "ERROR: KID=$i, Unmount failed"
77 cat ${STF_TMPDIR}/umnt.$i.$$
78 cleanup $STF_FAIL
79 fi
80 (( i = i+1 ))
81 done
82
83 rm -rf ${TMPMNT}
84
85 echo "\t Test PASS: Test run completed successfully"
86 echo "\t END TIME: `date`\n"
87 cleanup $STF_PASS