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 named attributes:
27 #
28 # a: Test create attribute data in attrdir, expect OK
29 #
30
31 set TESTROOT $env(TESTROOT)
32 set delm $env(DELM)
33
34 # include common code and init section
35 source [file join ${TESTROOT} tcl.init]
36 source [file join ${TESTROOT} testproc]
37
38 source WRITE_proc
39
40 # connect to the test server
41 Connect
42
43 # setting local variables
44 set TNAME $argv0
45 set tag $TNAME{setup}
46 set bfh [get_fh "$BASEDIRS"]
47 set expcode "OK"
48
49 # Start testing
50 # ----------------------------------------------------------
51 # a: Test create attribute data in attrdir, expect OK
52
53 set ASSERTION "Test create attribute data in attrdir, expect OK"
54 set tag $TNAME{a}
55 putmsg stdout 0 "$tag: $ASSERTION"
56
57 # Create a new file for testing purposes
58 set filename "newfile.[pid]"
59 set tfile "[creatv4_file "$BASEDIR${delm}$filename" 777]"
60 set res [compound {Putfh $bfh; Lookup $filename; Getfh}]
61 set cont [ckres "Lookup" $status $expcode $res $FAIL]
62
63 if {[string equal $cont "true"] == 1} {
64 # Create the named attr of newfile
65 set createdir "T"
66 set res2 [compound {Putfh $bfh; Lookup $filename; \
67 Openattr $createdir; Getfh }]
68 set nfh [lindex [lindex $res2 3] 2]
69 set cont [ckres "Openattr" $status $expcode $res2 $FAIL]
70
71 if {[string equal $cont "true"] == 1} {
72 set count 8192
73 ckwrite $nfh "attrfile" 0 $count $expcode $count $PASS
74 }
75 }
76
77 # --------------------------------------------------------------
78 # Cleanup the temp file:
79 set tag $TNAME{cleanup}
80 set res [compound {Putfh $bfh; Remove $filename}]
81 if { "$status" != "OK" } {
82 putmsg stderr 0 "\t WARNING: cleanup to remove $filename failed"
83 putmsg stderr 0 "\t status=$status; please cleanup manually."
84 putmsg stderr 1 "\t res=($res)"
85 putmsg stderr 1 " "
86 exit $WARNING
87 }
88
89 Disconnect
90 exit 0