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_SUPPORTED_ATTRS attributes, expect OK"
  29 #
  30 
  31 # Get the TESTROOT directory; set to '.' if not defined
  32 set TESTROOT $env(TESTROOT)
  33 set delm $env(DELM)
  34 
  35 # include common code and init section
  36 source ${TESTROOT}${delm}tcl.init
  37 source ${TESTROOT}${delm}testproc
  38 
  39 # connect to the test server
  40 Connect
  41 
  42 # setting local variables
  43 set TNAME $argv0
  44 set expcode "OK"
  45 # Get testfile pathname
  46 set bfh [get_fh "$BASEDIRS"]
  47 
  48 # Start testing
  49 # ---------------------------------------------------------------
  50 # a: Test get attr FATTR4_SUPPORTED_ATTRS attributes, expect OK"
  51 
  52 set ASSERTION "Test get attr FATTR4_SUPPORTED_ATTRS attributes, expect $expcode"
  53 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  54 
  55 set attrs {supported_attrs}
  56 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attrs }]
  57 set fh [lindex [lindex $res 2] 2]
  58 prn_attrs [lindex [lindex $res 3] 2]
  59 set cont [ckres "Getattr" $status $expcode $res $FAIL]
  60 
  61 if { ![string equal $cont "false"] } {
  62 
  63 # Create supported_attr list
  64 set alist [lindex [lindex $res 3] 2]
  65 foreach attrval $alist {
  66         set val [lindex $attrval 1]
  67         set list [split $val]
  68         putmsg stdout 1 "val on alist is $val"
  69         putmsg stdout 1 "split list is $list"
  70 }
  71 
  72 # Setup mandatory attributes list
  73 set mand_attrs {supported_attrs type fh_expire_type change size link_support \
  74         symlink_support named_attr fsid unique_handles lease_time \
  75         rdattr_error filehandle} 
  76 
  77 # Verify mandatory attrs are in supported_attr list
  78 set foundmatch 0
  79 set mandnum [llength $mand_attrs]
  80 set errlist ""
  81 foreach attrname $mand_attrs {
  82         if { [ lsearch -exact $list $attrname ] < 0 } {
  83                 set errlist "$errlist $attrname"
  84         } else {
  85                 incr foundmatch
  86         }
  87 }
  88 if { "$errlist" != "" } {
  89         putmsg stderr 0 "\t Test FAIL: Attributes ($errlist) not found in supported_list"
  90         break
  91 } else {
  92         if { $foundmatch == $mandnum } {
  93                 putmsg stdout 0 "\t Test PASS"
  94         } else {
  95                 putmsg stderr 0 "\t Test FAIL: all mandatory attributes not in list."
  96                 break
  97         }
  98 }
  99 
 100 }
 101 
 102 puts ""
 103 
 104 Disconnect 
 105 exit 0