dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / rsend / send-cD.ksh
blob25dc46b3c3e69c8ec8055b2e5327b4d665e45d2a
1 #!/usr/bin/ksh
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.
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
21 # Description:
22 # Verify that the -c and -D flags do not interfere with each other.
24 # Strategy:
25 # 1. Write unique data to a filesystem and create a compressed, deduplicated
26 # full stream.
27 # 2. Verify that the stream and send dataset show the same size
28 # 3. Make several copies of the original data, and create both full and
29 # incremental compressed, deduplicated send streams
30 # 4. Verify the full stream is no bigger than the stream from step 1
31 # 5. Verify the streams can be received correctly.
34 verify_runnable "both"
36 log_assert "Verify that the -c and -D flags do not interfere with each other"
37 log_onexit cleanup_pool $POOL2
39 typeset sendfs=$POOL2/sendfs
40 typeset recvfs=$POOL2/recvfs
41 typeset stream0=$BACKDIR/stream.0
42 typeset stream1=$BACKDIR/stream.1
43 typeset inc=$BACKDIR/stream.inc
45 log_must zfs create -o compress=lz4 $sendfs
46 log_must zfs create -o compress=lz4 $recvfs
47 typeset dir=$(get_prop mountpoint $sendfs)
48 # Don't use write_compressible: we want compressible but undedupable data here.
49 log_must cp /kernel/genunix $dir/file
50 log_must zfs snapshot $sendfs@snap0
51 log_must eval "zfs send -D -c $sendfs@snap0 >$stream0"
53 # The stream size should match at this point because the data is all unique
54 verify_stream_size $stream0 $sendfs
56 for i in {0..3}; do
57 log_must cp $dir/file $dir/file.$i
58 done
59 log_must zfs snapshot $sendfs@snap1
61 # The stream sizes should match, since the second stream contains no new blocks
62 log_must eval "zfs send -D -c $sendfs@snap1 >$stream1"
63 typeset size0=$(stat -c %s $stream0)
64 typeset size1=$(stat -c %s $stream1)
65 within_percent $size0 $size1 90 || log_fail "$size0 and $size1"
67 # Finally, make sure the receive works correctly.
68 log_must eval "zfs send -D -c -i snap0 $sendfs@snap1 >$inc"
69 log_must eval "zfs recv -d $recvfs <$stream0"
70 log_must eval "zfs recv -d $recvfs <$inc"
71 cmp_ds_cont $sendfs $recvfs
73 # The size of the incremental should be the same as the initial send.
74 typeset size2=$(stat -c %s $inc)
75 within_percent $size0 $size2 90 || log_fail "$size0 and $size1"
77 log_pass "The -c and -D flags do not interfere with each other"