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 #
29 # NFSv4 client recovery:
30 # a: Verify client recovers on a stat lookup op after server \
31 # re-boots, expect OK
32 # b: Verify client recovers on a stat lookup op after nfsd dies and \
33 # restarts, expect OK
34 #
35
36 . ${STF_SUITE}/include/nfsgen.kshlib
37
38 NAME=$(basename $0)
39
40 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] && set -x
41
42 DIR=$(dirname $0)
43 PATH=/usr/bin:$PATH
44
45 # Global variables
46 TESTFILE="textfile.txt"
47
48 if [ ! -x $DIR/$prog ]; then
49 echo "$NAME: STF_FAILED"
50 echo "\t the executible program '$prog' not found."
51 return $STF_FAIL
52 fi
53
54 # Start test
55 # --------------------------------------------------------------------
56 # a: Verify client recovery on a stat lookup after server re-boots, \
57 # expect OK
58 ASSERTION="Verify client recovery on a stat lookup after server \
59 re-boots"
60 ASSERTION="$ASSERTION, expect successful"
61 echo "$NAME{a}: $ASSERTION"
62
63 # stat file before server reboots
64 #${DIR}/stat $MNTDIR/$TESTFILE > $STF_TMPDIR/$NAME.out.$$ 2>&1
65 #wait
66 #if [ $? -ne 0 ]; then
67 # echo "$NAME: "
68 # echo "\tCouldn't stat file"
69 # echo "\t Test FAIL"
70 # return 1
71 #fi
72
73 #$DIR/isserverup reboot > $STF_TMPDIR/$NAME.boot.$$ 2>&1
74 #grep "no answer from $SERVER" $STF_TMPDIR/$NAME.boot.$$ 2>&1
75 #if [ $? -eq 0 ]; then
76 # echo "$NAME: "
77 # echo "\tSERVER did not reboot properly"
78 # echo "\t Test FAIL"
79 # return 1
80 #fi
81
82 # stat file after server reboots and verify over the wire lookup
83 #${DIR}/stat $MNTDIR/$TESTFILE > $STF_TMPDIR/$NAME.out2.$$ 2>&1
84 #wait
85 #if [ $? -ne 0 ]; then
86 # echo "$NAME: "
87 # echo "\tCouldn't stat file after server reboot"
88 # echo "\t Test FAIL"
89 # return 1
90 #fi
91
92 #diff $STF_TMPDIR/$NAME.out.$$ $STF_TMPDIR/$NAME.out2.$$ > \
93 #$STF_TMPDIR/$NAME.diff.$$ 2>&1
94 #if [ $? -ne 0 ]; then
95 # echo "$NAME: "
96 # echo "\tstat: found file attribute differences"
97 # cat $STF_TMPDIR/$NAME.diff.$$
98 # echo "\t Test FAIL"
99 # return 1
100 #fi
101 echo "\tTest UNTESTED"
102
103 # cleanup test and tmpfiles
104 #rm -f $STF_TMPDIR/$NAME.out.*
105 #rm -f $MNTDIR/$TESTFILE
106
107 # --------------------------------------------------------------------
108 # b: Verify client recovers on stat lookup after nfsd dies and \
109 # restarts, expect OK
110 ASSERTION="Verify client recovers on stat lookup after nfsd \
111 dies"
112 ASSERTION="$ASSERTION, expect successful"
113 echo "$NAME{b}: $ASSERTION"
114
115 # stat file before server reboots
116 #${DIR}/stat $MNTDIR/$TESTFILE > $STF_TMPDIR/$NAME.out.$$ 2>&1
117 #wait
118 #if [ $? -ne 0 ]; then
119 # echo "$NAME: "
120 # echo "\tCouldn't stat file"
121 # echo "\t Test FAIL"
122 # return 1
123 #fi
124
125 #$DIR/issserverup nfsd-reset > $STF_TMPDIR/$NAME.restart.$$ 2>&1
126
127 # stat file after server reboots and verify over the wire lookup
128 #${DIR}/stat $MNTDIR/$TESTFILE > $STF_TMPDIR/$NAME.out2.$$ 2>&1
129 #wait
130 #if [ $? -ne 0 ]; then
131 # echo "$NAME: "
132 # echo "\tCouldn't stat file after server reboot"
133 # echo "\t Test FAIL"
134 # return 1
135 #fi
136
137 #diff $STF_TMPDIR/$NAME.stat.$$ $STF_TMPDIR/$NAME.stat2.$$ > \
138 #$STF_TMPDIR/$NAME.diff.$$ 2>&1
139 #if [ $? -ne 0 ]; then
140 # echo "$NAME: "
141 # echo "\tDifferences in stat files found"
142 # cat $STF_TMPDIR/$NAME.diff.$$
143 # echo "\t Test FAIL"
144 # return 1
145 #fi
146 echo "\tTest UNTESTED"
147
148 exit $STF_UNTESTED
149
150 # cleanup test and tmpfiles
151 #rm -f $STF_TMPDIR/$NAME.out.*
152 #rm -f $MNTDIR/$TESTFILE