Mercurial > illumos > illumos-gate
comparison usr/src/test/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh @ 13899:0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
3312 Add a testrunner package for OS unit tests
3313 Add a testrunner package to convert ZFS tests from STF
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Henrik Mattson <henrik.mattson@delphix.com>
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
author | John Wren Kennedy <john.kennedy@delphix.com> |
---|---|
date | Wed, 05 Dec 2012 22:04:50 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13898:7f822b09519b | 13899:0bcf78798346 |
---|---|
1 #!/bin/ksh -p | |
2 # | |
3 # CDDL HEADER START | |
4 # | |
5 # The contents of this file are subject to the terms of the | |
6 # Common Development and Distribution License (the "License"). | |
7 # You may not use this file except in compliance with the License. | |
8 # | |
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
10 # or http://www.opensolaris.org/os/licensing. | |
11 # See the License for the specific language governing permissions | |
12 # and limitations under the License. | |
13 # | |
14 # When distributing Covered Code, include this CDDL HEADER in each | |
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
16 # If applicable, add the following below this CDDL HEADER, with the | |
17 # fields enclosed by brackets "[]" replaced with your own identifying | |
18 # information: Portions Copyright [yyyy] [name of copyright owner] | |
19 # | |
20 # CDDL HEADER END | |
21 # | |
22 | |
23 # | |
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. | |
25 # Use is subject to license terms. | |
26 # | |
27 | |
28 . $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib | |
29 | |
30 # | |
31 # DESCRIPTION: | |
32 # 'zfs snapshot -o' cannot set properties other than user property | |
33 # | |
34 # STRATEGY: | |
35 # 1. Create snapshot and give '-o property=value' with regular property. | |
36 # 2. Verify the snapshot creation failed. | |
37 # | |
38 | |
39 verify_runnable "both" | |
40 | |
41 function cleanup | |
42 { | |
43 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL/$TESTCTR $TESTPOOL ; do | |
44 typeset fssnap=$fs@snap | |
45 if datasetexists $fssnap ; then | |
46 log_must $ZFS destroy -rf $fssnap | |
47 fi | |
48 done | |
49 cleanup_user_prop $TESTPOOL | |
50 } | |
51 | |
52 function nonexist_user_prop | |
53 { | |
54 typeset user_prop=$1 | |
55 typeset dtst=$2 | |
56 | |
57 typeset source=$(get_source $user_prop $dtst) | |
58 typeset value=$(get_prop $user_prop $dtst) | |
59 if [[ $source == '-' && $value == '-' ]]; then | |
60 return 0 | |
61 else | |
62 return 1 | |
63 fi | |
64 } | |
65 | |
66 log_assert "'zfs snapshot -o' cannot set properties other than user property." | |
67 log_onexit cleanup | |
68 | |
69 typeset ro_props="type used available avail creation referenced refer compressratio \ | |
70 mounted origin" | |
71 typeset snap_ro_props="volsize recordsize recsize quota reservation reserv mountpoint \ | |
72 sharenfs checksum compression compress atime devices exec readonly rdonly \ | |
73 setuid zoned" | |
74 | |
75 $ZFS upgrade -v > /dev/null 2>&1 | |
76 if [[ $? -eq 0 ]]; then | |
77 snap_ro_props="$snap_ro_props version" | |
78 fi | |
79 | |
80 | |
81 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL/$TESTCTR $TESTPOOL ; do | |
82 typeset fssnap=$fs@snap | |
83 prop_name=$(valid_user_property 10) | |
84 value=$(user_property_value 16) | |
85 | |
86 log_must eval "$ZFS snapshot -o $prop_name='$value' $fssnap" | |
87 log_must snapexists $fssnap | |
88 log_mustnot nonexist_user_prop $prop_name $fssnap | |
89 | |
90 log_must $ZFS destroy -f $fssnap | |
91 | |
92 prop_name2=$(valid_user_property 10) | |
93 value2=$(user_property_value 16) | |
94 | |
95 log_must eval "$ZFS snapshot -o $prop_name='$value' -o $prop_name2='$value2' $fssnap" | |
96 log_must snapexists $fssnap | |
97 log_mustnot nonexist_user_prop $prop_name $fssnap | |
98 log_mustnot nonexist_user_prop $prop_name2 $fssnap | |
99 | |
100 log_must $ZFS destroy -f $fssnap | |
101 done | |
102 | |
103 cleanup | |
104 | |
105 prop_name=$(valid_user_property 10) | |
106 value=$(user_property_value 16) | |
107 | |
108 log_must eval "$ZFS snapshot -r -o $prop_name='$value' $TESTPOOL@snap" | |
109 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL/$TESTCTR $TESTPOOL ; do | |
110 typeset fssnap=$fs@snap | |
111 log_must snapexists $fssnap | |
112 log_mustnot nonexist_user_prop $prop_name $fssnap | |
113 done | |
114 | |
115 cleanup | |
116 | |
117 prop_name2=$(valid_user_property 10) | |
118 value2=$(user_property_value 16) | |
119 | |
120 log_must eval "$ZFS snapshot -r -o $prop_name='$value' -o $prop_name2='$value2' $TESTPOOL@snap" | |
121 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL/$TESTCTR $TESTPOOL ; do | |
122 typeset fssnap=$fs@snap | |
123 log_must snapexists $fssnap | |
124 log_mustnot nonexist_user_prop $prop_name $fssnap | |
125 log_mustnot nonexist_user_prop $prop_name2 $fssnap | |
126 done | |
127 | |
128 log_pass "'zfs snapshot -o' cannot set properties other than user property." |