mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Refactor checksum operations in tests
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
This commit is contained in:
committed by
Tony Hutter
parent
8c9c049502
commit
27dda98b88
@@ -3562,3 +3562,25 @@ function mdb_ctf_set_int
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Compute MD5 digest for given file or stdin if no file given.
|
||||
# Note: file path must not contain spaces
|
||||
#
|
||||
function md5digest
|
||||
{
|
||||
typeset file=$1
|
||||
|
||||
md5sum -b $file | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
#
|
||||
# Compute SHA256 digest for given file or stdin if no file given.
|
||||
# Note: file path must not contain spaces
|
||||
#
|
||||
function sha256digest
|
||||
{
|
||||
typeset file=$1
|
||||
|
||||
sha256sum -b $file | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user