1*5602294fSDan Kimmel#!/usr/bin/ksh 2*5602294fSDan Kimmel 3*5602294fSDan Kimmel# 4*5602294fSDan Kimmel# This file and its contents are supplied under the terms of the 5*5602294fSDan Kimmel# Common Development and Distribution License ("CDDL"), version 1.0. 6*5602294fSDan Kimmel# You may only use this file in accordance with the terms of version 7*5602294fSDan Kimmel# 1.0 of the CDDL. 8*5602294fSDan Kimmel# 9*5602294fSDan Kimmel# A full copy of the text of the CDDL should have accompanied this 10*5602294fSDan Kimmel# source. A copy of the CDDL is also available via the Internet at 11*5602294fSDan Kimmel# http://www.illumos.org/license/CDDL. 12*5602294fSDan Kimmel# 13*5602294fSDan Kimmel 14*5602294fSDan Kimmel# 15*5602294fSDan Kimmel# Copyright (c) 2016 by Delphix. All rights reserved. 16*5602294fSDan Kimmel# 17*5602294fSDan Kimmel 18*5602294fSDan Kimmel. $STF_SUITE/tests/functional/rsend/rsend.kshlib 19*5602294fSDan Kimmel 20*5602294fSDan Kimmel# 21*5602294fSDan Kimmel# Description: 22*5602294fSDan Kimmel# Verify that we can receive a compressed stream into a deduped filesystem. 23*5602294fSDan Kimmel# 24*5602294fSDan Kimmel# Strategy: 25*5602294fSDan Kimmel# 1. Write heavily duplicated data to a filesystem and create a compressed 26*5602294fSDan Kimmel# full stream. 27*5602294fSDan Kimmel# 2. Verify that the stream can be received correctly into a dedup=verify 28*5602294fSDan Kimmel# filesystem. 29*5602294fSDan Kimmel# 30*5602294fSDan Kimmel 31*5602294fSDan Kimmelverify_runnable "both" 32*5602294fSDan Kimmel 33*5602294fSDan Kimmellog_pass "Verify a compressed stream can be received into a deduped filesystem" 34*5602294fSDan Kimmellog_onexit cleanup_pool $POOL2 35*5602294fSDan Kimmel 36*5602294fSDan Kimmeltypeset sendfs=$POOL2/sendfs 37*5602294fSDan Kimmeltypeset recvfs=$POOL2/recvfs 38*5602294fSDan Kimmeltypeset stream0=$BACKDIR/stream.0 39*5602294fSDan Kimmeltypeset stream1=$BACKDIR/stream.1 40*5602294fSDan Kimmeltypeset inc=$BACKDIR/stream.inc 41*5602294fSDan Kimmel 42*5602294fSDan Kimmellog_must zfs create -o compress=lz4 $sendfs 43*5602294fSDan Kimmellog_must zfs create -o compress=lz4 -o dedup=verify $recvfs 44*5602294fSDan Kimmeltypeset dir=$(get_prop mountpoint $sendfs) 45*5602294fSDan Kimmelfor i in {0..10}; do 46*5602294fSDan Kimmel log_must cp /kernel/genunix $dir/file.$i 47*5602294fSDan Kimmeldone 48*5602294fSDan Kimmellog_must zfs snapshot $sendfs@snap0 49*5602294fSDan Kimmellog_must eval "zfs send -c $sendfs@snap0 >$stream0" 50*5602294fSDan Kimmel 51*5602294fSDan Kimmel# Finally, make sure the receive works correctly. 52*5602294fSDan Kimmellog_must eval "zfs recv -d $recvfs <$stream0" 53*5602294fSDan Kimmelcmp_ds_cont $sendfs $recvfs 54*5602294fSDan Kimmel 55*5602294fSDan Kimmellog_pass "The compressed stream could be received into a deduped filesystem" 56