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
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.
15 # Copyright (c) 2015 by Delphix. All rights reserved.
18 .
$STF_SUITE/tests
/functional
/rsend
/rsend.kshlib
19 .
$STF_SUITE/include
/properties.shlib
23 # Verify that the amount of data in a send -c stream matches compressratio.
26 # 1. For random compression types, and compressible / incompressible data:
27 # 2. Create a snap with data
28 # 3. Compare the size of the stream with the data on the dataset, adjusted
29 # by compressratio for normal send, and compared to used for send -c.
32 verify_runnable
"both"
34 log_assert
"Verify send -c streams are compressed"
35 log_onexit cleanup_pool
$POOL2
37 typeset sendfs
=$POOL2/$FS
40 for prop
in $
(get_rand_compress_any
6); do
41 for compressible
in 'yes' 'no'; do
42 log_must zfs create
-o compress=$prop $sendfs
44 if [[ $compressible = 'yes' ]]; then
45 write_compressible $
(get_prop mountpoint
$sendfs) \
48 typeset
file="$(get_prop mountpoint $sendfs)/ddfile"
49 log_must
dd if=/dev
/urandom of
=$file bs
=1024k count
=$megs
52 log_must zfs snapshot
$sendfs@snap
54 # Calculate the sizes and verify the compression ratio.
55 log_must
eval "zfs send $sendfs@snap >$BACKDIR/uncompressed"
56 verify_stream_size
$BACKDIR/uncompressed
$sendfs
58 log_must
eval "zfs send -c $sendfs@snap >$BACKDIR/compressed"
59 verify_stream_size
$BACKDIR/compressed
$sendfs
61 log_must
rm $BACKDIR/uncompressed
$BACKDIR/compressed
62 log_must zfs destroy
-r $sendfs
66 log_pass
"Verify send -c streams are compressed"