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 GETATTR operation test - negative tests
  27 #       verify SERVER errors returned with invalid Getattr.
  28 
  29 # include all test enironment
  30 source GETATTR.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 tmpS "$TNAME.[pid]"
  39 
  40 # list of testing objects
  41 set FO "$env(RWFILE) $env(DIR0777) $env(SYMLFILE) $env(CHARFILE) $env(FIFOFILE)"
  42 
  43 # Start testing
  44 # --------------------------------------------------------------
  45 # a: Getattr{time_access_set WO-attr}, expect INVAL
  46 set expcode "INVAL"
  47 set i 1
  48 set tattr "time_access_set"
  49 foreach testobj $FO {
  50     set tag "$TNAME{a$i}"
  51     set ASSERTION \
  52         "Getattr{$tattr WO-attr} of <$testobj>, expect $expcode"
  53     putmsg stdout 0 "$tag: $ASSERTION"
  54     putmsg stdout 1 "Putfh $bfh; Lookup $testobj; Getattr $tattr"
  55     set res [compound {Putfh $bfh; Lookup $testobj; Getattr $tattr}]
  56     ckres "Getattr" $status $expcode $res $PASS
  57 }
  58 
  59 # b: Getattr{time_modify_set WO-attr}, expect INVAL
  60 set expcode "INVAL"
  61 set i 1
  62 set tattr "time_modify_set"
  63 foreach testobj $FO {
  64     set tag "$TNAME{b$i}"
  65     set ASSERTION \
  66         "Getattr{$tattr WO-attr} of <$testobj>, expect $expcode"
  67     putmsg stdout 0 "$tag: $ASSERTION"
  68     putmsg stdout 1 "Putfh $bfh; Lookup $testobj; Getattr $tattr"
  69     set res [compound {Putfh $bfh; Lookup $testobj; Getattr $tattr}]
  70     ckres "Getattr" $status $expcode $res $PASS
  71 }
  72 
  73 # c: Getattr{time_modify_set WO-attr} on sock file, expect INVAL
  74 set expcode "INVAL"
  75 set tag "$TNAME{c}"
  76 set tattr "time_modify_set"
  77 set ASSERTION "Getattr{$tattr WO-attr} of sock file, expect $expcode"
  78 putmsg stdout 0 "$tag: $ASSERTION"
  79 set res [compound {Putfh $bfh; Create $tmpS {{mode 0644}} s; Getattr $tattr}]
  80 ckres "Getattr" $status $expcode $res $PASS
  81 
  82 # d: Getattr{time_access_set WO-attr} on ATTRDIR, expect INVAL
  83 set expcode "INVAL"
  84 set tag "$TNAME{d}"
  85 set tattr "time_access_set"
  86 set ASSERTION "Getattr{$tattr WO-attr} of ATTRDIR, expect $expcode"
  87 putmsg stdout 0 "$tag: $ASSERTION"
  88 set res [compound {Putfh $bfh; Lookup $env(ATTRFILE); Openattr F;
  89         Getattr type; Getattr $tattr}]
  90 ckres "Getattr" $status $expcode $res $PASS
  91 
  92 # e: Getattr{time_modify_set WO-attr} of NAMEDATTR, expect INVAL
  93 set expcode "INVAL"
  94 set tag "$TNAME{e}"
  95 set tattr "time_modify_set"
  96 set ASSERTION "Getattr{$tattr WO-attr} of NAMEDATTR, expect $expcode"
  97 putmsg stdout 0 "$tag: $ASSERTION"
  98 set res [compound {Putfh $bfh; Lookup $env(ATTRFILE); Openattr F;
  99         Lookup $env(ATTRFILE_AT1); Getattr type; Getattr $tattr}]
 100 ckres "Getattr" $status $expcode $res $PASS
 101 
 102 
 103 # --------------------------------------------------------------
 104 # cleanup remove the created file
 105 set res [compound {Putfh $bfh; Remove $tmpS}]
 106 if { "$status" != "OK" } {
 107         putmsg stderr 0 "\t WARNING: cleanup to remove created dir failed"
 108         putmsg stderr 0 "\t          status=$status; please cleanup manually."
 109         putmsg stderr 1 "\t   res=($res)"
 110         putmsg stderr 1 "  "
 111         exit $WARNING
 112 }
 113 # disconnect and exit
 114 
 115 Disconnect
 116 exit $PASS