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 RENAME operation test - negative tests
  27 
  28 # include all test enironment
  29 source RENAME.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 
  39 # Start testing
  40 # --------------------------------------------------------------
  41 # a: Rename with newname not empty, expect NOTEMPTY|EXIST
  42 set expcode "NOTEMPTY|EXIST"
  43 set ASSERTION "Rename with newname not empty, expect $expcode"
  44 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  45 set res [compound {Putfh $bfh; Savefh; Rename $env(LARGEDIR) $env(DIR0755)}]
  46 set cont [ckres "Rename" $status $expcode $res $FAIL]
  47 # check oldname still exist
  48   if {! [string equal $cont "false"]} {
  49       set res [compound {Putfh $bfh; Lookup "$env(LARGEDIR)"}]
  50       if { $status == "NOENT" } {
  51           putmsg stderr 0 "\t Test FAIL: oldname is gone after Rename failed"
  52           putmsg stderr 1 "\t   res=($res)"
  53       } else {
  54           logres PASS
  55       }
  56   }
  57 
  58 
  59 # b: try to Rename when FS has no more quota, expect DQUOT
  60 set expcode "DQUOT"
  61 set ASSERTION "Rename while target has no more quota, expect $expcode"
  62 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
  63 putmsg stdout 0 \
  64         "\t Test UNSUPPORTED: Invalid for Solaris."
  65 putmsg stdout 1 "\t\t Solaris server does not require disk allocation."
  66 
  67 
  68 # c: try to Rename when FS has no more inode, expect NOSPC
  69 set expcode "NOSPC"
  70 set ASSERTION "Rename while target FS has no more inode, expect $expcode"
  71 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
  72 #set nsfh [get_fh [path2comp $env(NSPCDIR) $DELM]]
  73 #set res [compound {Putfh $nsfh; Savefh; Rename $env(RWFILE) "RendirC.[pid]" }]
  74 #set cont [ckres "Rename" $status $expcode $res $FAIL]
  75 ## check oldname still exist
  76 #  if {! [string equal $cont "false"]} {
  77 #      set res [compound {Putfh $bfh; Lookup "$env(RWFILE)"}]
  78 #      if { $status == "NOENT" } {
  79 #         putmsg stderr 0 "\t Test FAIL: oldname is gone after Rename failed"
  80 #         putmsg stderr 1 "\t   res=($res)"
  81 #      } else {
  82 #       logres PASS
  83 #      }
  84 #  }
  85 putmsg stdout 0 \
  86         "\t Test UNSUPPORTED: Invalid for Solaris."
  87 putmsg stdout 1 "\t\t Solaris server does not require disk allocation."
  88 
  89 
  90 # h: try to Rename when FS is READONLY, expect ROFS
  91 set expcode "ROFS"
  92 set ASSERTION "Rename while target FS is READONLY, expect $expcode"
  93 putmsg stdout 0 "$TNAME{h}: $ASSERTION"
  94 set rofh [get_fh [path2comp $env(ROFSDIR) $DELM]]
  95 set res [compound {Putfh $rofh; Savefh; Rename $env(DIR0755) "Newd"}]
  96 set cont [ckres "Rename" $status $expcode $res $FAIL]
  97 # check oldname still exist
  98   if {! [string equal $cont "false"]} {
  99       set res [compound {Putfh $rofh; Lookup "$env(DIR0755)"}]
 100       if { $status == "NOENT" } {
 101           putmsg stderr 0 "\t Test FAIL: oldname is gone after Rename failed"
 102           putmsg stderr 1 "\t   res=($res)"
 103       } else {
 104         logres PASS
 105       }
 106   }
 107 
 108 
 109 # --------------------------------------------------------------
 110 # disconnect and exit
 111 Disconnect
 112 exit $PASS