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/snapshot/snapshot_010_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_010_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
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27
28 28 #
29 -# Copyright (c) 2013 by Delphix. All rights reserved.
29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 30 #
31 31
32 32 . $STF_SUITE/include/libtest.shlib
33 33 . $STF_SUITE/tests/functional/snapshot/snapshot.cfg
34 34
35 35 #
36 36 # DESCRIPTION:
37 37 # Verify 'destroy -r' can correctly destroy a snapshot tree at any point.
38 38 #
39 39 # STRATEGY:
40 40 # 1. Use the snapshot -r to create snapshot for top level pool
41 41 # 2. Select a middle point of the snapshot tree, use destroy -r to destroy all
42 42 # snapshots beneath the point.
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
43 43 # 3. Verify the destroy results.
44 44 #
45 45
46 46 verify_runnable "both"
47 47
48 48 function cleanup
49 49 {
50 50 typeset snap
51 51
52 52 datasetexists $ctrvol && \
53 - log_must $ZFS destroy -f $ctrvol
53 + log_must zfs destroy -f $ctrvol
54 54
55 55 for snap in $ctrfs@$TESTSNAP1 \
56 56 $snappool $snapvol $snapctr $snapctrvol \
57 57 $snapctrclone $snapctrfs
58 58 do
59 59 snapexists $snap && \
60 - log_must $ZFS destroy -rf $snap
60 + log_must zfs destroy -rf $snap
61 61 done
62 62
63 63 }
64 64
65 65 log_assert "Verify 'destroy -r' can correctly destroy a snapshot subtree at any point."
66 66 log_onexit cleanup
67 67
68 68 ctr=$TESTPOOL/$TESTCTR
69 69 ctrfs=$ctr/$TESTFS1
70 70 ctrvol=$ctr/$TESTVOL1
71 71 snappool=$SNAPPOOL
72 72 snapfs=$SNAPFS
73 73 snapctr=$ctr@$TESTSNAP
74 74 snapvol=$SNAPFS1
75 75 snapctrvol=$ctr/$TESTVOL1@$TESTSNAP
76 76 snapctrclone=$ctr/$TESTCLONE@$TESTSNAP
77 77 snapctrfs=$SNAPCTR
78 78
79 79 #preparation for testing
80 -log_must $ZFS snapshot $ctrfs@$TESTSNAP1
80 +log_must zfs snapshot $ctrfs@$TESTSNAP1
81 81 if is_global_zone; then
82 - log_must $ZFS create -V $VOLSIZE $ctrvol
82 + log_must zfs create -V $VOLSIZE $ctrvol
83 83 else
84 - log_must $ZFS create $ctrvol
84 + log_must zfs create $ctrvol
85 85 fi
86 86
87 -log_must $ZFS snapshot -r $snappool
87 +log_must zfs snapshot -r $snappool
88 88
89 89 #select the $TESTCTR as destroy point, $TESTCTR is a child of $TESTPOOL
90 -log_must $ZFS destroy -r $snapctr
90 +log_must zfs destroy -r $snapctr
91 91 for snap in $snapctr $snapctrvol $snapctrclone $snapctrfs; do
92 92 snapexists $snap && \
93 93 log_fail "The snapshot $snap is not destroyed correctly."
94 94 done
95 95
96 96 for snap in $snappool $snapfs $snapvol $ctrfs@$TESTSNAP1;do
97 97 ! snapexists $snap && \
98 98 log_fail "The snapshot $snap should be not destroyed."
99 99 done
100 100
101 101 log_pass "'destroy -r' destroys snapshot subtree as expected."
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX