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 OPEN operation test - negative tests
  27 #       Verify server returns correct errors with negative requests.
  28 #       (NOTE: currently all tests are UNTESTED due to not test'ble
  29 #               under current environments.)
  30 
  31 # include all test enironment
  32 source OPEN.env
  33 
  34 # connect to the test server
  35 Connect
  36 
  37 # setting local variables
  38 set TNAME $argv0
  39 set bfh [get_fh $BASEDIRS]
  40 set cid [getclientid $TNAME.[pid]]
  41 if {$cid == -1} {
  42         putmsg stdout 0 "$TNAME: test setup - getclientid"
  43         putmsg stderr 0 "\t Test UNRESOLVED: unable to get clientid"
  44         exit $UNRESOLVED
  45 }
  46 set seqid 1
  47 set owner "$TNAME-OpenOwner"
  48 
  49 
  50 # Start testing
  51 # --------------------------------------------------------------
  52 # a: try to Open while dir is removed, expect STALE
  53 set expcode "STALE"
  54 set ASSERTION "try to Open while dir is removed, expect $expcode"
  55 set tag "$TNAME{a}"
  56 #putmsg stdout 0 "$tag: $ASSERTION"
  57 #puts "\t Test UNTESTED: XXX Need different thread to remove <cfh> in server.\n"
  58 
  59 
  60 # m: try to Open of expired FH, expect FHEXPIRED
  61 set expcode "FHEXPIRED"
  62 set ASSERTION "Open an expired FH, expect $expcode"
  63 set tag "$TNAME{m}"
  64 #putmsg stdout 0 "$tag: $ASSERTION"
  65 #puts "\t Test UNTESTED: XXX need hook to get FH expired.\n"
  66 
  67 
  68 # s: Open with a Bad-FH, expect BADHANDLE
  69 set expcode "BADHANDLE"
  70 set ASSERTION "Open with a Bad-FH, expect $expcode"
  71 set tag "$TNAME{s}"
  72 #putmsg stdout 0 "$tag: $ASSERTION"
  73 #set res [compound {Putfh $bfh; Lookup __bad_fh; 
  74 #       Open $seqid 3 0 "$cid $owner-s" {0 0 {{mode 0644}}} {0 $env(ROFILE)}}]
  75 #ckres "Open" $status $expcode $res $PASS
  76 #puts "\t Test UNTESTED: XXX Need server hook to set Bad-FH for this test.\n"
  77 
  78 
  79 # x: Open with WrongSec, expect WRONGSEC
  80 set expcode "WRONGSEC"
  81 #set ASSERTION "Open with wrongSec, expect $expcode"
  82 #puts "\t Test UNTESTED: Need file with different favor to get WRONGSEC?\n"
  83 
  84 
  85 # y: XXX need a way to simulate these server errors:
  86 #       NFS4ERR_MOVED
  87 #       NFS4ERR_SERVERFAULT
  88 #       NFS4ERR_RESOURCE
  89 
  90 # --------------------------------------------------------------
  91 # disconnect and exit
  92 Disconnect
  93 exit $PASS