summaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/tests/functional/rsend/recv_dedup.ksh
blob: e6e282a1c6f8b0d817d4830f8e3461e6bdbb9b28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/ksh -p
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#

#
# Copyright (c) 2020 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/rsend/rsend.kshlib

#
# DESCRIPTION:
# Verifies that we can receive a dedup send stream by processing it with
# "zstream redup".
#

verify_runnable "both"

function cleanup
{
	destroy_dataset $TESTPOOL/recv "-r"
	rm -r /$TESTPOOL/tar
	rm $sendfile
}
log_onexit cleanup

log_assert "Verify zfs can receive dedup send streams with 'zstream redup'"

typeset sendfile_compressed=$STF_SUITE/tests/functional/rsend/dedup.zsend.bz2
typeset sendfile=/$TESTPOOL/dedup.zsend
typeset tarfile=$STF_SUITE/tests/functional/rsend/fs.tar.gz

log_must eval "bzcat <$sendfile_compressed >$sendfile"
log_must zfs create $TESTPOOL/recv
log_must eval "zstream redup $sendfile | zfs recv -d $TESTPOOL/recv"

log_must mkdir /$TESTPOOL/tar
log_must tar --directory /$TESTPOOL/tar -xzf $tarfile
log_must diff -r /$TESTPOOL/tar /$TESTPOOL/recv

log_pass "zfs can receive dedup send streams with 'zstream redup'"