dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / test / zfs-tests / tests / functional / rsend / send-c_volume.ksh
blob4ce3d5a09b7498984fd1c2ed3272afced5cb11f5
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 compressed send correctly handles volumes
24 # Strategy:
25 # 1. Write compressible data into a volume, take a snap
26 # 2. Verify the compressed stream is the correct size, and has the correct data
27 # 3. Repeat step 2 for an incremental compressed stream
30 function cleanup
32 log_must zfs destroy -r $vol
33 cleanup_pool $POOL2
36 verify_runnable "both"
38 log_assert "Verify compressed send works with volumes"
39 log_onexit cleanup
41 typeset vol="$POOL/newvol"
42 typeset vol2="$POOL2/newvol"
43 typeset voldev="/dev/zvol/rdsk/$POOL/newvol"
44 typeset voldev2="/dev/zvol/rdsk/$POOL2/newvol"
45 typeset data1=$BACKDIR/file.0
46 typeset data2=$BACKDIR/file.1
47 typeset megs=8
49 log_must zfs create -V 256m -o compress=lz4 $vol
51 write_compressible $BACKDIR ${megs}m 2
52 md5_1=$(md5sum $data1 | awk '{print $1}')
53 md5_2=$(md5sum $data2 | awk '{print $1}')
55 log_must dd if=$data1 of=$voldev bs=1024k
56 log_must zfs snapshot $vol@snap
58 log_must eval "zfs send -c $vol@snap >$BACKDIR/full"
59 log_must eval "zfs recv -d $POOL2 <$BACKDIR/full"
61 verify_stream_size $BACKDIR/full $vol
62 verify_stream_size $BACKDIR/full $vol2
63 md5=$(dd if=$voldev2 bs=1024k count=$megs 2>/dev/null | md5sum | \
64 awk '{print $1}')
65 [[ $md5 = $md5_1 ]] || log_fail "md5 mismatch: $md5 != $md5_1"
67 # Repeat, for an incremental send
68 log_must dd oseek=$megs if=$data2 of=$voldev bs=1024k
69 log_must zfs snapshot $vol@snap2
71 log_must eval "zfs send -c -i snap $vol@snap2 >$BACKDIR/inc"
72 log_must eval "zfs recv -d $POOL2 <$BACKDIR/inc"
74 verify_stream_size $BACKDIR/inc $vol 90 $vol@snap
75 verify_stream_size $BACKDIR/inc $vol2 90 $vol2@snap
76 md5=$(dd iseek=$megs if=$voldev2 bs=1024k count=$megs 2>/dev/null | md5sum | \
77 awk '{print $1}')
78 [[ $md5 = $md5_2 ]] || log_fail "md5 mismatch: $md5 != $md5_2"
80 log_pass "Verify compressed send works with volumes"