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 NAME=$(basename $0)
  29 
  30 . ${STF_SUITE}/include/nfsgen.kshlib
  31 
  32 # Turn on debug info, if requested
  33 export _NFS_STF_DEBUG=$_NFS_STF_DEBUG:$NFSGEN_DEBUG
  34 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
  35        && set -x
  36 
  37 USAGE="Usage: runtests Test_name deleg scenario mode_index oflag_index"
  38 
  39 export Tprog=$1
  40 export Tname=$2
  41 export deleg=$3
  42 export SCENARIO=$4
  43 export MODE_INDEX=$5
  44 export OFLAG_INDEX=$6
  45 
  46 if (( $# < 5 )); then
  47         echo "$USAGE"
  48         cleanup $STF_UNRESOLVED
  49 fi
  50 
  51 if [[ $deleg != none ]]; then
  52         # set delegation on the server
  53         # but only do it once if testing the same scenaior
  54         if [[ ! -f $STF_TMPDIR/deleg_been_set || \
  55             `cat $STF_TMPDIR/deleg_been_set` != "$deleg" ]]; then
  56                 RSH root $SERVER \
  57                     ". $SRV_TMPDIR/srv_env.vars && \
  58                     . $SRV_TMPDIR/nfs-util.kshlib && \
  59                     set_nfs_property NFS_SERVER_DELEGATION $deleg" \
  60                         > $STF_TMPDIR/set_deleg.$$ 2>&1
  61                 if (( $? != 0 )); then
  62                         echo "ERROR: failed to set delegation on the server"
  63                         cat $STF_TMPDIR/set_deleg.$$
  64                         cleanup $STF_UNINITIATED
  65                 else
  66                         echo "$deleg" > $STF_TMPDIR/deleg_been_set
  67                 fi
  68         fi
  69 fi
  70 
  71 [[ :${NFSGEN_DEBUG}: == *:opentest:* \
  72         || :${NFSGEN_DEBUG}: == *:all:* ]] && DPRINT="-d 2"
  73 
  74 
  75 # In TX config, a regular user has no permission to access
  76 # label path, we need to enter the path as root, then operate
  77 # test file with relative path.
  78 cd $MNTDIR
  79 
  80 $Tprog $DPRINT -u $TUID01 -g $TGID -U 60001 -G 60001 -eWS \
  81         -l $NAME.$CLIENT.$$ $MNTDIR
  82 cleanup $?