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 LOCK, LOCKT, LOCKU operation test - negative tests
  27 #       Verify server returns correct errors with negative requests.
  28 
  29 # include all test enironment
  30 source LOCKsid.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 set hid "[pid]-[expr int([expr [expr rand()] * 100000000])]"
  39 set cid [getclientid $hid]
  40 if {$cid == -1} {
  41         putmsg stdout 0 "$TNAME: test setup - getclientid"
  42         putmsg stderr 0 "\t Test UNRESOLVED: unable to get clientid"
  43         exit $UNRESOLVED
  44 }
  45 set seqid 1
  46 
  47 # Create a temp test file and get it's filehandle
  48 set TFILE "$TNAME.[pid]"
  49 set size 999
  50 set open_owner $TFILE
  51 set nfh [basic_open $bfh $TFILE 1 "$cid $open_owner" \
  52         osid oseqid status $seqid 0 666 $size]
  53 if {$nfh == -1} {
  54         putmsg stdout 0 "$TNAME: test setup - basic_open"
  55         putmsg stderr 0 "\t Test UNRESOLVED: failed to create tmp file=($TFILE)"
  56         putmsg stderr 0 "\t\t basic_open failed, status=($status)."
  57         exit $UNRESOLVED
  58 }
  59 set oseqid [expr $oseqid + 1]
  60 
  61 
  62 # Start testing
  63 # --------------------------------------------------------------
  64 # a: try Lock() request w/sub-range, expect NFS4ERR_LOCK_RANGE
  65 set expcode "NFS4ERR_LOCK_RANGE"
  66 set ASSERTION "try Lock() request w/sub-range, expect $expcode"
  67 set tag "$TNAME{a}"
  68 putmsg stdout 0 "$tag: $ASSERTION"
  69 puts "\t Test UNSUPPORTED: Invalid for Solaris."
  70 
  71 # b: try Lockt() request w/sub-range, expect NFS4ERR_LOCK_RANGE
  72 set expcode "NFS4ERR_LOCK_RANGE"
  73 set ASSERTION "try Lockt() request w/sub-range, expect $expcode"
  74 set tag "$TNAME{b}"
  75 putmsg stdout 0 "$tag: $ASSERTION"
  76 puts "\t Test UNSUPPORTED: Invalid for Solaris."
  77 
  78 # c: try Locku() request w/sub-range, expect NFS4ERR_LOCK_RANGE
  79 set expcode "NFS4ERR_LOCK_RANGE"
  80 set ASSERTION "try Locku() request w/sub-range, expect $expcode"
  81 set tag "$TNAME{c}"
  82 putmsg stdout 0 "$tag: $ASSERTION"
  83 puts "\t Test UNSUPPORTED: Invalid for Solaris."
  84 
  85   
  86 # --------------------------------------------------------------
  87 # Now cleanup, and removed created tmp file
  88 set res [compound {Putfh $bfh; Remove $TFILE}]
  89 if {($status != "OK") && ($status != "NOENT")} {
  90         putmsg stderr 0 "\t WARNING: cleanup to remove created tmp file failed"
  91         putmsg stderr 0 "\t          status=$status; please cleanup manually."
  92         putmsg stderr 1 "\t   res=($res)"
  93         putmsg stderr 1 "  "
  94         exit $WARNING
  95 }
  96 
  97 # --------------------------------------------------------------
  98 # disconnect and exit
  99 Disconnect
 100 exit $PASS