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 # dom_env.sh - this file sets up script execution environment for domain
  28 # test scripts. It does the following:
  29 #
  30 #       1) source $CONFIGFILE $TESTROOT/{libsmf.shlib, testsh} files
  31 #       2) source ./dom_functions file
  32 #       3) define variables that can be used by domain testcases.
  33 # 
  34 # The file is expected to be sourced by all domain testscripts.
  35 
  36 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
  37 
  38 # Note that since the file is supposed to be included by test scripts, 
  39 # $NAME variable below actually holds the value of the test script which 
  40 # include this file.
  41 NAME=$(basename $0)
  42 CDIR=$(pwd)
  43 TESTROOT=${TESTROOT:-"$CDIR/../../"}
  44 
  45 # sourcing framework global environment variables created after go_setup
  46 # and for this purpose only this file should be sourced
  47 CONFIGFILE=/var/tmp/nfsv4/config/config.suite
  48 if [[ ! -f $CONFIGFILE ]]; then
  49         echo "$NAME: CONFIGFILE[$CONFIGFILE] not found;"
  50         echo "\texit UNINITIATED."
  51         exit 6
  52 fi
  53 
  54 for i in $CONFIGFILE \
  55          $TESTROOT/libsmf.shlib \
  56          $TESTROOT/testsh \
  57          ./dom_functions
  58 do
  59         . $i
  60         [[ $? != 0 ]] && echo "$NAME: failed to source $i;" \
  61             && echo "\texit UNINITIATED." \
  62             && exit $UNINITIATED
  63 done
  64 
  65 #
  66 # Varibles
  67 #
  68 
  69 LOGFILE=$TMPDIR/$NAME.$$.log
  70 TMPFILE=$TMPDIR/$NAME.$$.tmp
  71 TIMEOUT=60