xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_mixed_compression.ksh (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3
4#
5# This file and its contents are supplied under the terms of the
6# Common Development and Distribution License ("CDDL"), version 1.0.
7# You may only use this file in accordance with the terms of version
8# 1.0 of the CDDL.
9#
10# A full copy of the text of the CDDL should have accompanied this
11# source.  A copy of the CDDL is also available via the Internet at
12# http://www.illumos.org/license/CDDL.
13#
14
15#
16# Copyright (c) 2015 by Delphix. All rights reserved.
17#
18
19. $STF_SUITE/tests/functional/rsend/rsend.kshlib
20. $STF_SUITE/include/properties.shlib
21
22#
23# Description:
24# Verify datasets using mixed compression algorithms can be received.
25#
26# Strategy:
27# 1. Write data with each of the available compression algorithms
28# 2. Receive a full compressed send, and verify the data and compression ratios
29#
30
31verify_runnable "both"
32
33log_assert "Verify datasets using mixed compression algorithms can be received."
34log_onexit cleanup_pool $POOL2
35
36send_ds=$POOL2/sendfs
37recv_ds=$POOL2/recvfs
38
39log_must zfs create $send_ds
40
41for prop in "${compress_prop_vals[@]}"; do
42	log_must zfs set compress=$prop $send_ds
43	write_compressible $(get_prop mountpoint $send_ds) 16m
44done
45
46log_must zfs set compress=off $send_ds
47log_must zfs snapshot $send_ds@full
48log_must eval "zfs send -c $send_ds@full >$BACKDIR/full"
49log_must eval "zfs recv $recv_ds <$BACKDIR/full"
50
51verify_stream_size $BACKDIR/full $send_ds
52verify_stream_size $BACKDIR/full $recv_ds
53log_must cmp_ds_cont $send_ds $recv_ds
54
55log_pass "Datasets using mixed compression algorithms can be received."
56