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/inheritance/inherit.kshlib
+++ new/usr/src/test/zfs-tests/tests/functional/inheritance/inherit.kshlib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 26
27 27 #
28 -# Copyright (c) 2013 by Delphix. All rights reserved.
28 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
29 29 #
30 30
31 31 #
32 32 # Simple function to get the source of the specified property.
33 33 # If unable to get the property then exits.
34 34 #
35 35 function get_prop_src # property dataset
36 36 {
37 37 typeset prop_val
38 38 typeset prop=$1
39 39 typeset dataset=$2
40 40
41 - prop_val=`$ZFS get -H -o source $prop $dataset`
41 + prop_val=`zfs get -H -o source $prop $dataset`
42 42
43 43 if [[ $? -ne 0 ]]; then
44 44 log_fail "Unable to determine the source of $prop " \
45 45 "property for dataset $dataset"
46 46 else
47 47 echo $prop_val
48 48 fi
49 49 }
50 50
51 51 #
52 52 # Function to check the 'source' of a property. The source can
53 53 # either be "default", "local", or "inherited from <parent dataset>".
54 54 #
55 55 # The 'expected src' argument must be either "default", "local", or
56 56 # a dataset name.
57 57 #
58 58 # Returns 0 on success, 1 on failure.
59 59 #
60 60 function verify_prop_src # child_dataset property expected_src
61 61 {
62 62 typeset target=$1
63 63 typeset prop=$2
64 64 typeset expected=$3
65 65
66 66 prop_src=`get_prop_src $prop $target`
67 67
68 68 #
69 69 # Rather than just checking if $prop_src == $expected
70 70 # we first determine what value $expected should have.
71 71 # This allows us to catch the case where a property
72 72 # has a source of "local" but we expected it to be
73 73 # "default"
74 74 #
75 75 if [[ $expected == "default" ]]; then
76 76 if [[ $prop_src != $expected ]]; then
77 77 log_note "Property $prop of $target has source"\
78 78 " $prop_src rather than $expected"
79 79 return 1
80 80 fi
81 81 elif [[ $expected == "local" ]]; then
82 82 if [[ $prop_src != $expected ]]; then
83 83 log_note "Property $prop of $target has source"\
84 84 " $prop_src rather than $expected"
85 85 return 1
86 86 fi
87 87 elif [[ $prop_src != "inherited from $expected" ]]; then
88 88 log_note "Property $prop of $expected has source $prop_src"\
89 89 " rather than 'inherited from $expected'"
90 90 return 1
91 91 fi
92 92
93 93 return 0
94 94 }
95 95
96 96 #
|
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
97 97 # Simple function to set a property to a
98 98 # specified value and verify it has changed
99 99 # correctly.
100 100 #
101 101 function set_n_verify_prop #property value dataset
102 102 {
103 103 typeset prop=$1
104 104 typeset prop_val=$2
105 105 typeset dataset=$3
106 106
107 - $ZFS set $prop=$prop_val $dataset
107 + zfs set $prop=$prop_val $dataset
108 108 check_val=`get_prop $prop $dataset`
109 109
110 110 if [[ $check_val != $prop_val ]]; then
111 111 log_fail "Property $prop of $dataset has value $check_val"\
112 112 " rather than $prop_val"
113 113 fi
114 114 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX