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_012_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/xattr/xattr_012_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 2008 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 # xattr file sizes count towards normal disk usage
40 40 #
41 41 # STRATEGY:
42 42 # 1. Create a file, and check pool and filesystem usage
43 43 # 2. Create a 200mb xattr in that file
44 44 # 3. Check pool and filesystem usage, to ensure it reflects the size
45 45 # of the xattr
46 46 #
47 47
48 48 function cleanup {
49 - log_must $RM $TESTDIR/myfile.$$
49 + log_must rm $TESTDIR/myfile.$$
50 50 }
51 51
52 52 function get_pool_size {
53 53 poolname=$1
54 - psize=$($ZPOOL list -H -o allocated $poolname)
54 + psize=$(zpool list -H -o allocated $poolname)
55 55 if [[ $psize == *[mM] ]]
56 56 then
57 - returnvalue=$($ECHO $psize | $SED -e 's/m//g' -e 's/M//g')
57 + returnvalue=$(echo $psize | sed -e 's/m//g' -e 's/M//g')
58 58 returnvalue=$((returnvalue * 1024))
59 59 else
60 - returnvalue=$($ECHO $psize | $SED -e 's/k//g' -e 's/K//g')
60 + returnvalue=$(echo $psize | sed -e 's/k//g' -e 's/K//g')
61 61 fi
62 62 echo $returnvalue
63 63 }
64 64
65 65 log_assert "xattr file sizes count towards normal disk usage"
66 66 log_onexit cleanup
67 67
68 -log_must $TOUCH $TESTDIR/myfile.$$
68 +log_must touch $TESTDIR/myfile.$$
69 69
70 70 POOL_SIZE=0
71 71 NEW_POOL_SIZE=0
72 72
73 73 if is_global_zone
74 74 then
75 75 # get pool and filesystem sizes. Since we're starting with an empty
76 76 # pool, the usage should be small - a few k.
77 77 POOL_SIZE=$(get_pool_size $TESTPOOL)
78 78 fi
79 79
80 -FS_SIZE=$($ZFS get -p -H -o value used $TESTPOOL/$TESTFS)
80 +FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS)
81 81
82 -log_must $RUNAT $TESTDIR/myfile.$$ $MKFILE 200m xattr
82 +log_must runat $TESTDIR/myfile.$$ mkfile 200m xattr
83 83
84 84 #Make sure the newly created file is counted into zpool usage
85 -log_must $SYNC
85 +log_must sync
86 86
87 87 # now check to see if our pool disk usage has increased
88 88 if is_global_zone
89 89 then
90 90 NEW_POOL_SIZE=$(get_pool_size $TESTPOOL)
91 91 (($NEW_POOL_SIZE <= $POOL_SIZE)) && \
92 92 log_fail "The new pool size $NEW_POOL_SIZE was less \
93 93 than or equal to the old pool size $POOL_SIZE."
94 94
95 95 fi
96 96
97 97 # also make sure our filesystem usage has increased
98 -NEW_FS_SIZE=$($ZFS get -p -H -o value used $TESTPOOL/$TESTFS)
98 +NEW_FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS)
99 99 (($NEW_FS_SIZE <= $FS_SIZE)) && \
100 100 log_fail "The new filesystem size $NEW_FS_SIZE was less \
101 101 than or equal to the old filesystem size $FS_SIZE."
102 102
103 103 log_pass "xattr file sizes count towards normal disk usage"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX