1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 # ident "@(#)checkenv_def 1.6 08/07/31 SMI" 27 # 28 29 . $STF_SUITE/include/autofs-util.kshlib 30 . $STF_TOOLS/contrib/include/nfs-tx.kshlib 31 32 TASK=$1 33 34 # 35 # TX check 36 # 37 function checkTX 38 { 39 ce_is_system_labeled 40 ret=$? 41 if (( $ret == 0 )); then 42 if [[ -z $ZONE_PATH ]]; then 43 echo "env variable ZONE_PATH not set, exiting..." 44 echo "You are running the suite over a CIPSO connection, \c" 45 echo "you MUST set ZONE_PATH with /zone/<zone name>" 46 exit 1 47 fi 48 else 49 if [[ -n $ZONE_PATH ]]; then 50 echo "ZONE_PATH is set without TX, exiting.. " 51 save_results $ret 52 fi 53 fi 54 } 55 56 57 # Though we check in configure.ksh that the SERVER variable 58 # is defined and the machine is up, we recheck here to make 59 # sure that nothing has happened since the stf_configure 60 # script ran which might cause the tests to fail. 61 # Also we check SERVER is different from the local-host 62 # 63 function checkEnvVarialbes 64 { 65 # check SERVER variable exist 66 if [[ -z $SERVER ]]; then 67 echo "SERVER not set, exiting." 68 exit 1 69 fi 70 71 # check SERVER is alive 72 /usr/sbin/ping $SERVER > /dev/null 2>&1 73 if (( $? != 0 )); then 74 echo "$SERVER not responding to pings, exiting." 75 exit 1 76 fi 77 78 # check rsh works on SERVER 79 RSH root $SERVER /bin/true > /tmp/ckrsh.$$ 2>&1 80 if (( $? != 0 )); then 81 echo "Failed to <rsh> to $SERVER, exiting." 82 cat /tmp/ckrsh.$$ 83 rm -f /tmp/ckrsh.$$ 84 exit 1 85 else 86 rm -f /tmp/ckrsh.$$ 87 fi 88 89 # check SERVER is different from the local_host 90 serverHostname=`/usr/bin/rsh -n $SERVER "hostname"` 91 localHostname=`hostname` 92 if [[ $serverHostname == $localHostname ]]; then 93 echo "hostname for SERVER: $serverHostname, hostname for local_host: $localHostname" 94 echo "SERVER must be different from the local_host, exiting." 95 exit 1 96 fi 97 98 if [[ -z $MNTPTR ]]; then 99 echo "MNTPTR not set, exiting." 100 exit 1 101 fi 102 } 103 104 # check TX and env variables in "CONFIGURE" AND "EXECUTE" phases 105 if [[ $TASK == "CONFIGURE" || $TASK == "EXECUTE" ]]; then 106 checkTX 107 checkEnvVarialbes 108 fi 109 110