diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 1c467ca65..407101826 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -3460,18 +3460,7 @@ function tunable_exists # function md5digest { - typeset file=$1 - - case "$UNAME" in - FreeBSD) - md5 -q $file - ;; - *) - typeset sum _ - read -r sum _ < <(md5sum -b $file) - echo $sum - ;; - esac + openssl md5 -r $1 | awk '{print $1}' } # @@ -3492,18 +3481,7 @@ function cmp_md5s { # function sha256digest { - typeset file=$1 - - case "$UNAME" in - FreeBSD) - sha256 -q $file - ;; - *) - typeset sum _ - read -r sum _ < <(sha256sum -b $file) - echo $sum - ;; - esac + openssl sha256 -r $1 | awk '{print $1}' } function new_fs # diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_backup.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_backup.ksh index d98ab86ab..b591b209a 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_backup.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_backup.ksh @@ -47,8 +47,8 @@ sync_pool $TESTPOOL log_must eval "zfs send -ecL $snap > $tmpfile.1" log_must eval "zdb -B $TESTPOOL/$objsetid ecL > $tmpfile.2" -typeset sum1=$(cat $tmpfile.1 | md5sum) -typeset sum2=$(cat $tmpfile.2 | md5sum) +typeset sum1=$(md5digest $tmpfile.1) +typeset sum2=$(md5digest $tmpfile.2) log_must test "$sum1" = "$sum2" diff --git a/tests/zfs-tests/tests/functional/fault/suspend_resume_single.ksh b/tests/zfs-tests/tests/functional/fault/suspend_resume_single.ksh index 05f3ac708..6998df78a 100755 --- a/tests/zfs-tests/tests/functional/fault/suspend_resume_single.ksh +++ b/tests/zfs-tests/tests/functional/fault/suspend_resume_single.ksh @@ -43,7 +43,7 @@ log_assert "ensure single-disk pool resumes properly after suspend and clear" # create a file, and take a checksum, so we can compare later log_must dd if=/dev/urandom of=$DATAFILE bs=128K count=1 -typeset sum1=$(cat $DATAFILE | md5sum) +typeset sum1=$(md5digest $DATAFILE) # make a debug device that we can "unplug" load_scsi_debug 100 1 1 1 '512b' @@ -94,7 +94,7 @@ log_must zpool export $TESTPOOL log_must zpool import $TESTPOOL # sum the file we wrote earlier -typeset sum2=$(cat /$TESTPOOL/file | md5sum) +typeset sum2=$(md5digest /$TESTPOOL/file) # make sure the checksums match log_must test "$sum1" = "$sum2"