1#!/bin/ksh -p 2 3# 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. 8# 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. 12# 13 14# 15# Copyright (c) 2016 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/rsend/rsend.kshlib 19 20# 21# Description: 22# Verify that we can receive a compressed stream into a deduped filesystem. 23# 24# Strategy: 25# 1. Write heavily duplicated data to a filesystem and create a compressed 26# full stream. 27# 2. Verify that the stream can be received correctly into a dedup=verify 28# filesystem. 29# 30 31verify_runnable "both" 32 33log_pass "Verify a compressed stream can be received into a deduped filesystem" 34log_onexit cleanup_pool $POOL2 35 36typeset sendfs=$POOL2/sendfs 37typeset recvfs=$POOL2/recvfs 38typeset stream0=$BACKDIR/stream.0 39typeset stream1=$BACKDIR/stream.1 40typeset inc=$BACKDIR/stream.inc 41 42log_must zfs create -o compress=lz4 $sendfs 43log_must zfs create -o compress=lz4 -o dedup=verify $recvfs 44typeset dir=$(get_prop mountpoint $sendfs) 45for i in {0..10}; do 46 log_must file_write -o overwrite -f $dir/file.$i -d R -b 4096 -c 1000 47done 48log_must zfs snapshot $sendfs@snap0 49log_must eval "zfs send -c $sendfs@snap0 >$stream0" 50 51# Finally, make sure the receive works correctly. 52log_must eval "zfs recv -d $recvfs <$stream0" 53cmp_ds_cont $sendfs $recvfs 54 55log_pass "The compressed stream could be received into a deduped filesystem" 56