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 SETATTR operation test - negative tests
  27 #       verify SERVER errors returned with invalid Setattr op.
  28 
  29 # include all test enironment
  30 source SETATTR.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: Setattr without Putrootfh, expect NOFILEHANDLE
  42 set expcode "NOFILEHANDLE"
  43 set ASSERTION "Setattr without Putrootfh, expect $expcode"
  44 set tag "$TNAME{a}"
  45 putmsg stdout 0 "$tag: $ASSERTION"
  46 set res [compound {Setattr {0 0} {{mode 0777}}}]
  47 ckres "Setattr" $status $expcode $res $PASS
  48 
  49 # c: Setattr ctime on an obj w/no permission, expect ACCESS
  50 set expcode "ACCESS"
  51 set ASSERTION "Setattr ctime on an obj w/no permission, expect $expcode"
  52 set tag "$TNAME{c}"
  53 putmsg stdout 0 "$tag: $ASSERTION"
  54 set res [compound {Putfh $bfh; Lookup $env(DNOPERM);
  55         Setattr {0 0} {{time_modify_set 0}}}]
  56 ckres "Setattr" $status $expcode $res $PASS
  57 
  58 # i: Setattr hidden on Solaris, expect ATTRNOTSUPP
  59 set expcode "ATTRNOTSUPP"
  60 set ASSERTION "Setattr hidden on Solaris, expect $expcode"
  61 set tag "$TNAME{i}"
  62 putmsg stdout 0 "$tag: $ASSERTION"
  63 if { "$env(SRVOS)" == "Solaris" } {
  64     set res [compound {Putfh $bfh; Lookup $env(RWFILE);
  65         Setattr {0 0} {{hidden false}}}]
  66     ckres "Setattr" $status $expcode $res $PASS
  67 } else {
  68         putmsg stdout 0 "\t Test UNTESTED: <hidden> attr may be  supported"
  69 }
  70 
  71 # j: Setattr system on Solaris, expect ATTRNOTSUPP
  72 set expcode "ATTRNOTSUPP"
  73 set ASSERTION "Setattr system on Solaris, expect $expcode"
  74 set tag "$TNAME{j}"
  75 putmsg stdout 0 "$tag: $ASSERTION"
  76 if { "$env(SRVOS)" == "Solaris" } {
  77     set res [compound {Putfh $bfh; Lookup $env(RWFILE);
  78         Setattr {0 0} {{system false}}}]
  79     ckres "Setattr" $status $expcode $res $PASS
  80 } else {
  81         putmsg stdout 0 "\t Test UNTESTED: <system> attr may be  supported"
  82 }
  83 
  84 
  85 # --------------------------------------------------------------
  86 # disconnect and exit
  87 Disconnect
  88 exit $PASS