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) 2015, Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/rsend/rsend.kshlib 19. $STF_SUITE/include/properties.shlib 20 21# 22# Description: 23# Verify a pool without the lz4 feature gracefully rejects a compressed stream 24# because on any sending pool that supports it, metadata will be compressed 25# with lz4 even if user data is not compressed. 26# 27# Strategy: 28# 1. For each of an uncompressed, gzip and lz4 dataset, do the following 29# receives into a pool without the lz4 feature: 30# 2. Attempt to receive the compressed stream (should fail) 31# 3. Attempt to receive the uncompressed stream (should succeed) 32# 33 34verify_runnable "both" 35 36log_assert "Verify compressed streams are rejected if incompatible." 37 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_prop_vals[@]}"; do 53 datasetexists $send_ds && destroy_dataset $send_ds -r 54 datasetexists $recv_ds && destroy_dataset $recv_ds -r 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