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 - positive tests
  27 
  28 # include all test enironment
  29 source OPEN.env
  30 source OPEN_proc
  31 
  32 # TESTROOT directory; must be set in the environment already
  33 set TESTROOT $env(TESTROOT)
  34 
  35 # ROOTDIR directory; must be set in the environment already
  36 set ROOTDIR $env(ROOTDIR)
  37 
  38 source [file join ${TESTROOT} lcltools]
  39 
  40 # setting local variables
  41 set TNAME $argv0
  42 
  43 if {[info exists env(DNS_SERVER)] == 1} {
  44         set domain [get_domain $env(SERVER) $env(DNS_SERVER)]
  45 } else {
  46         set domain [get_domain $env(SERVER)]
  47 }
  48 if {$domain == $NULL} {
  49         putmsg stderr 0 "$TNAME{all}:"
  50         putmsg stderr 0 "\tTest UNINITIATED: unable to determine the domain."
  51         putmsg stderr 0 "\tAssertions won't be executed."
  52         exit $UNINITIATED
  53 }
  54 
  55 # connect to the test server
  56 Connect
  57 
  58 set tag $TNAME.setup
  59 set ROOTDIRS [path2comp $ROOTDIR $::DELM]
  60 set fh [get_fh $ROOTDIRS]
  61 
  62 set clientid [getclientid $TNAME.[pid]]
  63 if {$clientid == -1} {
  64         putmsg stdout 0 "$TNAME: test setup - getclientid"
  65         putmsg stderr 0 "\t Test UNRESOLVED: unable to get clientid"
  66         exit $UNRESOLVED
  67 }
  68 
  69 
  70 # Start testing
  71 # --------------------------------------------------------------
  72 
  73 
  74 # a: known mapable user id
  75 set tag $TNAME{a}
  76 set expct "OK"
  77 set ASSERTION "known mapable user id, expect $expct"
  78 putmsg stdout 0 "$tag: $ASSERTION"
  79 set filename $tag
  80 set TESTFILE [file join $ROOTDIR "$filename"]
  81 set owner 5
  82 set group ""
  83 set st [uid_open $fh $filename $clientid owner group res "root@$domain" ""]
  84 ckres "Open" $st $expct $res $PASS
  85 
  86 
  87 # b: known mapable group id
  88 set tag $TNAME{b}
  89 set expct "OK"
  90 set ASSERTION "known mapable group id, expect $expct"
  91 putmsg stdout 0 "$tag: $ASSERTION"
  92 set filename $tag
  93 set TESTFILE [file join $ROOTDIR "$filename"]
  94 set owner ""
  95 set group 5
  96 set st [uid_open $fh $filename $clientid owner group res "" "uucp@$domain"]
  97 ckres "Open" $st $expct $res $PASS
  98 
  99 
 100 # c: owner id 0
 101 set tag $TNAME{c}
 102 set expct "OK"
 103 set ASSERTION "owner id 0, expect $expct"
 104 putmsg stdout 0 "$tag: $ASSERTION"
 105 set filename $tag
 106 set TESTFILE [file join $ROOTDIR "$filename"]
 107 set owner 0
 108 set group ""
 109 set st [uid_open $fh $filename $clientid owner group res "root@$domain" ""]
 110 ckres "Open" $st $expct $res $PASS
 111 
 112 
 113 # d: group id 0
 114 set tag $TNAME{d}
 115 set expct "OK"
 116 set ASSERTION "group id 0, expect $expct"
 117 putmsg stdout 0 "$tag: $ASSERTION"
 118 set filename $tag
 119 set TESTFILE [file join $ROOTDIR "$filename"]
 120 set owner ""
 121 set group 0
 122 set st [uid_open $fh $filename $clientid owner group res "" "root@$domain"]
 123 ckres "Open" $st $expct $res $PASS
 124 
 125 
 126 # e: user id known only to server
 127 set tag $TNAME{e}
 128 set expct "OK"
 129 set ASSERTION "user id known only to server, expect $expct"
 130 putmsg stdout 0 "$tag: $ASSERTION"
 131 set filename $tag
 132 set TESTFILE [file join $ROOTDIR "$filename"]
 133 set owner "$::env(TUSERSID)"
 134 set group ""
 135 set st [uid_open $fh $filename $clientid owner group res "root@$domain" ""]
 136 ckres "Open" $st $expct $res $PASS
 137 
 138 
 139 # --------------------------------------------------------------
 140 # disconnect and exit
 141 
 142 Disconnect
 143 exit $PASS