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 VERIFY operation test - negative tests
  27 #       verify SERVER returned NFSERR_SAME in different cases
  28 
  29 # include all test enironment
  30 source VERIFY.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 req_attrs "type fh_expire_type change size link_support
  39     symlink_support named_attr fsid unique_handles lease_time"
  40 
  41 # Start testing
  42 # --------------------------------------------------------------
  43 # a: Verify of a file w/attr=dir, expect NOT_SAME
  44 set expcode "NOT_SAME"
  45 set ASSERTION "Verify of a file w/attr=dir, expect $expcode"
  46 set tag "$TNAME{a}"
  47 putmsg stdout 0 "$tag: $ASSERTION"
  48 set res [compound {Putfh $bfh; Lookup $env(RWFILE); Getfh;
  49         Verify {{type dir}}; Getfh}]
  50 ckres "Verify" $status $expcode $res $PASS
  51 
  52 
  53 # b: Verify a file with diff supported attrs, expect NOT_SAME
  54 set expcode "NOT_SAME"
  55 set ASSERTION "Verify a file with diff supported attrs, expect $expcode"
  56 set tag "$TNAME{b}"
  57 putmsg stdout 0 "$tag: $ASSERTION"
  58 set res [compound {Putfh $bfh; Lookup $env(ZIPFILE); Getattr "$req_attrs"}]
  59 set cont [ckres "Getattr" $status "OK" $res $FAIL]
  60 # Verify all attr returned from Getattr
  61   if {! [string equal $cont "false"]} {
  62         set attrl [lindex [lindex $res 2] 2]
  63         # Let's change the "size"
  64         set si [lsearch -regexp $attrl "size .*"]
  65         set nal [lreplace $attrl $si $si {size 0}]
  66         # do a verify on these attributes
  67         set res [compound {Putfh $bfh; Lookup $env(ZIPFILE); Getfh;
  68                 Verify {$nal}; Getfh}]
  69         ckres "Verify" $status $expcode $res $PASS
  70   }
  71 
  72 
  73 # c: Verify a symlink with diff other attrs, expect NOT_SAME
  74 set expcode "NOT_SAME"
  75 set ASSERTION "Verify a symlink with diff other attrs, expect $expcode"
  76 set tag "$TNAME{c}"
  77 putmsg stdout 0 "$tag: $ASSERTION"
  78 set ckl "type size cansettime chown_restricted fileid files_avail files_free
  79         files_total homogeneous maxfilesize maxlink maxname maxread maxwrite 
  80         mode no_trunc numlinks owner owner_group"
  81 set res [compound {Putfh $bfh; Lookup $env(SYMLDIR); Getattr "$ckl"}]
  82 set cont [ckres "Getattr" $status "OK" $res $FAIL]
  83 # Verify all attr returned from Getattr
  84   if {! [string equal $cont "false"]} {
  85         set attrl [lindex [lindex $res 2] 2]
  86         # Let's change the "size"
  87         set si [lsearch -regexp $attrl "size .*"]
  88         set nal [lreplace $attrl $si $si {size 0}]
  89         # do a verify on these attributes
  90         set res [compound {Putfh $bfh; Lookup $env(SYMLDIR); Getfh;
  91                 Verify {$nal}; Getfh}]
  92         ckres "Verify" $status $expcode $res $PASS
  93   }
  94 
  95 
  96 # --------------------------------------------------------------
  97 # disconnect and exit
  98 Disconnect
  99 exit $PASS