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_SPACE_AVAIL which should be small limit, expect OK
  29 # b: Test get attr FATTR4_SPACE_FREE which should be small limit, expect OK
  30 # c: Test get attr FATTR4_SPACE_TOTAL on the filesystem, expect OK
  31 # d: Test get attr FATTR4_SPACE_USED on the filesystem, expect OK
  32 #
  33 
  34 set TESTROOT $env(TESTROOT)
  35 set delm $env(DELM)
  36 
  37 # include common code and init section
  38 source ${TESTROOT}${delm}tcl.init
  39 source ${TESTROOT}${delm}testproc
  40 
  41 # connect to the test server
  42 Connect
  43 
  44 # setting local variables
  45 set TNAME $argv0
  46 set expcode "OK"
  47 # Get testfile pathname
  48 set bfh [get_fh "$BASEDIRS"]
  49 
  50 # Start testing
  51 # ---------------------------------------------------------------
  52 # a:Test get attr FATTR4_SPACE_AVAIL which should be small limit, expect OK
  53 
  54 set ASSERTION "Test get attr FATTR4_SPACE_AVAIL which should be small limit, expect OK"
  55 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  56 
  57 # Setup testfile for attribute purposes
  58 set attr {space_avail}
  59 
  60 #Get the filehandle of the test file 
  61 set res [compound {
  62         Putfh $bfh;
  63         Lookup $env(TEXTFILE);
  64         Getfh;
  65         Getattr $attr
  66 }]
  67 set fh [lindex [lindex $res 2] 2]
  68 prn_attrs [lindex [lindex $res 3] 2]
  69 set fh_attr [ extract_attr [lindex [lindex $res 3] 2] $attr ]
  70 ckres "Getattr" $status $expcode $res $PASS
  71 
  72 # ---------------------------------------------------------------
  73 # b:Test get attr FATTR4_SPACE_FREE which should be small limit, expect OK
  74 
  75 set ASSERTION "Test get attr FATTR4_SPACE_FREE which should be small limit, exp
  76 ect OK"
  77 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
  78 
  79 # Setup testfile for attribute purposes
  80 set attr {space_free}
  81 
  82 #Get the filehandle of the test file
  83 set res [compound {
  84         Putfh $bfh;
  85         Lookup $env(TEXTFILE);
  86         Getfh;
  87         Getattr $attr
  88 }]
  89 set fh [lindex [lindex $res 2] 2]
  90 prn_attrs [lindex [lindex $res 3] 2]
  91 set fh_attr [ extract_attr [lindex [lindex $res 3] 2] $attr ]
  92 ckres "Getattr" $status $expcode $res $PASS
  93 
  94 # ---------------------------------------------------------------
  95 # c:Test get attr FATTR4_SPACE_TOTAL on the filesystem, expect OK
  96 
  97 set ASSERTION "Test get attr FATTR4_SPACE_TOTAL on the filesystem, expect OK"
  98 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
  99 
 100 # Setup testfile for attribute purposes
 101 set attr {space_total}
 102 
 103 #Get the filehandle of the test file
 104 set res [compound {
 105         Putfh $bfh;
 106         Lookup $env(TEXTFILE);
 107         Getfh;
 108         Getattr $attr
 109 }]
 110 set fh [lindex [lindex $res 2] 2]
 111 prn_attrs [lindex [lindex $res 3] 2]
 112 set fh_attr [ extract_attr [lindex [lindex $res 3] 2] $attr ]
 113 ckres "Getattr" $status $expcode $res $PASS
 114 
 115 # ---------------------------------------------------------------
 116 # d:Test get attr FATTR4_SPACE_USED on the filesystem, expect OK
 117 
 118 set ASSERTION "Test get attr FATTR4_SPACE_USED on the filesystem, expect OK"
 119 putmsg stdout 0 "$TNAME{d}: $ASSERTION"
 120 
 121 # Setup testfile for attribute purposes
 122 set attr {space_used}
 123 
 124 #Get the filehandle of the test file
 125 set res [compound {
 126         Putfh $bfh;
 127         Lookup $env(TEXTFILE);
 128         Getfh;
 129         Getattr $attr
 130 }]
 131 set fh [lindex [lindex $res 2] 2]
 132 prn_attrs [lindex [lindex $res 3] 2]
 133 set fh_attr [ extract_attr [lindex [lindex $res 3] 2] $attr ]
 134 ckres "Getattr" $status $expcode $res $PASS
 135 
 136 Disconnect 
 137 exit $PASS