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. $STF_SUITE/include/properties.shlib
20
21#
22# Description:
23# Verify datasets using mixed compression algorithms can be received.
24#
25# Strategy:
26# 1. Write data with each of the available compression algorithms
27# 2. Receive a full compressed send, and verify the data and compression ratios
28#
29
30verify_runnable "both"
31
32log_assert "Verify datasets using mixed compression algorithms can be received."
33log_onexit cleanup_pool $POOL2
34
35send_ds=$POOL2/sendfs
36recv_ds=$POOL2/recvfs
37
38log_must zfs create $send_ds
39
40for prop in "${compress_prop_vals[@]}"; do
41	log_must zfs set compress=$prop $send_ds
42	write_compressible $(get_prop mountpoint $send_ds) 16m
43done
44
45log_must zfs set compress=off $send_ds
46log_must zfs snapshot $send_ds@full
47log_must eval "zfs send -c $send_ds@full >$BACKDIR/full"
48log_must eval "zfs recv $recv_ds <$BACKDIR/full"
49
50verify_stream_size $BACKDIR/full $send_ds
51verify_stream_size $BACKDIR/full $recv_ds
52log_must cmp_ds_cont $send_ds $recv_ds
53
54log_pass "Datasets using mixed compression algorithms can be received."
55