diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index b247a67ff6..50449633ac 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -91,7 +91,6 @@ export SYSTEM_FILES_COMMON='arp strings su sudo - sum swapoff swapon sync diff --git a/tests/zfs-tests/tests/functional/acl/acl_common.kshlib b/tests/zfs-tests/tests/functional/acl/acl_common.kshlib index ba08bcb48b..1e9d736fdf 100644 --- a/tests/zfs-tests/tests/functional/acl/acl_common.kshlib +++ b/tests/zfs-tests/tests/functional/acl/acl_common.kshlib @@ -411,7 +411,7 @@ function get_xattr # for xattr in `runat $obj ls | \ grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do - runat $obj sum $xattr + runat $obj cksum $xattr done } @@ -424,16 +424,14 @@ function get_owner #node typeset value if [[ -z $node ]]; then - log_fail "node are not defined." + log_fail "node is not defined." fi if [[ -d $node ]]; then - value=$(ls -dl $node | awk '{print $3}') + ls -dl $node elif [[ -e $node ]]; then - value=$(ls -l $node | awk '{print $3}') - fi - - echo $value + ls -l $node + fi | awk '{print $3}' } # diff --git a/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib index 4788de5986..2b84f6a9c1 100644 --- a/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib @@ -39,7 +39,7 @@ function get_cksum # } # -# Compare the check sum of target files with the original file +# Compare the checksum of target files with the original file # function compare_cksum # ... diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib index 2eadb68c37..04a8867732 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib @@ -36,9 +36,9 @@ # $1 full file name function getsum #fname { - (( ${#1} == 0 )) && \ - log_fail "Need give file name." - return $(sum $1 | awk '{print $1}') + typeset sum + read -r sum _ < <(cksum "$1") + echo $sum } # Define global variable checksum, get the original file sum. diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh index 77fe116983..e159c1a041 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh @@ -91,7 +91,7 @@ log_assert "Verify that an exported pool can be imported." setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1 -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 _ < <(cksum $MYTESTFILE) typeset -i i=0 typeset -i j=0 @@ -125,9 +125,8 @@ while (( i < ${#pools[*]} )); do [[ ! -e $basedir/$TESTFILE0 ]] && \ log_fail "$basedir/$TESTFILE0 missing after import." - checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" + read -r checksum2 _ < <(cksum $basedir/$TESTFILE0) + log_must [ "$checksum1" = "$checksum2" ] ((j = j + 1)) done diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh index 898f93cc90..95ebe0ae29 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh @@ -90,7 +90,7 @@ log_assert "Verify that an exported pool cannot be imported more than once." setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1 -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 _ < <(cksum $MYTESTFILE) typeset -i i=0 typeset -i j=0 @@ -126,9 +126,8 @@ while (( i < ${#pools[*]} )); do [[ ! -e $basedir/$TESTFILE0 ]] && \ log_fail "$basedir/$TESTFILE0 missing after import." - checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" + read -r checksum2 _ < <(cksum $basedir/$TESTFILE0) + log_must [ "$checksum1" = "$checksum2" ] log_mustnot zpool import ${devs[i]} $target diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh index b384ec9b1f..4ebe6b5914 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh @@ -108,9 +108,8 @@ function checksum_all #alter_root [[ ! -e $file ]] && \ log_fail "$file missing after import." - checksum2=$(sum $file | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" + read -r checksum2 _ < <(cksum $file) + log_must [ "$checksum1" = "$checksum2" ] (( id = id + 1 )) done @@ -122,7 +121,7 @@ function checksum_all #alter_root log_assert "Verify that 'zpool import -a' succeeds as root." log_onexit cleanup_all -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 _ < <(cksum $MYTESTFILE) number=1 # diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh index 3b5167ff03..22cec24ff4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh @@ -111,7 +111,7 @@ log_assert "Verify that import could handle damaged or missing device." CWD=$PWD cd $DEVICE_DIR || log_fail "Unable change directory to $DEVICE_DIR" -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 _ < <(cksum $MYTESTFILE) typeset -i i=0 typeset -i j=0 @@ -199,10 +199,8 @@ while (( i < ${#vdevs[*]} )); do [[ ! -e $basedir/$TESTFILE0 ]] && \ log_fail "$basedir/$TESTFILE0 missing after import." - checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" - + read -r checksum2 _ < <(cksum $basedir/$TESTFILE0) + log_must [ "$checksum1" = "$checksum2" ] done ((j = j + 1)) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh index bcb795b19f..ac76f879c2 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh @@ -97,9 +97,8 @@ function verify [[ ! -e $mtpt/$file ]] && \ log_fail "$mtpt/$file missing after import." - checksum2=$(sum $mymtpt/$file | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" + read -r checksum2 _ < <(cksum $mymtpt/$file) + log_must [ "$checksum1" = "$checksum2" ] return 0 @@ -149,7 +148,7 @@ CWD=$PWD log_must cd $DEVICE_DIR log_must tar cf $DEVICE_DIR/$DEVICE_ARCHIVE ${DEVICE_FILE}* -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 < <(cksum $MYTESTFILE) typeset -i i=0 typeset -i j=0 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh index bb6bf86d78..4e49e8d01d 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh @@ -101,7 +101,7 @@ log_onexit cleanup log_assert "Verify that an imported pool can be renamed." setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1 -checksum1=$(sum $MYTESTFILE | awk '{print $1}') +read -r checksum1 _ < <(cksum $MYTESTFILE) typeset -i i=0 typeset -i j=0 @@ -140,9 +140,8 @@ while (( i < ${#pools[*]} )); do [[ ! -e $basedir/$TESTFILE0 ]] && \ log_fail "$basedir/$TESTFILE0 missing after import." - checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}') - [[ "$checksum1" != "$checksum2" ]] && \ - log_fail "Checksums differ ($checksum1 != $checksum2)" + read -r checksum2 _ < <(cksum $basedir/$TESTFILE0) + log_must [ "$checksum1" = "$checksum2" ] log_must zpool export "${pools[i]}-new" diff --git a/tests/zfs-tests/tests/functional/migration/migration.cfg b/tests/zfs-tests/tests/functional/migration/migration.cfg index 12a5a7799b..a8a24e0a3b 100644 --- a/tests/zfs-tests/tests/functional/migration/migration.cfg +++ b/tests/zfs-tests/tests/functional/migration/migration.cfg @@ -102,9 +102,8 @@ export DISK_COUNT ZFS_DISK NONZFS_DISK SINGLE_DISK ZFSSIDE_DISK NONZFSSIDE_DISK export TESTFILE=/etc/passwd export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir -tmp=`sum $TESTFILE` -export SUMA=`echo $tmp | awk '{print $1}'` -export SUMB=`echo $tmp | awk '{print $2}'` +read -r SUMA SUMB _ < <(cksum $TESTFILE) +export SUMA SUMB export FS_SIZE=1g export BNAME=`basename $TESTFILE` export DNAME=`dirname $TESTFILE` diff --git a/tests/zfs-tests/tests/functional/migration/migration.kshlib b/tests/zfs-tests/tests/functional/migration/migration.kshlib index a2b4ed99b1..2b1955fe93 100644 --- a/tests/zfs-tests/tests/functional/migration/migration.kshlib +++ b/tests/zfs-tests/tests/functional/migration/migration.kshlib @@ -99,9 +99,7 @@ function migrate #destdir oldsuma oldsumb cmd $cmd (( $? != 0 )) && return 1 - sumy=`sum ./$BNAME` - suma=`echo $sumy | awk '{print $1}'` - sumb=`echo $sumy | awk '{print $2}'` + read -r suma sumb _ < <(cksum ./$BNAME) if (( $oldsuma != $suma )); then log_note "sum values are not the same" @@ -133,9 +131,7 @@ function migrate_cpio cpio -iv < $archive (( $? != 0 )) && return 1 - sumy=`sum ./$BNAME` - suma=`echo $sumy | awk '{print $1}'` - sumb=`echo $sumy | awk '{print $2}'` + read -r suma sumb _ < <(cksum ./$BNAME) if (( $oldsuma != $suma )); then log_note "sum values are not the same"