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 for so in $Share_opts; do
50 # For possible assertions, skip invalid options
51 # e.g.: 'rw,sec=' or 'ro,sec=' (sec= must go first)
52 echo "$so" | egrep "rw,sec=|ro,sec=" && continue
53 [[ $so == *anon=*anon=* ]] && continue
54
55 for mo in $Mount_opts; do
56 # For possible assertions, skip the conflict options
57 # e.g. 2 of "sec="
58 ck=$(echo "$mo" | \
59 nawk -F\, '{k=0; for (i=1; i<=NF; i++) \
60 {if ($i ~ /sec=/) k++}; print k}')
61 (( $ck > 1 )) && continue
62 # or "rw" & "ro" conflicts
63 ck=$(echo "$mo" | \
64 nawk -F\, '{k=0; for (i=1; i<=NF; i++) \
65 {if (($i ~ /rw/) || ($i ~ /ro/)) k++;} print k}')
66 (( $ck > 1 )) && continue
67
68 # skip proto=rdma tests if TESTRDMA=no
69 if [[ $mo == *proto=rdma* ]]; then
70 echo "$TESTRDMA" | grep -i no > /dev/null 2>&1
71 (( $? == 0 )) && continue
72 fi
73
74 for v in $Versions; do
75 [[ $v == "default" ]] && mo2=${mo} || mo2=${mo},${v}
76 if [[ $mo2 == *proto=udp*vers=4 ]]; then
77 if (( $so_flg == 0 )); then
78 so_flg=1
79 tag="NEG_MNT"
80 Tname=${tag}${mo2}
81 echo "adding $Tname test"
82 stf_addassert -u root -t $Tname -c neg_test \
83 "$Tname $mo2"
84 fi
85 continue
86 fi
87 Tname=SH${so}_MNT${mo2}
88 echo "adding $Tname test"
89 stf_addassert -u root -t $Tname -c runtests \
90 "$Tname $so $mo2"
91 done
92 done
93 done
94
95 # The followings are the negative cases
96 tag="NEG_MNT"
97 Mount_opts="sec=* sec=JUNK"
98 for mo in $Mount_opts; do
99 Tname=${tag}${mo}
100 echo "adding $Tname test"
101 stf_addassert -u root -t $Tname -c neg_test "$Tname $mo"
102 done
103
104 tag="NEG_SH"
105 Share_opts="sec=* sec=JUNK rw,ro ro,rw"
106 for so in $Share_opts; do
107 Tname=${tag}${so}
108 echo "adding $Tname test"
109 stf_addassert -u root -t $Tname -c neg_test "$Tname $so"
110 done
111 Share_opts="$CLIENT_S $CLIENT_S:$SERVER_S $SERVER_S:$CLIENT_S"
112 for i in $Share_opts; do
113 for j in $Share_opts; do
114 for so in "ro=$i,rw=$j" "rw=$i,ro=$j"; do
115 Tname=$(echo ${tag}${so} | \
116 sed -e "s%$CLIENT_S%CLNT%g" \
117 -e "s%$SERVER_S%SRV%g")
118 echo "adding $Tname test"
119 stf_addassert -u root -t $Tname -c neg_test "$Tname $so"
120 done
121 done
122 done
123
124 exit 0