]> git.proxmox.com Git - mirror_zfs.git/blame - tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh
Fix spelling
[mirror_zfs.git] / tests / zfs-tests / tests / functional / cli_root / zfs_destroy / zfs_destroy_010_pos.ksh
CommitLineData
6bb24f4d
BB
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 (c) 2012 by Delphix. All rights reserved.
25#
26
27. $STF_SUITE/include/libtest.shlib
28. $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy.cfg
29. $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib
30
31################################################################################
32#
4e33ba4c 33# When using 'zfs destroy -R' on a file system hierarchy that includes a
6bb24f4d
BB
34# snapshot and a clone of that snapshot, and the snapshot has been
35# defer-destroyed, make sure that the 'zfs destroy -R' works as expected.
36# In particular make sure that libzfs is not confused by the fact that the
37# kernel will automatically remove the defer-destroyed snapshot when the
38# clone is destroyed.
39#
40# 1. Create test environment.
41# 2. Create a clone of the snapshot.
42# 3. 'zfs destroy -d <snap>'
43# 4. 'zfs destroy -R'
44# 5. Verify that the snapshot and clone are destroyed.
45#
46################################################################################
47
3ec68a44 48function test_clone_run
49{
50 typeset dstype=$1
6bb24f4d 51
6bb24f4d
BB
52 ds=$(eval echo \$${dstype})
53 snap=$(eval echo \$${dstype}SNAP)
54 clone=$(eval echo \$${dstype}CLONE)
55 log_must $ZFS destroy -d $snap
56 log_must datasetexists $snap
3ec68a44 57 log_must $ZFS destroy -R $clone
6bb24f4d
BB
58 log_mustnot datasetexists $snap
59 log_mustnot datasetexists $clone
3ec68a44 60}
61
62log_assert "'zfs destroy -R' works on deferred destroyed snapshots"
63log_onexit cleanup_testenv
64
65setup_testenv clone
66
67for dstype in FS VOL; do
68 if [[ $dstype == VOL ]]; then
69 if is_global_zone; then
70 test_clone_run $dstype
71 fi
72 else
73 test_clone_run $dstype
74 fi
6bb24f4d
BB
75done
76
77log_pass "'zfs destroy -R' works on deferred destroyed snapshots"