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 # a: Test get attr FATTR4_FILEHANDLE of file object, expect OK  
  28 #
  29 
  30 set TESTROOT $env(TESTROOT)
  31 set delm $env(DELM)
  32 
  33 # include common code and init section
  34 source ${TESTROOT}${delm}tcl.init
  35 source ${TESTROOT}${delm}testproc
  36 
  37 # connect to the test server
  38 Connect
  39 
  40 # setting local variables
  41 set TNAME $argv0
  42 set expcode "OK"
  43 set cookie 0
  44 set bfh [get_fh "$BASEDIRS"]
  45 
  46 # Start testing
  47 # ---------------------------------------------------------------
  48 # a: Test get attr FATTR4_FILEHANDLE of file object, expect OK 
  49 
  50 set ASSERTION "Test get attr FATTR4_FILEHANDLE of file object, expect OK"
  51 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  52 
  53 # Setup attribute to be tested
  54 set attr {filehandle}
  55 
  56 #Get the filehandle of the path 
  57 set res [compound {
  58         Putfh $bfh
  59         Lookup $env(TEXTFILE)
  60         Getfh;
  61 }]
  62 ckres "Getfh" $status $expcode $res $FAIL
  63 set fh [lindex [lindex $res 2] 2]
  64 
  65 puts "fh is $fh"
  66 
  67 #Get the filehandle attribute
  68 set res [compound {
  69         Putfh $bfh
  70         Getfh;
  71         Lookup $env(TEXTFILE)
  72         Getattr $attr
  73 }]
  74 set cont [ckres "Getattr" $status $expcode $res $FAIL]
  75 
  76 puts "Attributes After Readdir and Getattr: "
  77 set fh_attr [ extract_attr [lindex [lindex $res 3] 2] "filehandle" ]
  78 
  79 if { ![string equal $cont "false"] } {
  80         if { ![string equal $fh $fh_attr ] } { 
  81                 putmsg stderr 0 "\t Test FAIL: filehandle is invalid"
  82         } else {
  83                 if { ![ string equal $fh_attr "" ] } {
  84                         prn_attrs [lindex [lindex $res 3] 2]
  85                         putmsg stdout 0 "\t Test PASS"
  86                 } else {
  87                         putmsg stderr 0 "\t Test FAIL: empty filehandle attr returned"
  88                 }
  89         }
  90 }
  91 
  92 Disconnect
  93 
  94 exit 0