5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2015, 2016 by Delphix. All rights reserved.
21 . $STF_SUITE/tests/functional/cli_root/cli_common.kshlib
25 # Verifying 'zfs receive' works correctly on deduplicated streams
28 # 1. Create some snapshots with duplicated data
29 # 2. Send a deduplicated stream of the last snapshot
30 # 3. Attempt to receive the deduplicated stream
33 src_fs=$TESTPOOL/drecvsrc
35 dst_fs=$temppool/drecvdest
36 streamfile=$TEST_BASE_DIR/drecvstream.$$
37 tpoolfile=$TEST_BASE_DIR/temptank.$$
41 for fs in $src_fs $dst_fs; do
42 datasetexists $fs && log_must zfs destroy -rf $fs
44 zpool destroy $temppool
45 [[ -f $streamfile ]] && log_must rm -f $streamfile
46 [[ -f $tpoolfile ]] && log_must rm -f $tpoolfile
49 log_assert "Verifying 'zfs receive' works correctly on deduplicated streams"
52 truncate -s 100M $tpoolfile
53 log_must zpool create $temppool $tpoolfile
54 log_must zfs create $src_fs
55 src_mnt=$(get_prop mountpoint $src_fs) || log_fail "get_prop mountpoint $src_fs"
57 echo blah > $src_mnt/blah
58 zfs snapshot $src_fs@base
60 echo grumble > $src_mnt/grumble
61 echo blah > $src_mnt/blah2
62 zfs snapshot $src_fs@snap2
64 echo grumble > $src_mnt/mumble
65 echo blah > $src_mnt/blah3
66 zfs snapshot $src_fs@snap3
68 log_must eval "zfs send -D -R $src_fs@snap3 > $streamfile"
69 log_must eval "zfs receive -v $dst_fs < $streamfile"
70 log_must zfs destroy -r $dst_fs
71 log_must eval "zstream redup $streamfile | zfs receive -v $dst_fs"
75 log_pass "Verifying 'zfs receive' works correctly on deduplicated streams"