dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / rsend / send-c_incremental.ksh
blob719970d99561406661413dbbc161a1e72180ef71
1 #!/usr/bin/ksh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2015 by Delphix. All rights reserved.
18 . $STF_SUITE/tests/functional/rsend/rsend.kshlib
21 # Description:
22 # Verify that compressed send works correctly with incremental sends.
24 # Strategy:
25 # 1. Randomly choose either a -i or -I incremental.
26 # 2. Generate compressed incremental replication streams for a pool, a
27 # descendant dataset, and a volume.
28 # 3. Receive these streams verifying both the contents, and intermediate
29 # snapshots are present or absent as appropriate to the -i or -I option.
32 verify_runnable "both"
34 log_assert "Verify compressed send works with incremental send streams."
35 log_onexit cleanup_pool $POOL2
37 typeset opt=$(random_get "-i" "-I")
38 typeset final dstlist list vol
40 log_must eval "zfs send -R $POOL@final > $BACKDIR/final"
41 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/final"
43 function do_checks
45 log_must cmp_ds_cont $POOL $POOL2
46 [[ $opt = "-I" ]] && log_must cmp_ds_subs $POOL $POOL2
47 [[ $opt = "-i" ]] && log_mustnot cmp_ds_subs $POOL $POOL2
49 [[ $1 != "clean" ]] && return
51 cleanup_pool $POOL2
52 log_must eval "zfs send -R $POOL@final > $BACKDIR/final"
53 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/final"
56 if is_global_zone; then
57 # Send from the pool root
58 final=$(getds_with_suffix $POOL2 @final)
59 list="$final $(getds_with_suffix $POOL2 @snapA)"
60 list="$list $(getds_with_suffix $POOL2 @snapB)"
61 list="$list $(getds_with_suffix $POOL2 @snapC)"
63 log_must eval "zfs send -c -R $opt @init $POOL2@final >$BACKDIR/pool"
64 log_must destroy_tree $list
65 log_must eval "zfs recv -d -F $POOL2 <$BACKDIR/pool"
67 dstlist=$(getds_with_suffix $POOL2 @final)
68 [[ $final != $dstlist ]] && log_fail "$final != $dstlist"
70 do_checks clean
72 # Send of a volume
73 vol=$POOL2/$FS/vol
74 final=$(getds_with_suffix $vol @final)
75 log_must eval "zfs send -c -R $opt @init $vol@final >$BACKDIR/vol"
76 log_must destroy_tree $vol@snapB $vol@snapC $vol@final
77 log_must eval "zfs recv -d -F $POOL2 <$BACKDIR/vol"
79 dstlist=$(getds_with_suffix $POOL2/$FS/vol @final)
80 [[ $final != $dstlist ]] && log_fail "$final != $dstlist"
82 do_checks clean
85 # Send of a descendant fs
86 final=$(getds_with_suffix $POOL2/$FS @final)
87 list="$final $(getds_with_suffix $POOL2/$FS @snapA)"
88 list="$list $(getds_with_suffix $POOL2/$FS @snapB)"
89 list="$list $(getds_with_suffix $POOL2/$FS @snapC)"
91 log_must eval "zfs send -c -R $opt @init $POOL2/$FS@final >$BACKDIR/fs"
92 log_must destroy_tree $list
93 log_must eval "zfs recv -d -F $POOL2 <$BACKDIR/fs"
95 dstlist=$(getds_with_suffix $POOL2/$FS @final)
96 [[ $final != $dstlist ]] && log_fail "$final != $dstlist"
98 do_checks
100 log_pass "Compressed send works with incremental send streams."