Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
1 1 #!/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
|
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 # Use is subject to license terms.
24 24 #
25 25
26 26 #
27 -# Copyright (c) 2012 by Delphix. All rights reserved.
27 +# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
28 28 #
29 29
30 30 #
31 -# Copyright (c) 2013 by Delphix. All rights reserved.
31 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 32 #
33 33
34 34 . $STF_SUITE/include/libtest.shlib
35 35 . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
36 36
37 37 #
38 38 # DESCRIPTION:
39 39 #
40 40 # Basic applications work with xattrs: cpio cp find mv pax tar
41 41 #
42 42 # STRATEGY:
43 43 # 1. For each application
44 44 # 2. Create an xattr and archive/move/copy/find files with xattr support
45 45 # 3. Also check that when appropriate flag is not used, the xattr
46 46 # doesn't get copied
47 47 #
48 48
49 49 function cleanup {
50 50
51 - log_must $RM $TESTDIR/myfile.$$
51 + log_must rm $TESTDIR/myfile.$$
52 52 }
53 53
54 54 log_assert "Basic applications work with xattrs: cpio cp find mv pax tar"
55 55 log_onexit cleanup
56 56
57 57 # Create a file, and set an xattr on it. This file is used in several of the
58 58 # test scenarios below.
59 -log_must $TOUCH $TESTDIR/myfile.$$
59 +log_must touch $TESTDIR/myfile.$$
60 60 create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
61 61
62 62
63 63 # For the archive applications below (tar, cpio, pax)
64 64 # we create two archives, one with xattrs, one without
65 65 # and try various cpio options extracting the archives
66 66 # with and without xattr support, checking for correct behaviour
67 67
68 68
69 69 log_note "Checking cpio"
70 -log_must $TOUCH $TESTDIR/cpio.$$
70 +log_must touch $TESTDIR/cpio.$$
71 71 create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd
72 -$ECHO $TESTDIR/cpio.$$ | $CPIO -o@ > /tmp/xattr.$$.cpio
73 -$ECHO $TESTDIR/cpio.$$ | $CPIO -o > /tmp/noxattr.$$.cpio
72 +echo $TESTDIR/cpio.$$ | cpio -o@ > /tmp/xattr.$$.cpio
73 +echo $TESTDIR/cpio.$$ | cpio -o > /tmp/noxattr.$$.cpio
74 74
75 75 # we should have no xattr here
76 -log_must $CPIO -iu < /tmp/xattr.$$.cpio
77 -log_mustnot eval "$RUNAT $TESTDIR/cpio.$$ $CAT passwd > /dev/null 2>&1"
76 +log_must cpio -iu < /tmp/xattr.$$.cpio
77 +log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
78 78
79 79 # we should have an xattr here
80 -log_must $CPIO -iu@ < /tmp/xattr.$$.cpio
81 -log_must eval "$RUNAT $TESTDIR/cpio.$$ $CAT passwd > /dev/null 2>&1"
80 +log_must cpio -iu@ < /tmp/xattr.$$.cpio
81 +log_must eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
82 82
83 83 # we should have no xattr here
84 -log_must $CPIO -iu < /tmp/noxattr.$$.cpio
85 -log_mustnot eval "$RUNAT $TESTDIR/cpio.$$ $CAT passwd > /dev/null 2>&1"
84 +log_must cpio -iu < /tmp/noxattr.$$.cpio
85 +log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
86 86
87 87 # we should have no xattr here
88 -log_must $CPIO -iu@ < /tmp/noxattr.$$.cpio
89 -log_mustnot eval "$RUNAT $TESTDIR/cpio.$$ $CAT passwd > /dev/null 2>&1"
90 -log_must $RM $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio
88 +log_must cpio -iu@ < /tmp/noxattr.$$.cpio
89 +log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1"
90 +log_must rm $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio
91 91
92 92
93 93
94 94 log_note "Checking cp"
95 95 # check that with the right flag, the xattr is preserved
96 -log_must $CP -@ $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
96 +log_must cp -@ $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
97 97 compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd
98 -log_must $RM $TESTDIR/myfile2.$$
98 +log_must rm $TESTDIR/myfile2.$$
99 99
100 100 # without the right flag, there should be no xattr
101 -log_must $CP $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
102 -log_mustnot eval "$RUNAT $TESTDIR/myfile2.$$ $LS passwd > /dev/null 2>&1"
103 -log_must $RM $TESTDIR/myfile2.$$
101 +log_must cp $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$
102 +log_mustnot eval "runat $TESTDIR/myfile2.$$ ls passwd > /dev/null 2>&1"
103 +log_must rm $TESTDIR/myfile2.$$
104 104
105 105
106 106
107 107 log_note "Checking find"
108 108 # create a file without xattrs, and check that find -xattr only finds
109 109 # our test file that has an xattr.
110 -log_must $MKDIR $TESTDIR/noxattrs
111 -log_must $TOUCH $TESTDIR/noxattrs/no-xattr
110 +log_must mkdir $TESTDIR/noxattrs
111 +log_must touch $TESTDIR/noxattrs/no-xattr
112 112
113 -$FIND $TESTDIR -xattr | $GREP myfile.$$
113 +find $TESTDIR -xattr | grep myfile.$$
114 114 [[ $? -ne 0 ]] && \
115 115 log_fail "find -xattr didn't find our file that had an xattr."
116 -$FIND $TESTDIR -xattr | $GREP no-xattr
116 +find $TESTDIR -xattr | grep no-xattr
117 117 [[ $? -eq 0 ]] && \
118 118 log_fail "find -xattr found a file that didn't have an xattr."
119 -log_must $RM -rf $TESTDIR/noxattrs
119 +log_must rm -rf $TESTDIR/noxattrs
120 120
121 121
122 122
123 123 log_note "Checking mv"
124 124 # mv doesn't have any flags to preserve/ommit xattrs - they're
125 125 # always moved.
126 -log_must $TOUCH $TESTDIR/mvfile.$$
126 +log_must touch $TESTDIR/mvfile.$$
127 127 create_xattr $TESTDIR/mvfile.$$ passwd /etc/passwd
128 -log_must $MV $TESTDIR/mvfile.$$ $TESTDIR/mvfile2.$$
128 +log_must mv $TESTDIR/mvfile.$$ $TESTDIR/mvfile2.$$
129 129 verify_xattr $TESTDIR/mvfile2.$$ passwd /etc/passwd
130 -log_must $RM $TESTDIR/mvfile2.$$
130 +log_must rm $TESTDIR/mvfile2.$$
131 131
132 132
133 133 log_note "Checking pax"
134 -log_must $TOUCH $TESTDIR/pax.$$
134 +log_must touch $TESTDIR/pax.$$
135 135 create_xattr $TESTDIR/pax.$$ passwd /etc/passwd
136 -log_must $PAX -w -f $TESTDIR/noxattr.pax $TESTDIR/pax.$$
137 -log_must $PAX -w@ -f $TESTDIR/xattr.pax $TESTDIR/pax.$$
138 -log_must $RM $TESTDIR/pax.$$
136 +log_must pax -w -f $TESTDIR/noxattr.pax $TESTDIR/pax.$$
137 +log_must pax -w@ -f $TESTDIR/xattr.pax $TESTDIR/pax.$$
138 +log_must rm $TESTDIR/pax.$$
139 139
140 140 # we should have no xattr here
141 -log_must $PAX -r -f $TESTDIR/noxattr.pax
142 -log_mustnot eval "$RUNAT $TESTDIR/pax.$$ $CAT passwd > /dev/null 2>&1"
143 -log_must $RM $TESTDIR/pax.$$
141 +log_must pax -r -f $TESTDIR/noxattr.pax
142 +log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
143 +log_must rm $TESTDIR/pax.$$
144 144
145 145 # we should have no xattr here
146 -log_must $PAX -r@ -f $TESTDIR/noxattr.pax
147 -log_mustnot eval "$RUNAT $TESTDIR/pax.$$ $CAT passwd > /dev/null 2>&1"
148 -log_must $RM $TESTDIR/pax.$$
146 +log_must pax -r@ -f $TESTDIR/noxattr.pax
147 +log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
148 +log_must rm $TESTDIR/pax.$$
149 149
150 150
151 151 # we should have an xattr here
152 -log_must $PAX -r@ -f $TESTDIR/xattr.pax
152 +log_must pax -r@ -f $TESTDIR/xattr.pax
153 153 verify_xattr $TESTDIR/pax.$$ passwd /etc/passwd
154 -log_must $RM $TESTDIR/pax.$$
154 +log_must rm $TESTDIR/pax.$$
155 155
156 156 # we should have no xattr here
157 -log_must $PAX -r -f $TESTDIR/xattr.pax $TESTDIR
158 -log_mustnot eval "$RUNAT $TESTDIR/pax.$$ $CAT passwd > /dev/null 2>&1"
159 -log_must $RM $TESTDIR/pax.$$ $TESTDIR/noxattr.pax $TESTDIR/xattr.pax
157 +log_must pax -r -f $TESTDIR/xattr.pax $TESTDIR
158 +log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1"
159 +log_must rm $TESTDIR/pax.$$ $TESTDIR/noxattr.pax $TESTDIR/xattr.pax
160 160
161 161
162 162 log_note "Checking tar"
163 -log_must $TOUCH $TESTDIR/tar.$$
163 +log_must touch $TESTDIR/tar.$$
164 164 create_xattr $TESTDIR/tar.$$ passwd /etc/passwd
165 165
166 166 log_must cd $TESTDIR
167 167
168 -log_must $TAR cf noxattr.tar tar.$$
169 -log_must $TAR c@f xattr.tar tar.$$
170 -log_must $RM $TESTDIR/tar.$$
168 +log_must tar cf noxattr.tar tar.$$
169 +log_must tar c@f xattr.tar tar.$$
170 +log_must rm $TESTDIR/tar.$$
171 171
172 172 # we should have no xattr here
173 -log_must $TAR xf xattr.tar
174 -log_mustnot eval "$RUNAT $TESTDIR/tar.$$ $CAT passwd > /dev/null 2>&1"
175 -log_must $RM $TESTDIR/tar.$$
173 +log_must tar xf xattr.tar
174 +log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
175 +log_must rm $TESTDIR/tar.$$
176 176
177 177 # we should have an xattr here
178 -log_must $TAR x@f xattr.tar
178 +log_must tar x@f xattr.tar
179 179 verify_xattr tar.$$ passwd /etc/passwd
180 -log_must $RM $TESTDIR/tar.$$
180 +log_must rm $TESTDIR/tar.$$
181 181
182 182 # we should have no xattr here
183 -log_must $TAR xf $TESTDIR/noxattr.tar
184 -log_mustnot eval "$RUNAT $TESTDIR/tar.$$ $CAT passwd > /dev/null 2>&1"
185 -log_must $RM $TESTDIR/tar.$$
183 +log_must tar xf $TESTDIR/noxattr.tar
184 +log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
185 +log_must rm $TESTDIR/tar.$$
186 186
187 187 # we should have no xattr here
188 -log_must $TAR x@f $TESTDIR/noxattr.tar
189 -log_mustnot eval "$RUNAT $TESTDIR/tar.$$ $CAT passwd > /dev/null 2>&1"
190 -log_must $RM $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar
188 +log_must tar x@f $TESTDIR/noxattr.tar
189 +log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1"
190 +log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar
191 191
192 192
193 193 log_assert "Basic applications work with xattrs: cpio cp find mv pax tar"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX