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 with creating DIR
  27 
  28 # include all test enironment
  29 source CREATE.env
  30 
  31 # connect to the test server
  32 Connect
  33 
  34 # setting local variables
  35 set TNAME $argv0
  36 set bfh [get_fh $BASEDIRS]
  37 
  38 # Start testing
  39 # --------------------------------------------------------------
  40 # a: create a new dir without FH, expect NOFILEHANDLE
  41 set expcode "NOFILEHANDLE"
  42 set ndir "noFH.[pid]"
  43 set ASSERTION "Create a new dir without FH, expect $expcode"
  44 set tag $TNAME{a}
  45 putmsg stdout 0 "$tag: $ASSERTION"
  46 set res [compound {Create $ndir {{mode 0711}} d; Getfh}]
  47 ckres "Create" $status $expcode $res $PASS
  48 
  49 
  50 # b: try to create a dir with CFH is not a dir, expect NOTDIR
  51 set expcode "NOTDIR"
  52 set tpath "$BASEDIRS $env(SYMLDIR)"
  53 set ASSERTION "Create a dir with CFH is notdir, expect $expcode"
  54 set tag $TNAME{b}
  55 putmsg stdout 0 "$tag: $ASSERTION"
  56 set res [compound {Putfh $bfh; Lookup $env(SYMLDIR);
  57         Create $ndir {{mode 0755}} d; Getfh }]
  58 ckres "Create" $status $expcode $res $PASS
  59 
  60 
  61 # c: try to create a dir with CFH/dir has mode=0000, expect ACCESS
  62 set expcode "ACCESS"
  63 set tpath "$BASEDIRS $env(DNOPERM)"
  64 set ASSERTION "Create a dir with CFH has 0 mode, expect $expcode"
  65 set tag $TNAME{c}
  66 putmsg stdout 0 "$tag: $ASSERTION"
  67 set res [compound {Putfh $bfh; Lookup $env(DNOPERM);
  68         Create $ndir {{mode 0755}} d; Getfh }]
  69 ckres "Create" $status $expcode $res $PASS
  70 
  71 
  72 # d: try to create a dir with objname="xx/xx", expect INVAL
  73 set expcode "INVAL"
  74 set DL $env(DELM)
  75 set ndir "XXX${DL}xxx"
  76 set ASSERTION "Create a dir with objname='xx${DL}xx', expect $expcode"
  77 set tag $TNAME{d}
  78 putmsg stdout 0 "$tag: $ASSERTION"
  79 set res [compound {Putfh $bfh; Create $ndir {{mode 0755}} d; Getfh }]
  80 ckres "Create" $status $expcode $res $PASS
  81 
  82 
  83 # e: try to create a dir with name is zero length, expect INVAL
  84 set expcode "INVAL"
  85 set ASSERTION "Create a dir with name is zero length, expect $expcode"
  86 set tag $TNAME{e}
  87 putmsg stdout 0 "$tag: $ASSERTION"
  88 set res [compound {Putfh $bfh; Create "" {{mode 0755}} d; Getfh }]
  89 ckres "Create" $status $expcode $res $PASS
  90 
  91 
  92 # f: create a new dir with name existed; expect EXIST
  93 set expcode "EXIST"
  94 set ndir $env(RWFILE)
  95 set ASSERTION "Create a new dir with name existed, expect $expcode"
  96 set tag $TNAME{f}
  97 putmsg stdout 0 "$tag: $ASSERTION"
  98 set res [compound {Putfh $bfh; Create $ndir {{mode 0755}} d; Getfh }]
  99 ckres "Create" $status $expcode $res $PASS
 100 
 101 
 102 # g: try to create a dir with objname='.', expect INVAL|OK
 103 set expcode "INVAL|OK"
 104 set ASSERTION "Create a dir with objname='.', expect $expcode"
 105 set tag $TNAME{g}
 106 putmsg stdout 0 "$tag: $ASSERTION"
 107 set res [compound {Putfh $bfh; Create {.} {{mode 0755}} d; Getfh }]
 108 ckres "Create" $status $expcode $res $PASS
 109 
 110 
 111 # h: try to create a dir with objname='..', expect INVAL|OK
 112 set expcode "INVAL|OK"
 113 set ASSERTION "Create a dir with objname='..', expect $expcode"
 114 set tag $TNAME{h}
 115 putmsg stdout 0 "$tag: $ASSERTION"
 116 set res [compound {Putfh $bfh; Create {..} {{mode 0755}} d; Getfh }]
 117 ckres "Create" $status $expcode $res $PASS
 118 
 119 
 120 # --------------------------------------------------------------
 121 # disconnect and exit
 122 Disconnect
 123 exit $PASS