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 with OPEN_RECLAIM option
  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 
  39 # set/confirm the clientid
  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 oseqid 1
  47 set oowner "$TNAME-[pid]"
  48 
  49 # Start testing
  50 # --------------------------------------------------------------
  51 # a: Open(reclaim) with <cfh> is from just opened file, expect NO_GRACE
  52 set expcode "NO_GRACE"
  53 set ASSERTION "Open(reclaim) w/<cfh> is from just opened file, expect $expcode"
  54 set tag "$TNAME{a}"
  55 putmsg stdout 0 "$tag: $ASSERTION"
  56 set fh1 [basic_open $bfh $env(RWFILE) 0 "$cid $oowner-001" osid oseqid status]
  57 if {$fh1 == -1} {
  58         putmsg stderr 0 \
  59                 "\t Test UNRESOLVED: basic_open failed, status=($status)"
  60 } else {
  61         set res [compound {Putfh $fh1; Open $oseqid 3 0 "$cid $oowner-002" \
  62                     {0 0 {{mode 0666}}} {1 0}; Getfh}]
  63         ckres "Open" $status $expcode $res $PASS
  64 }
  65 
  66 
  67 # e: Open(reclaim) with <cfh> is a dir, expect ISDIR|NO_GRACE
  68 set expcode "ISDIR|NO_GRACE"
  69 set ASSERTION "Open(reclaim) w/<cfh> is dir, expect $expcode"
  70 set tag "$TNAME{e}"
  71 putmsg stdout 0 "$tag: $ASSERTION"
  72 set res [compound {Putfh $bfh; Open $oseqid 3 0 "$cid $oowner-010" \
  73                     {0 0 {{mode 0666}}} {1 0}; Getfh}]
  74 putmsg stderr 1 "\tRes=($res)"
  75 ckres "Open" $status $expcode $res $PASS
  76 
  77 
  78 # h: Open(reclaim) w/<cfh> not from open , expect NO_GRACE
  79 set expcode "NO_GRACE"
  80 set ASSERTION "Open(reclaim) w/<cfh> not from open, expect $expcode"
  81 set tag "$TNAME{h}"
  82 putmsg stdout 0 "$tag: $ASSERTION"
  83 set res [compound {Putfh $bfh; Lookup $env(ROFILE);
  84             Open 10 1 0 "$cid $oowner-100" {0 0 {{mode 0666}}} {1 0}; Getfh}]
  85 ckres "Open" $status $expcode $res $PASS
  86 
  87 
  88 # j: Open(reclaim) with named_attr file, expect NO_GRACE
  89 set expcode "NO_GRACE"
  90 set ASSERTION "Open(reclaim) named_attr file, expect $expcode"
  91 set tag "$TNAME{j}"
  92 putmsg stdout 0 "$tag: $ASSERTION"
  93 set res [compound {Putfh $bfh; Lookup $env(ATTRDIR); 
  94             Openattr f; Lookup $env(ATTRDIR_AT1); Getattr type;
  95             Open 10 1 0 "$cid $oowner-105" {0 0 {{mode 0666}}} {1 0}; Getfh}]
  96 ckres "Open" $status $expcode $res $PASS
  97 
  98 
  99 # --------------------------------------------------------------
 100 # disconnect and exit
 101 Disconnect
 102 exit $PASS