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 2006 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # NFSv4 numbered attributes:
  27 #
  28 # a: Test get attr FATTR4_QUOTA_AVAIL_HARD NOT SUPPORTED in NFSv4 on 
  29 #    UFS(Unix Filesystem), expect OK 
  30 # b: Test get attr FATTR4_QUOTA_AVAIL_SOFT NOT SUPPORTED in NFSv4 on 
  31 #    UFS(Unix Filesystem), expect OK 
  32 # c: Test get attr FATTR4_QUOTA_USED NOT SUPPORTED in NFSv4 on 
  33 #    UFS(Unix Filesystem), expect OK 
  34 #
  35 
  36 set TESTROOT $env(TESTROOT)
  37 set delm $env(DELM)
  38 
  39 # include common code and init section
  40 source ${TESTROOT}${delm}tcl.init
  41 source ${TESTROOT}${delm}testproc
  42 
  43 # connect to the test server
  44 Connect
  45 
  46 # setting local variables
  47 set TNAME $argv0
  48 set expcode "FAIL"
  49 # Get testfile pathname
  50 set bfh [get_fh "$BASEDIRS"]
  51 
  52 # Start testing
  53 # ---------------------------------------------------------------
  54 # a:Test get attr FATTR4_QUOTA_HARD NOT SUPPORTED in NFSv4 on UFS, expect OK 
  55 
  56 set ASSERTION "Test get attr FATTR4_QUOTA_HARD NOT SUPPORTED in NFSv4 on UFS, expect OK"
  57 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  58 
  59 # Get a list of the supported attributes
  60 set attr {supported_attrs}
  61 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attr }]
  62 set cont [ckres "Getattr" $status "OK" $res $FAIL]
  63 
  64 
  65 if { ![string equal $cont "false"] } {
  66 
  67 # Create supported_attr list
  68 set alist [lindex [lindex $res 3] 2]
  69 foreach attrval $alist {
  70         set val [lindex $attrval 1]
  71         set list [split $val]
  72         putmsg stdout 1 "val on alist is $val"
  73         putmsg stdout 1 "split list is $list"
  74 }
  75 
  76 # Setup test attr for testing purposes
  77 set attr {quota_avail_hard}
  78 
  79 #Get the filehandle of the test file 
  80 set res2 [compound {
  81         Putfh $bfh;
  82         Lookup $env(TEXTFILE);
  83         Getfh;
  84         Getattr $attr
  85 }]
  86 set cont2 [ckres "Getattr" $status "OK" $res2 $FAIL]
  87 
  88 if { ![string equal $cont2 "false"] } {
  89         # Verify attr not in supported_attr list
  90         if { [ lsearch -exact $list $attr ] < 0 } {
  91                 putmsg stdout 0 "\t Test PASS: $attr not in supported attr list"
  92         } else {
  93                 putmsg stdout 0 "\t Test FAIL: unexpected $attr in supported attr list"
  94         }
  95 }
  96 
  97 }
  98 
  99 puts ""
 100 
 101 # ---------------------------------------------------------------
 102 # b:Test get attr FATTR4_QUOTA_AVAIL_SOFT NOT SUPPORTED in NFSv4 on UFS, expect FAIL
 103 
 104 set ASSERTION "Test get attr FATTR4_QUOTA_AVAIL_SOFT NOT SUPPORTED in NFSv4 on UFS, expect OK"
 105 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
 106 
 107 # Get a list of the supported attributes
 108 set attr {supported_attrs}
 109 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attr }]
 110 set cont [ckres "Getattr" $status "OK" $res $FAIL]
 111 
 112 if { ![string equal $cont "false"] } {
 113 
 114 # Create supported_attr list
 115 set alist [lindex [lindex $res 3] 2]
 116 foreach attrval $alist {
 117         set val [lindex $attrval 1]
 118         set list [split $val]
 119         putmsg stdout 1 "val on alist is $val"
 120         putmsg stdout 1 "split list is $list"
 121 }
 122 
 123 # Setup attr for testing purposes
 124 set attr {quota_avail_soft}
 125 
 126 #Get the filehandle of the test file
 127 set res2 [compound {
 128         Putfh $bfh;
 129         Lookup $env(TEXTFILE);
 130         Getfh;
 131         Getattr $attr
 132 }]
 133 set cont2 [ckres "Getattr" $status "OK" $res2 $FAIL]
 134 
 135 if { ![string equal $cont2 "false"] } {
 136         # Verify attr not in supported_attr list
 137         if { [ lsearch -exact $list $attr ] < 0 } {
 138                 putmsg stdout 0 "\t Test PASS: $attr not in supported attr list"
 139         } else {
 140                 putmsg stdout 0 "\t Test FAIL: unexpected $attr in supported attr list"
 141         }
 142 }
 143 
 144 }
 145 
 146 puts ""
 147 
 148 
 149 # ---------------------------------------------------------------
 150 # c:Test get attr FATTR4_QUOTA_USED NOT SUPPORTED in NFSv4 on UFS, expect FAIL
 151 
 152 set ASSERTION "Test get attr FATTR4_QUOTA_USED NOT SUPPORTED in NFSv4 on UFS, expect FAIL"
 153 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
 154 
 155 # Get a list of the supported attributes
 156 set attr {supported_attrs}
 157 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attr }]
 158 ckres "Getattr" $status "OK" $res $FAIL
 159 
 160 # Create supported_attr list
 161 set alist [lindex [lindex $res 3] 2]
 162 foreach attrval $alist {
 163         set val [lindex $attrval 1]
 164         set list [split $val]
 165         putmsg stdout 1 "val on alist is $val"
 166         putmsg stdout 1 "split list is $list"
 167 }
 168 
 169 # Setup test attr for testing purposes
 170 set attr {quota_used}
 171 
 172 #Get the filehandle of the test file
 173 set res2 [compound {
 174         Putfh $bfh;
 175         Lookup $env(TEXTFILE);
 176         Getfh;
 177         Getattr $attr
 178 }]
 179 ckres "Getattr" $status "OK" $res2 $FAIL
 180 
 181 # Verify attr not in supported_attr list
 182 if { [ lsearch -exact $list $attr ] < 0 } {
 183         putmsg stdout 0 "\t Test PASS: $attr not in supported attr list"
 184 } else {
 185         putmsg stdout 0 "\t Test FAIL: unexpected $attr in supported attr list"
 186 }
 187 
 188 puts ""
 189 
 190 Disconnect 
 191 exit $PASS