1#!/usr/bin/ksh 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) 2015 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/rsend/rsend.kshlib 19 20# 21# Description: 22# Verify a pool without the lz4 feature enabled can create compressed send 23# streams, and that they can be received into pools with or without the 24# lz4 feature. 25# 26# Strategy: 27# 1. For each of an uncompressed, and gzip dataset created from a pool with 28# the lz4 feature disabled, receive the stream into a pool with and without 29# the feature enabled. 30# 31 32verify_runnable "both" 33 34log_assert "Verify compressed streams are rejected if incompatible." 35 36typeset send_ds=$POOL2/testds 37typeset recv_ds=$POOL3/testds 38 39function cleanup 40{ 41 poolexists $POOL2 && destroy_pool $POOL2 42 poolexists $POOL3 && destroy_pool $POOL3 43 log_must zpool create $POOL2 $DISK2 44} 45log_onexit cleanup 46 47datasetexists $POOL2 && log_must zpool destroy $POOL2 48log_must zpool create -d $POOL2 $DISK2 49 50for compress in off gzip; do 51 for pool_opt in '' -d; do 52 poolexists $POOL3 && destroy_pool $POOL3 53 log_must zpool create $pool_opt $POOL3 $DISK3 54 55 datasetexists $send_ds && log_must zfs destroy -r $send_ds 56 datasetexists $recv_ds && log_must zfs destroy -r $recv_ds 57 58 log_must zfs create -o compress=$compress $send_ds 59 typeset dir=$(get_prop mountpoint $send_ds) 60 write_compressible $dir 16m 61 log_must zfs snapshot $send_ds@full 62 63 log_must eval "zfs send -c $send_ds@full >$BACKDIR/full-c" 64 log_must eval "zfs recv $recv_ds <$BACKDIR/full-c" 65 66 log_must zfs destroy -r $recv_ds 67 68 log_must eval "zfs send $send_ds@full >$BACKDIR/full" 69 log_must eval "zfs recv $recv_ds <$BACKDIR/full" 70 done 71done 72 73log_pass "Compressed streams are rejected if incompatible." 74