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_013_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/xattr/xattr_013_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) 2013 by Delphix. All rights reserved.
27 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
28 28 #
29 29
30 30 . $STF_SUITE/include/libtest.shlib
31 31 . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
32 32
33 33 #
34 34 # DESCRIPTION:
35 35 # The noxattr mount option functions as expected
36 36 #
37 37 # STRATEGY:
38 38 # 1. Create a file on a filesystem and add an xattr to it
39 39 # 2. Unmount the filesystem, and mount it -o noxattr
40 40 # 3. Verify that the xattr cannot be read and new files
41 41 # cannot have xattrs set on them.
42 42 # 4. Unmount and mount the filesystem normally
43 43 # 5. Verify that xattrs can be set and accessed again
44 44 #
45 45
46 46 function cleanup {
47 47
48 - log_must $RM $TESTDIR/myfile.$$
48 + log_must rm $TESTDIR/myfile.$$
49 49 }
50 50
51 51
52 52 log_assert "The noxattr mount option functions as expected"
53 53 log_onexit cleanup
54 54
55 -$ZFS set 2>&1 | $GREP xattr > /dev/null
55 +zfs set 2>&1 | grep xattr > /dev/null
56 56 if [ $? -ne 0 ]
57 57 then
58 58 log_unsupported "noxattr mount option not supported on this release."
59 59 fi
60 60
61 -log_must $TOUCH $TESTDIR/myfile.$$
61 +log_must touch $TESTDIR/myfile.$$
62 62 create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
63 63
64 -log_must $UMOUNT $TESTDIR
65 -log_must $ZFS mount -o noxattr $TESTPOOL/$TESTFS
64 +log_must umount $TESTDIR
65 +log_must zfs mount -o noxattr $TESTPOOL/$TESTFS
66 66
67 67 # check that we can't perform xattr operations
68 -log_mustnot eval "$RUNAT $TESTDIR/myfile.$$ $CAT passwd > /dev/null 2>&1"
69 -log_mustnot eval "$RUNAT $TESTDIR/myfile.$$ $RM passwd > /dev/null 2>&1"
70 -log_mustnot eval "$RUNAT $TESTDIR/myfile.$$ $CP /etc/passwd . > /dev/null 2>&1"
68 +log_mustnot eval "runat $TESTDIR/myfile.$$ cat passwd > /dev/null 2>&1"
69 +log_mustnot eval "runat $TESTDIR/myfile.$$ rm passwd > /dev/null 2>&1"
70 +log_mustnot eval "runat $TESTDIR/myfile.$$ cp /etc/passwd . > /dev/null 2>&1"
71 71
72 -log_must $TOUCH $TESTDIR/new.$$
73 -log_mustnot eval "$RUNAT $TESTDIR/new.$$ $CP /etc/passwd . > /dev/null 2>&1"
74 -log_mustnot eval "$RUNAT $TESTDIR/new.$$ $RM passwd > /dev/null 2>&1"
72 +log_must touch $TESTDIR/new.$$
73 +log_mustnot eval "runat $TESTDIR/new.$$ cp /etc/passwd . > /dev/null 2>&1"
74 +log_mustnot eval "runat $TESTDIR/new.$$ rm passwd > /dev/null 2>&1"
75 75
76 76 # now mount the filesystem again as normal
77 -log_must $UMOUNT $TESTDIR
78 -log_must $ZFS mount $TESTPOOL/$TESTFS
77 +log_must umount $TESTDIR
78 +log_must zfs mount $TESTPOOL/$TESTFS
79 79
80 80 # we should still have an xattr on the first file
81 81 verify_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
82 82
83 83 # there should be no xattr on the file we created while the fs was mounted
84 84 # -o noxattr
85 -log_mustnot eval "$RUNAT $TESTDIR/new.$$ $CAT passwd > /dev/null 2>&1"
85 +log_mustnot eval "runat $TESTDIR/new.$$ cat passwd > /dev/null 2>&1"
86 86 create_xattr $TESTDIR/new.$$ passwd /etc/passwd
87 87
88 88 log_pass "The noxattr mount option functions as expected"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX