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 CREATE operation test - negative tests
  27 #       Test attributes with Create op.
  28 
  29 # include all test enironment
  30 source CREATE.env
  31 
  32 # connect to the test server
  33 Connect
  34 
  35 
  36 # setting local variables
  37 set TNAME $argv0
  38 set bfh [get_fh "$BASEDIRS"]
  39 
  40 
  41 # Start testing
  42 # --------------------------------------------------------------
  43 # a: Create a dir w/unsupported attr, expect ATTRNOTSUPP
  44 set expcode "ATTRNOTSUPP"
  45 set ASSERTION "Create a dir w/unsupported attr, expect $expcode"
  46 set tag $TNAME{a}
  47 putmsg stdout 0 "$tag: $ASSERTION"
  48 # Check 'hidden' is not in supported_attr
  49 set nsattr "hidden"
  50 set res [compound {Putfh $bfh; Getattr supported_attrs}]
  51 if {[lsearch -exact [lindex [lindex [lindex $res 1] 2] 1] $nsattr] >= 0} {
  52     putmsg stdout 0 "\t Test NOTINUSE: attr($nsattr) is in supported_attrs list"
  53 } else {
  54     set ndir "ndir_a.[pid]"
  55     set res [compound {Putfh $bfh;
  56         Create "$ndir" {{mode 0751} {$nsattr "false"}} d}]
  57     set cont [ckres "Create" $status $expcode $res $FAIL]
  58     if {! [string equal $cont "false"]} {
  59         # Verify ndir is not created
  60         set res [compound {Putfh $bfh; Lookup $ndir}]
  61         if {$status != "NOENT"} {
  62             putmsg stderr 0 "\t Test FAIL: ndir=($ndir) created unexpectedly"
  63             putmsg stderr 1 "\t   res=($res)"
  64             putmsg stderr 1 "  "
  65         } else {
  66            logres PASS
  67         }
  68     }
  69 }
  70 
  71 
  72 # b: Create a fifo file w/a readonly attr, expect INVAL
  73 set expcode "INVAL"
  74 set ASSERTION "Create a fifo file w/readoly attribute, expect $expcode"
  75 set tag $TNAME{b}
  76 putmsg stdout 0 "$tag: $ASSERTION"
  77 set nfifo "nfifo_b.[pid]"
  78 set res [compound {Putfh $bfh; Create $nfifo {{type "dir"}} f; Getfh}]
  79 set cont [ckres "Create" $status $expcode $res $FAIL]
  80 if {! [string equal $cont "false"]} {
  81     # Verify $ndir is not created
  82     set res [compound {Putfh $bfh; Lookup $ndir}]
  83     if { $status != "NOENT" } {
  84         putmsg stderr 0 "\t Test FAIL: fifo($nfifo) is created w/CREATE failed"
  85         putmsg stderr 1 "\t   res=($res)"
  86         putmsg stderr 1 "  "
  87     } else {
  88         logres PASS
  89     }
  90 }
  91 
  92 
  93 # --------------------------------------------------------------
  94 # disconnect and exit
  95 Disconnect
  96 exit $PASS