dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / rsend / rsend_004_pos.ksh
blobc0b36b2329e7c7a54c416a496e66ce5ff3e59b37
1 #!/bin/ksh -p
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/tests/functional/rsend/rsend.kshlib
35 # DESCRIPTION:
36 # zfs send -R -i send incremental from fs@init to fs@final.
38 # STRATEGY:
39 # 1. Create a set of snapshots and fill with data.
40 # 2. Create sub filesystems.
41 # 3. Create final snapshot
42 # 4. Verify zfs send -R -i will backup all the datasets which has
43 # snapshot suffix @final
46 verify_runnable "both"
48 log_assert "zfs send -R -i send incremental from fs@init to fs@final."
49 log_onexit cleanup_pool $POOL2
52 # Duplicate POOL2 for testing
54 log_must eval "zfs send -R $POOL@final > $BACKDIR/pool-final-R"
55 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final-R"
57 if is_global_zone ; then
59 # Testing send -R -i backup from pool
61 srclist=$(getds_with_suffix $POOL2 @final)
62 interlist="$srclist $(getds_with_suffix $POOL2 @snapC)"
63 interlist="$interlist $(getds_with_suffix $POOL2 @snapB)"
64 interlist="$interlist $(getds_with_suffix $POOL2 @snapA)"
66 log_must eval "zfs send -R -i @init $POOL2@final > " \
67 "$BACKDIR/pool-init-final-iR"
68 log_must destroy_tree $interlist
69 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-init-final-iR"
71 # Get current datasets with suffix @final
72 dstlist=$(getds_with_suffix $POOL2 @final)
73 if [[ $srclist != $dstlist ]]; then
74 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)"
76 log_must cmp_ds_cont $POOL $POOL2
79 dstds=$(get_dst_ds $POOL $POOL2)
81 # Testing send -R -i backup from filesystem
83 log_must eval "zfs send -R -i @init $dstds/$FS@final > " \
84 "$BACKDIR/fs-init-final-iR"
86 srclist=$(getds_with_suffix $dstds/$FS @final)
87 interlist="$srclist $(getds_with_suffix $dstds/$FS @snapC)"
88 interlist="$interlist $(getds_with_suffix $dstds/$FS @snapB)"
89 interlist="$interlist $(getds_with_suffix $dstds/$FS @snapA)"
90 log_must destroy_tree $interlist
91 if is_global_zone ; then
92 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-init-final-iR"
93 else
94 zfs receive -F -d $dstds/$FS < $BACKDIR/fs-init-final-iR
97 dstlist=$(getds_with_suffix $dstds/$FS @final)
98 if [[ $srclist != $dstlist ]]; then
99 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)"
101 log_must cmp_ds_cont $POOL $POOL2
103 if is_global_zone ; then
105 # Testing send -R -i backup from volume
107 srclist=$(getds_with_suffix $POOL2/$FS/vol @final)
108 log_must eval "zfs send -R -i @init $POOL2/$FS/vol@final > " \
109 "$BACKDIR/vol-init-final-iR"
110 log_must destroy_tree $srclist
111 log_must eval "zfs receive -d $POOL2 < $BACKDIR/vol-init-final-iR"
113 dstlist=$(getds_with_suffix $POOL2/$FS/vol @final)
114 if [[ $srclist != $dstlist ]]; then
115 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)"
117 log_must cmp_ds_cont $POOL $POOL2
120 log_pass "zfs send -R -i send incremental from fs@init to fs@final."