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 2007 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # NFSv4 OPENATTR operation test - negative tests
  27 #       verify SERVER errors returned under error conditions
  28 
  29 # include all test enironment
  30 source OPENATTR.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 
  40 # Start testing
  41 # --------------------------------------------------------------
  42 # a: Try to openattr without <cfh> - expect NOFILEHANDLE
  43 set expcode "NOFILEHANDLE"
  44 set ASSERTION "Try to openattr without <cfh>, expect $expcode"
  45 set tag "$TNAME{a}"
  46 putmsg stdout 0 "$tag: $ASSERTION"
  47 set res [compound {Openattr T}]
  48 ckres "Openattr" $status $expcode $res $PASS
  49 
  50 
  51 # b: Openattr to create to a no permission dir - expect ACCESS
  52 set expcode "ACCESS"
  53 set ASSERTION "Openattr to create to a no permission dir, expect $expcode"
  54 set tag "$TNAME{b}"
  55 putmsg stdout 0 "$tag: $ASSERTION"
  56 set res [compound {Putfh $bfh; Lookup $env(DNOPERM); Openattr T}]
  57 ckres "Openattr" $status $expcode $res $PASS
  58 
  59 
  60 # c: Openattr to create (true) to a readonly file - expect ACCESS
  61 set expcode "ACCESS"
  62 set ASSERTION "Openattr to create(T) to a readonly file, expect $expcode"
  63 set tag "$TNAME{c}"
  64 putmsg stdout 0 "$tag: $ASSERTION"
  65 if { "$env(SRVOS)" == "Solaris" } {
  66     putmsg stdout 0 \
  67         "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
  68 } else {
  69     set res [compound {Putfh $bfh; Lookup $env(ROFILE); Openattr T}]
  70     ckres "Openattr" $status $expcode $res $PASS
  71 }
  72 
  73 
  74 # d: Openattr with <cfh> is a none-regular file - expect NOTSUPP
  75 set expcode "NOTSUPP"
  76 set ASSERTION "Openattr w/<cfh> is a none-regular file (blk), expect $expcode"
  77 set tag "$TNAME{d}"
  78 putmsg stdout 0 "$tag: $ASSERTION"
  79 set res [compound {Putfh $bfh; Lookup $env(BLKFILE); Openattr T}]
  80 ckres "Openattr" $status $expcode $res $PASS
  81 
  82 
  83 # e: Openattr none create with a FIFO file - expect NOTSUPP
  84 set expcode "NOTSUPP"
  85 set ASSERTION "Openattr none create with a FIFO file, expect $expcode"
  86 set tag "$TNAME{e}"
  87 putmsg stdout 0 "$tag: $ASSERTION"
  88 set res [compound {Putfh $bfh; Lookup $env(FIFOFILE); Openattr F}]
  89 ckres "Openattr" $status $expcode $res $PASS
  90 
  91 
  92 # k: Openattr none create with no named_attr dir setup - expect NOENT
  93 set expcode "NOENT"
  94 set ASSERTION "Openattr none create w/no named_attr dir setup, expect $expcode"
  95 set tag "$TNAME{k}"
  96 putmsg stdout 0 "$tag: $ASSERTION"
  97 if { "$env(SRVOS)" == "Solaris" } {
  98     putmsg stdout 0 \
  99         "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
 100 } else {
 101     set res [compound {Putfh $bfh; Lookup $env(DIR0777); 
 102         Lookup $env(RWFILE); Openattr F}]
 103     ckres "Openattr" $status $expcode $res $PASS
 104 }
 105 
 106 
 107 # --------------------------------------------------------------
 108 # disconnect and exit
 109 Disconnect
 110 exit $PASS