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 CDIR=$(dirname $0)
  30 
  31 . $CDIR/${CDIR##*/}.vars
  32 . $STF_SUITE/include/sharemnt.kshlib
  33 . $STC_GENUTILS/include/libsmf.shlib
  34 . $STC_GENUTILS/include/nfs-tx.kshlib
  35 
  36 export STC_GENUTILS_DEBUG=$STC_GENUTILS_DEBUG:$SHAREMNT_DEBUG
  37 [[ :$SHAREMNT_DEBUG: == *:$NAME:* \
  38         || :$SHAREMNT_DEBUG: == *:all:* ]] && set -x
  39 
  40 # check again if proto=rdma tests should be generated
  41 echo "$TESTRDMA" | grep -i no > /dev/null 2>&1
  42 (( $? != 0 )) && . $STF_CONFIG/stf_config.suite
  43 
  44 typeset -i so_flg=0
  45 Share_opts=$(gen_opt_list "$SHROPTS")
  46 Mount_opts=$(gen_opt_list "$MNTOPTS")
  47 Versions="$VEROPTS"
  48 
  49 # The "nosub" option
  50 so="nosub"
  51 for mo in $Versions; do
  52         [[ $mo == "default" ]] && mo=""
  53         Tname=SH${so}_MNT${mo}
  54         echo "adding $Tname test"
  55         stf_addassert -u root -t $Tname -c nosub_test "$Tname $so $mo"
  56 done
  57 
  58 tag="MNT_INTR"
  59 Mount_opts="intr nointr hard,intr hard,nointr"
  60 for mo in $Mount_opts; do
  61         for v in $Versions; do
  62                 [[ $v == "default" ]] && mo2=${mo} || mo2=${mo},${v}
  63                 Tname=${tag}${mo2}
  64                 echo "adding $Tname test"
  65                 stf_addassert -u root -t $Tname -c shrmnt_optchk "$Tname $mo2"
  66         done
  67 done
  68 
  69 tag="SH_SUID"
  70 Share_opts="default nosuid"
  71 for so in $Share_opts; do
  72         for mo in $Versions; do
  73                 [[ $so == "default" ]] && so=""
  74                 [[ $mo == "default" ]] && mo=""
  75                 Tname=${tag}${so}_MNT${mo}
  76                 echo "adding $Tname test"
  77                 stf_addassert -u root -t $Tname -c shrmnt_optchk \
  78                         "$Tname $so $mo"
  79         done
  80 done
  81 
  82 # The rsize and wsize
  83 mntopts="rsize=0 wsize=0 rsize=1 wsize=8195 rsize=32767 wsize=32769 \
  84         rsize=1048577 wsize=1048575 proto=tcp proto=udp"
  85 [[ $TESTRDMA == "yes" ]] && mntopts="$mntopts proto=rdma"
  86 Mount_opts=$(gen_opt_list "$mntopts")
  87 for mo in $Mount_opts "default"; do
  88         [[ $mo == @(*rsize=*rsize=*|*wsize=*wsize=*) ]] && continue
  89         [[ $mo == @(*proto=*proto=*|*proto=*proto=*proto=*) ]] && continue
  90         for v in $Versions; do
  91                 [[ $mo == "default" ]] && mo=""
  92                 [[ $v == "default" ]] && mo2=${mo} || mo2=${mo},${v}
  93                 mo2=${mo2#,}
  94                 [[ $mo2 == *proto=udp*vers=4 ]] && continue
  95                 if [[ $mo2 == @(*rsize=0*|*wsize=0*) ]]; then
  96                         tag="NEG_MNT"
  97                         Tname=${tag}${mo2}
  98                         echo "adding $Tname test"
  99                         stf_addassert -u root -t $Tname -c neg_test \
 100                                 "$Tname $mo2"
 101                 else
 102                         tag="MNT_SIZE"
 103                         Tname=${tag}${mo2}
 104                         echo "adding $Tname test"
 105                         stf_addassert -u root -t $Tname -c shrmnt_optchk \
 106                                 "$Tname $mo2"
 107                 fi
 108         done
 109 done
 110 
 111 tag="MNT_QUOTA"
 112 Mount_opts="default quota noquota"
 113 for mo in $Mount_opts; do
 114         for v in $Versions; do
 115                 [[ $mo == "default" ]] && mo=""
 116                 [[ $v == "default" ]] && mo2=${mo} || mo2=${mo},${v}
 117                 mo2=${mo2#,}
 118                 Tname=${tag}${mo2}
 119                 echo "adding $Tname test"
 120                 stf_addassert -u root -t $Tname -c shrmnt_optchk "$Tname $mo2"
 121         done
 122 done
 123 
 124 exit 0