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 GETATTR operation test - positive tests
  27 #       verify getattr with certain attrs
  28 
  29 # include all test enironment
  30 source GETATTR.env
  31 
  32 # connect to the test server
  33 Connect
  34 
  35 # setting local variables
  36 set TNAME $argv0
  37 set bfh [get_fh "$BASEDIRS"]
  38 
  39 # Start testing
  40 # --------------------------------------------------------------
  41 # a: check Getattr of a file w/some attr, expect OK
  42 set expcode "OK"
  43 set ASSERTION "check Getattr of a file w/some attr, expect $expcode"
  44 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  45 set cal {fh_expire_type named_attr type size mode acl}
  46 set res [compound {Putfh $bfh; Lookup $env(RWFILE); Getfh;
  47         Getattr $cal; Getfh}]
  48 set cont [ckres "Getattr" $status $expcode $res $FAIL]
  49 # verify the values returned for the attrs make sense
  50   if {! [string equal $cont "false"]} {
  51         set attrs [lindex [lindex $res 3] 2]
  52         set cont true
  53         foreach al $attrs {
  54             set name [lindex $al 0]
  55             set val [lindex $al 1]
  56             switch -exact -- $name {
  57               type { if {"$val" != "reg"} {
  58                 putmsg stderr 0 "\t Test FAIL: attr($al) returned unexpected."
  59                 set cont false
  60                 break
  61               } }
  62               mode { if {"$val" != "666"} {
  63                 putmsg stderr 0 "\t Test FAIL: attr($al) returned unexpected."
  64                 set cont false
  65                 break
  66               } }
  67               fh_expire_type { if {"$val" != "0"} {
  68                 putmsg stderr 0 "\t Test FAIL: attr($al) returned unexpected."
  69                 set cont false
  70                 break
  71               } }
  72               named_attr { if {"$val" != "false"} {
  73                 putmsg stderr 0 "\t Test FAIL: attr($al) returned unexpected."
  74                 set cont false
  75                 break
  76               } }
  77               default { # XX what other attr can we check here?
  78                 break
  79               }
  80             }
  81         }
  82         if {[string equal $cont "false"]} {
  83                 putmsg stderr 1 "\t res=($res)"
  84         }
  85   }
  86 # verify FH is not changed after successful Getattr op
  87   set fh1 [lindex [lindex $res 2] 2]
  88   set fh2 [lindex [lindex $res 4] 2]
  89   fh_equal $fh1 $fh2 $cont $PASS
  90 
  91 
  92 # --------------------------------------------------------------
  93 # disconnect and exit
  94 Disconnect
  95 exit $PASS