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_FS_LOCATIONS in NFSv4 UFS, expect OK 
  29 #
  30 
  31 set TESTROOT $env(TESTROOT)
  32 set delm $env(DELM)
  33 
  34 # include common code and init section
  35 source ${TESTROOT}${delm}tcl.init
  36 source ${TESTROOT}${delm}testproc
  37 
  38 # connect to the test server
  39 Connect
  40 
  41 # setting local variables
  42 set TNAME $argv0
  43 set expcode "OK"
  44 # Get testfile pathname
  45 set bfh [get_fh "$BASEDIRS"]
  46 
  47 # Start testing
  48 # ---------------------------------------------------------------
  49 # a:Test get attr FATTR4_FS_LOCATIONS in NFSv4 UFS, expect OK 
  50 
  51 set ASSERTION "Test get attr FATTR4_FS_LOCATIONS, expect OK"
  52 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  53 
  54 # Get a list of the supported attributes
  55 set attr {supported_attrs}
  56 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attr }]
  57 set cont [ckres "Getattr" $status $expcode $res $FAIL]
  58 
  59 if { ![string equal $cont "false"] } {
  60 
  61 # Create supported_attr list
  62 set alist [lindex [lindex $res 3] 2]
  63 foreach attrval $alist {
  64         set val [lindex $attrval 1]
  65         set list [split $val]
  66         putmsg stdout 1 "val on alist is $val"
  67         putmsg stdout 1 "split list is $list"
  68 }
  69 
  70 # Setup testfile for attribute purposes
  71 set attr {fs_locations}
  72 
  73 # Attempt Getattr of unsupported fs_locations attr 
  74 set res2 [compound {
  75         Putfh $bfh;
  76         Lookup $env(TEXTFILE);
  77         Getfh;
  78         Getattr $attr
  79 }]
  80 set cont2 [ckres "Getattr" $status $expcode $res2 $FAIL]
  81 
  82 if { ![string equal $cont "false"] } {
  83 
  84 # Verify attr not in supported_attr list
  85         if { [ lsearch -exact $list $attr ] < 0 } {
  86                 putmsg stdout 0 "\t Test PASS: $attr not in supported attr list"
  87         } else {
  88                 putmsg stdout 0 "\t Test FAIL: unexpected $attr in supported attr list"
  89         }
  90 
  91 }
  92 
  93 }
  94 
  95 puts ""
  96 
  97 Disconnect 
  98 exit $PASS