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
/math.shlib
23 # Verify compression features show up in zstreamdump
26 # 1. Create a full compressed send stream
27 # 2. Verify zstreamdump shows this stream has the relevant features
28 # 3. Verify zstreamdump's accounting of logical and compressed size is correct
31 verify_runnable
"both"
33 log_assert
"Verify zstreamdump correctly interprets compressed send streams."
34 log_onexit cleanup_pool
$POOL2
36 typeset sendfs
=$POOL2/fs
38 log_must zfs create
-o compress=lz4
$sendfs
39 typeset dir
=$
(get_prop mountpoint
$sendfs)
40 write_compressible
$dir 16m
41 log_must zfs snapshot
$sendfs@full
43 log_must
eval "zfs send -c $sendfs@full >$BACKDIR/full"
44 log_must stream_has_features
$BACKDIR/full lz4 compressed
45 cat $BACKDIR/full | zstreamdump
-v | parse_dump
> $BACKDIR/dump.out
47 lsize
=$
(awk '/^WRITE [^0]/ {lsize += $4} END {printf("%d", lsize)}' \
49 lsize_prop
=$
(get_prop logicalused
$sendfs)
50 within_percent
$lsize $lsize_prop 90 || log_fail \
51 "$lsize and $lsize_prop differed by too much"
53 csize
=$
(awk '/^WRITE [^0]/ {csize += $5} END {printf("%d", csize)}' \
55 csize_prop
=$
(get_prop used
$sendfs)
56 within_percent
$csize $csize_prop 90 || log_fail \
57 "$csize and $csize_prop differed by too much"
59 log_pass
"zstreamdump correctly interprets compressed send streams."