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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27 # control program for all NFSv4 client recovery tests
28 #
29
30 [ -n "$DEBUG" ] && [ "$DEBUG" != "0" ] && set -x
31
32 NAME=`basename $0`
33 DIR=`dirname $0`
34 TESTROOT=${TESTROOT:-"$DIR/.."}
35
36 # Must be run as root since server re-boots
37 id | grep "0(root)" > /dev/null 2>&1
38 if [ $? -ne 0 ]; then
39 echo "Must be root to run $NAME tests."
40 exit $OTHER
41 fi
42
43 # sourcing framework global environment variables created after go_setup
44 # and for this purpose only this file should be sourced
45 CONFIGFILE=/var/tmp/nfsv4/config/config.suite
46 if [[ ! -f $CONFIGFILE ]]; then
47 echo "$NAME: CONFIGFILE[$CONFIGFILE] not found;"
48 echo "\texit UNINITIATED."
49 exit 6
50 fi
51 . $CONFIGFILE
52
53 function cleanup
54 {
55 rm -f $TMPDIR/*.$$ $TMPDIR/SERVER_NOT_IN_GRACE > /dev/null 2>&1
56 exit $1
57 }
58
59 # Setup the server with necessary files for recovery testing
60 echo "Setting up server<$SERVER> for recovery testing."
61 $DIR/recov_setup
62 if [ $? -ne 0 ]; then
63 echo "ERROR: recovery/recov_setup failed to setup server"
64 cleanup 1
65 fi
66
67 # Start the tests with some information
68 echo " "
69 echo "Testing on CLIENT=[`uname -n`] to SERVER=[$SERVER]"
70 echo "Started $dir tests at [`date`] ..."
71 echo " "
72
73 # Now ready to run the tests
74 TESTLIST=${TESTLIST:-`egrep -v "^#|^ *$" RECOV.flist`}
75
76 for t in $TESTLIST
77 do
78 $TESTROOT/nfsh $t
79 sleep 3
80 done
81
82 echo " "
83 echo "Testing ends at [`date`]."
84 echo " "
85
86 # Now cleanup the stuffs from recovery testing
87 echo "Cleaning up server<$SERVER> from the recovery testing."
88 $DIR/recov_cleanup
89 if [ $? -ne 0 ]; then
90 echo "ERROR: recovery/recov_cleanup failed to cleanup server"
91 cleanup 1
92 fi
93
94 cleanup 0