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_RAWDEV get major/minor info. of a NF4BLK file,
  29 #    expect OK
  30 # b: Test get attr FATTR4_RAWDEV get major/minor info. of a NF4CHR file,
  31 #    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 
  48 # Get testfile pathname
  49 set bfh [get_fh "$BASEDIRS"]
  50 
  51 # Start testing
  52 # ---------------------------------------------------------------
  53 # a: Test get attr FATTR4_RAWDEV of a NF4BLK file, expect OK
  54 
  55 set tag "$TNAME{a}"
  56 set ASSERTION "Test get attr FATTR4_RAWDEV of a NF4BLK file, expect OK"
  57 putmsg stdout 0 "$tag: $ASSERTION"
  58 
  59 # Setup attr for testing purposes
  60 set attr {rawdev}
  61 
  62 #Get the raw device attr of the NF4BLK special file
  63 #Raw device of this block file should be {77 188} which is defined in \
  64 #    v4test.cfg and implemented in mk_srvdir.ksh file
  65 set res [compound {
  66         Putfh $bfh;
  67         Lookup $env(BLKFILE);
  68         Getattr $attr
  69 }]
  70 set cont [ckres "Getattr" $status $expcode $res $FAIL]
  71 
  72 if { $cont == "true" } {
  73 
  74         set attrval [ extract_attr [lindex [lindex $res 2] 2] $attr ]
  75 
  76         if { $attrval == "77 188" } {
  77                 putmsg stdout 0 "\t Test PASS"
  78         } else {
  79                 putmsg stderr 0 "\t Test FAIL: unexpected {$attrval} raw device\
  80                         returned for this block file, it should be {77 188}\
  81                         which is defined in v4test.cfg and implemented in\
  82                         mk_srvdir.ksh file"
  83                 putmsg stderr 1 "\t    res=($res)."
  84         }
  85 }
  86 
  87 # ---------------------------------------------------------------
  88 # b: Test get attr FATTR4_RAWDEV of a NF4CHR file, expect OK
  89 
  90 set tag "$TNAME{b}"
  91 set ASSERTION "Test get attr FATTR4_RAWDEV of a NF4CHR file, expect OK"
  92 putmsg stdout 0 "$tag: $ASSERTION"
  93 
  94 # Setup attr for testing purposes
  95 set attr {rawdev}
  96 
  97 #Get the raw device attr of the NF4CHR special file
  98 #Raw device of this character file should be {88 177} which is defined in \
  99 #    v4test.cfg and implemented in mk_srvdir.ksh file
 100 set res [compound {
 101         Putfh $bfh;
 102         Lookup $env(CHARFILE);
 103         Getattr $attr
 104 }]
 105 set cont [ckres "Getattr" $status $expcode $res $FAIL]
 106 
 107 if { $cont == "true" } {
 108 
 109         set attrval [ extract_attr [lindex [lindex $res 2] 2] $attr ]
 110 
 111         if { $attrval == "88 177" } {
 112                 putmsg stdout 0 "\t Test PASS"
 113         } else {
 114                 putmsg stderr 0 "\t Test FAIL: unexpected {$attrval} raw device\
 115                         returned for this character file, it should be {88 177}\
 116                         which is defined in v4test.cfg and implemented in\
 117                         mk_srvdir.ksh file"
 118                 putmsg stderr 1 "\t    res=($res)."
 119         }
 120 }
 121 
 122 Disconnect
 123 exit $PASS