mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-05 16:32:44 +03:00

md5sum in particular but also sha256sum to a lesser extent is used in several areas of the test suite for computing checksums. The vast majority of invocations are followed by `| awk '{ print $1 }'`. Introduce functions to wrap up `md5sum $file | awk '{ print $1 }'` and likewise for sha256sum. These also serve as a convenient interface for alternative implementations on other platforms. Reviewed-by: Igor Kozhukhov <igor@dilos.org> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@ixsystems.com> Closes #9280
79 lines
2.2 KiB
Bash
Executable File
79 lines
2.2 KiB
Bash
Executable File
#!/bin/ksh -p
|
|
|
|
#
|
|
# This file and its contents are supplied under the terms of the
|
|
# Common Development and Distribution License ("CDDL"), version 1.0.
|
|
# You may only use this file in accordance with the terms of version
|
|
# 1.0 of the CDDL.
|
|
#
|
|
# A full copy of the text of the CDDL should have accompanied this
|
|
# source. A copy of the CDDL is also available via the Internet at
|
|
# http://www.illumos.org/license/CDDL.
|
|
#
|
|
|
|
#
|
|
# Copyright (c) 2015 by Delphix. All rights reserved.
|
|
#
|
|
|
|
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
|
|
|
|
#
|
|
# Description:
|
|
# Verify that compressed send correctly handles volumes
|
|
#
|
|
# Strategy:
|
|
# 1. Write compressible data into a volume, take a snap
|
|
# 2. Verify the compressed stream is the correct size, and has the correct data
|
|
# 3. Repeat step 2 for an incremental compressed stream
|
|
#
|
|
|
|
function cleanup
|
|
{
|
|
log_must_busy zfs destroy -r $vol
|
|
cleanup_pool $POOL2
|
|
}
|
|
|
|
verify_runnable "both"
|
|
|
|
log_assert "Verify compressed send works with volumes"
|
|
log_onexit cleanup
|
|
|
|
typeset vol="$POOL/newvol"
|
|
typeset vol2="$POOL2/newvol"
|
|
typeset voldev="$ZVOL_DEVDIR/$POOL/newvol"
|
|
typeset voldev2="$ZVOL_DEVDIR/$POOL2/newvol"
|
|
typeset data1=$BACKDIR/file.0
|
|
typeset data2=$BACKDIR/file.1
|
|
typeset megs=8
|
|
|
|
log_must zfs create -V 256m -o compress=lz4 $vol
|
|
|
|
write_compressible $BACKDIR ${megs}m 2
|
|
md5_1=$(md5digest $data1)
|
|
md5_2=$(md5digest $data2)
|
|
|
|
log_must dd if=$data1 of=$voldev bs=1024k
|
|
log_must zfs snapshot $vol@snap
|
|
|
|
log_must eval "zfs send -c $vol@snap >$BACKDIR/full"
|
|
log_must eval "zfs recv -d $POOL2 <$BACKDIR/full"
|
|
|
|
verify_stream_size $BACKDIR/full $vol
|
|
verify_stream_size $BACKDIR/full $vol2
|
|
md5=$(dd if=$voldev2 bs=1024k count=$megs 2>/dev/null | md5digest)
|
|
[[ $md5 = $md5_1 ]] || log_fail "md5 mismatch: $md5 != $md5_1"
|
|
|
|
# Repeat, for an incremental send
|
|
log_must dd seek=$megs if=$data2 of=$voldev bs=1024k
|
|
log_must zfs snapshot $vol@snap2
|
|
|
|
log_must eval "zfs send -c -i snap $vol@snap2 >$BACKDIR/inc"
|
|
log_must eval "zfs recv -d $POOL2 <$BACKDIR/inc"
|
|
|
|
verify_stream_size $BACKDIR/inc $vol 90 $vol@snap
|
|
verify_stream_size $BACKDIR/inc $vol2 90 $vol2@snap
|
|
md5=$(dd skip=$megs if=$voldev2 bs=1024k count=$megs 2>/dev/null | md5digest)
|
|
[[ $md5 = $md5_2 ]] || log_fail "md5 mismatch: $md5 != $md5_2"
|
|
|
|
log_pass "Verify compressed send works with volumes"
|