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 gracefully rejects a compressed stream 23# because on any sending pool that supports it, metadata will be compressed 24# with lz4 even if user data is not compressed. 25# 26# Strategy: 27# 1. For each of an uncompressed, gzip and lz4 dataset, do the following 28# receives into a pool without the lz4 feature: 29# 2. Attempt to receive the compressed stream (should fail) 30# 3. Attempt to receive the uncompressed stream (should succeed) 31# 32 33verify_runnable "both" 34 35log_assert "Verify compressed streams are rejected if incompatible." 36 37typeset compress_types="off gzip lz4" 38typeset send_ds=$POOL2/testds 39typeset recv_ds=$POOL3/testds 40 41function cleanup 42{ 43 poolexists $POOL2 && destroy_pool $POOL2 44 poolexists $POOL3 && destroy_pool $POOL3 45 log_must zpool create $POOL2 $DISK2 46} 47log_onexit cleanup 48 49datasetexists $POOL3 && log_must zpool destroy $POOL3 50log_must zpool create -d $POOL3 $DISK3 51 52for compress in $compress_types; do 53 datasetexists $send_ds && log_must zfs destroy -r $send_ds 54 datasetexists $recv_ds && log_must zfs destroy -r $recv_ds 55 56 log_must zfs create -o compress=$compress $send_ds 57 typeset dir=$(get_prop mountpoint $send_ds) 58 write_compressible $dir 16m 59 log_must zfs snapshot $send_ds@full 60 61 log_must eval "zfs send -c $send_ds@full >$BACKDIR/full-c" 62 log_mustnot eval "zfs recv $recv_ds <$BACKDIR/full-c" 63 64 log_must eval "zfs send $send_ds@full >$BACKDIR/full" 65 log_must eval "zfs recv $recv_ds <$BACKDIR/full" 66done 67 68log_pass "Compressed streams are rejected if incompatible." 69