tests: replace sum(1) with cksum(1)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
parent
c2fcc55d97
commit
9423c932d4
|
@ -91,7 +91,6 @@ export SYSTEM_FILES_COMMON='arp
|
||||||
strings
|
strings
|
||||||
su
|
su
|
||||||
sudo
|
sudo
|
||||||
sum
|
|
||||||
swapoff
|
swapoff
|
||||||
swapon
|
swapon
|
||||||
sync
|
sync
|
||||||
|
|
|
@ -411,7 +411,7 @@ function get_xattr #<obj>
|
||||||
|
|
||||||
for xattr in `runat $obj ls | \
|
for xattr in `runat $obj ls | \
|
||||||
grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do
|
grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do
|
||||||
runat $obj sum $xattr
|
runat $obj cksum $xattr
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,16 +424,14 @@ function get_owner #node
|
||||||
typeset value
|
typeset value
|
||||||
|
|
||||||
if [[ -z $node ]]; then
|
if [[ -z $node ]]; then
|
||||||
log_fail "node are not defined."
|
log_fail "node is not defined."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d $node ]]; then
|
if [[ -d $node ]]; then
|
||||||
value=$(ls -dl $node | awk '{print $3}')
|
ls -dl $node
|
||||||
elif [[ -e $node ]]; then
|
elif [[ -e $node ]]; then
|
||||||
value=$(ls -l $node | awk '{print $3}')
|
ls -l $node
|
||||||
fi
|
fi | awk '{print $3}'
|
||||||
|
|
||||||
echo $value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -39,7 +39,7 @@ function get_cksum # <file path>
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Compare the check sum of target files with the original file
|
# Compare the checksum of target files with the original file
|
||||||
#
|
#
|
||||||
|
|
||||||
function compare_cksum #<orig_data> <target_data1>...<target_datan>
|
function compare_cksum #<orig_data> <target_data1>...<target_datan>
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
# $1 full file name
|
# $1 full file name
|
||||||
function getsum #fname
|
function getsum #fname
|
||||||
{
|
{
|
||||||
(( ${#1} == 0 )) && \
|
typeset sum
|
||||||
log_fail "Need give file name."
|
read -r sum _ < <(cksum "$1")
|
||||||
return $(sum $1 | awk '{print $1}')
|
echo $sum
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define global variable checksum, get the original file sum.
|
# Define global variable checksum, get the original file sum.
|
||||||
|
|
|
@ -91,7 +91,7 @@ log_assert "Verify that an exported pool can be imported."
|
||||||
|
|
||||||
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
||||||
|
|
||||||
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
read -r checksum1 _ < <(cksum $MYTESTFILE)
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
typeset -i j=0
|
typeset -i j=0
|
||||||
|
@ -125,9 +125,8 @@ while (( i < ${#pools[*]} )); do
|
||||||
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
||||||
log_fail "$basedir/$TESTFILE0 missing after import."
|
log_fail "$basedir/$TESTFILE0 missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
((j = j + 1))
|
((j = j + 1))
|
||||||
done
|
done
|
||||||
|
|
|
@ -90,7 +90,7 @@ log_assert "Verify that an exported pool cannot be imported more than once."
|
||||||
|
|
||||||
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
||||||
|
|
||||||
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
read -r checksum1 _ < <(cksum $MYTESTFILE)
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
typeset -i j=0
|
typeset -i j=0
|
||||||
|
@ -126,9 +126,8 @@ while (( i < ${#pools[*]} )); do
|
||||||
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
||||||
log_fail "$basedir/$TESTFILE0 missing after import."
|
log_fail "$basedir/$TESTFILE0 missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
log_mustnot zpool import ${devs[i]} $target
|
log_mustnot zpool import ${devs[i]} $target
|
||||||
|
|
||||||
|
|
|
@ -108,9 +108,8 @@ function checksum_all #alter_root
|
||||||
[[ ! -e $file ]] && \
|
[[ ! -e $file ]] && \
|
||||||
log_fail "$file missing after import."
|
log_fail "$file missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $file | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $file)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
(( id = id + 1 ))
|
(( id = id + 1 ))
|
||||||
done
|
done
|
||||||
|
@ -122,7 +121,7 @@ function checksum_all #alter_root
|
||||||
log_assert "Verify that 'zpool import -a' succeeds as root."
|
log_assert "Verify that 'zpool import -a' succeeds as root."
|
||||||
log_onexit cleanup_all
|
log_onexit cleanup_all
|
||||||
|
|
||||||
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
read -r checksum1 _ < <(cksum $MYTESTFILE)
|
||||||
number=1
|
number=1
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -111,7 +111,7 @@ log_assert "Verify that import could handle damaged or missing device."
|
||||||
CWD=$PWD
|
CWD=$PWD
|
||||||
cd $DEVICE_DIR || log_fail "Unable change directory to $DEVICE_DIR"
|
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 i=0
|
||||||
typeset -i j=0
|
typeset -i j=0
|
||||||
|
@ -199,10 +199,8 @@ while (( i < ${#vdevs[*]} )); do
|
||||||
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
||||||
log_fail "$basedir/$TESTFILE0 missing after import."
|
log_fail "$basedir/$TESTFILE0 missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
((j = j + 1))
|
((j = j + 1))
|
||||||
|
|
|
@ -97,9 +97,8 @@ function verify
|
||||||
[[ ! -e $mtpt/$file ]] && \
|
[[ ! -e $mtpt/$file ]] && \
|
||||||
log_fail "$mtpt/$file missing after import."
|
log_fail "$mtpt/$file missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $mymtpt/$file | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $mymtpt/$file)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -149,7 +148,7 @@ CWD=$PWD
|
||||||
log_must cd $DEVICE_DIR
|
log_must cd $DEVICE_DIR
|
||||||
log_must tar cf $DEVICE_DIR/$DEVICE_ARCHIVE ${DEVICE_FILE}*
|
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 i=0
|
||||||
typeset -i j=0
|
typeset -i j=0
|
||||||
|
|
|
@ -101,7 +101,7 @@ log_onexit cleanup
|
||||||
log_assert "Verify that an imported pool can be renamed."
|
log_assert "Verify that an imported pool can be renamed."
|
||||||
|
|
||||||
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
|
||||||
checksum1=$(sum $MYTESTFILE | awk '{print $1}')
|
read -r checksum1 _ < <(cksum $MYTESTFILE)
|
||||||
|
|
||||||
typeset -i i=0
|
typeset -i i=0
|
||||||
typeset -i j=0
|
typeset -i j=0
|
||||||
|
@ -140,9 +140,8 @@ while (( i < ${#pools[*]} )); do
|
||||||
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
[[ ! -e $basedir/$TESTFILE0 ]] && \
|
||||||
log_fail "$basedir/$TESTFILE0 missing after import."
|
log_fail "$basedir/$TESTFILE0 missing after import."
|
||||||
|
|
||||||
checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
|
read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
|
||||||
[[ "$checksum1" != "$checksum2" ]] && \
|
log_must [ "$checksum1" = "$checksum2" ]
|
||||||
log_fail "Checksums differ ($checksum1 != $checksum2)"
|
|
||||||
|
|
||||||
log_must zpool export "${pools[i]}-new"
|
log_must zpool export "${pools[i]}-new"
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,8 @@ export DISK_COUNT ZFS_DISK NONZFS_DISK SINGLE_DISK ZFSSIDE_DISK NONZFSSIDE_DISK
|
||||||
|
|
||||||
export TESTFILE=/etc/passwd
|
export TESTFILE=/etc/passwd
|
||||||
export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir
|
export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir
|
||||||
tmp=`sum $TESTFILE`
|
read -r SUMA SUMB _ < <(cksum $TESTFILE)
|
||||||
export SUMA=`echo $tmp | awk '{print $1}'`
|
export SUMA SUMB
|
||||||
export SUMB=`echo $tmp | awk '{print $2}'`
|
|
||||||
export FS_SIZE=1g
|
export FS_SIZE=1g
|
||||||
export BNAME=`basename $TESTFILE`
|
export BNAME=`basename $TESTFILE`
|
||||||
export DNAME=`dirname $TESTFILE`
|
export DNAME=`dirname $TESTFILE`
|
||||||
|
|
|
@ -99,9 +99,7 @@ function migrate #destdir oldsuma oldsumb cmd
|
||||||
$cmd
|
$cmd
|
||||||
(( $? != 0 )) && return 1
|
(( $? != 0 )) && return 1
|
||||||
|
|
||||||
sumy=`sum ./$BNAME`
|
read -r suma sumb _ < <(cksum ./$BNAME)
|
||||||
suma=`echo $sumy | awk '{print $1}'`
|
|
||||||
sumb=`echo $sumy | awk '{print $2}'`
|
|
||||||
|
|
||||||
if (( $oldsuma != $suma )); then
|
if (( $oldsuma != $suma )); then
|
||||||
log_note "sum values are not the same"
|
log_note "sum values are not the same"
|
||||||
|
@ -133,9 +131,7 @@ function migrate_cpio
|
||||||
cpio -iv < $archive
|
cpio -iv < $archive
|
||||||
(( $? != 0 )) && return 1
|
(( $? != 0 )) && return 1
|
||||||
|
|
||||||
sumy=`sum ./$BNAME`
|
read -r suma sumb _ < <(cksum ./$BNAME)
|
||||||
suma=`echo $sumy | awk '{print $1}'`
|
|
||||||
sumb=`echo $sumy | awk '{print $2}'`
|
|
||||||
|
|
||||||
if (( $oldsuma != $suma )); then
|
if (( $oldsuma != $suma )); then
|
||||||
log_note "sum values are not the same"
|
log_note "sum values are not the same"
|
||||||
|
|
Loading…
Reference in New Issue