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 - more of negative tests
  27 #       Test EXPIRED error
  28 
  29 # include all test enironment
  30 source OPEN.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 # Get server lease time
  39 set leasetm $LEASE_TIME
  40 
  41 # now set/confirm the clientid
  42 set cid [getclientid $TNAME.[pid]]
  43 if {$cid == -1} {
  44         putmsg stdout 0 "$TNAME: test setup - getclientid"
  45         putmsg stderr 0 "\t Test UNRESOLVED: unable to get clientid"
  46         exit $UNRESOLVED
  47 }
  48 set oseqid 1
  49 set oowner $TNAME-oowner
  50 
  51 # and wait for the least to expire
  52 after [expr ($leasetm + 12) * 1000]
  53 
  54 # Start testing
  55 # --------------------------------------------------------------
  56 # a: Open(non-CREATE) with lease time expired, expect EXPIRED|STALE_CLIENTID
  57 set expcode "EXPIRED|STALE_CLIENTID"
  58 set ASSERTION "Open(non-CREATE) w/lease time expired, expect $expcode"
  59 set tag "$TNAME{a}"
  60 putmsg stdout 0 "$tag: $ASSERTION"
  61 set res [compound {Putfh $bfh; Open $oseqid 1 0 "$cid $oowner-a" \
  62                     {0 0 {{mode 0666}}} {0 "$env(ROFILE)"}; Getfh}]
  63 ckres "Open" $status $expcode $res $PASS
  64 
  65 
  66 # b: Open(CREATE) with lease time expired, expect EXPIRED|STALE_CLIENTID
  67 set expcode "EXPIRED|STALE_CLIENTID"
  68 set ASSERTION "Open(CREATE) w/lease time expired, expect $expcode"
  69 set tag "$TNAME{b}"
  70 putmsg stdout 0 "$tag: $ASSERTION"
  71 set tf "$TNAME-b.[pid]"
  72 set res [compound {Putfh $bfh; Open $oseqid 3 0 "$cid $oowner-b" \
  73                     {1 0 {{mode 0666}}} {0 "$tf"}; Getfh}]
  74 if { [ckres "Open" $status $expcode $res $FAIL] == "true" } {
  75   # check the test file is not created
  76   set res [compound {Putfh $bfh; Lookup $tf}]
  77   ckres "Open" $status NOENT $res $PASS
  78 }
  79 
  80 
  81 # --------------------------------------------------------------
  82 # disconnect and exit
  83 Disconnect
  84 exit $PASS