mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
tests: snapshot_00[15]_pos: use cksum instead of sum -r
This only worked by accident on FreeBSD, where sum doesn't take flags POSIX guarantees us cksum (Ethernet CRC) ‒ use that instead 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
7aa7e6bd0a
commit
c2fcc55d97
@ -35,8 +35,8 @@
|
|||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# A zfs file system snapshot is identical to
|
# A zfs file system snapshot is identical to
|
||||||
# the originally snapshot'd file system, after the file
|
# the originally snapshotted file system, after the file
|
||||||
# system has been changed. Uses 'sum -r'.
|
# system has been changed. Uses 'cksum'.
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. Create a file in the zfs file system
|
# 1. Create a file in the zfs file system
|
||||||
@ -50,18 +50,11 @@ verify_runnable "both"
|
|||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
{
|
{
|
||||||
snapexists $SNAPFS
|
if snapexists $SNAPFS; then
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
log_must zfs destroy $SNAPFS
|
log_must zfs destroy $SNAPFS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $SNAPDIR ]]; then
|
log_must rm -rf $SNAPDIR $TESTDIR/* > /dev/null 2>&1
|
||||||
log_must rm -rf $SNAPDIR > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -e $TESTDIR ]]; then
|
|
||||||
log_must rm -rf $TESTDIR/* > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_assert "Verify a file system snapshot is identical to original."
|
log_assert "Verify a file system snapshot is identical to original."
|
||||||
@ -73,7 +66,7 @@ log_must file_write -o create -f $TESTDIR/$TESTFILE -b $BLOCKSZ \
|
|||||||
-c $NUM_WRITES -d $DATA
|
-c $NUM_WRITES -d $DATA
|
||||||
|
|
||||||
log_note "Sum the file, save for later comparison..."
|
log_note "Sum the file, save for later comparison..."
|
||||||
FILE_SUM=`sum -r $TESTDIR/$TESTFILE | awk '{ print $1 }'`
|
read -r FILE_SUM _ < <(cksum $TESTDIR/$TESTFILE)
|
||||||
log_note "FILE_SUM = $FILE_SUM"
|
log_note "FILE_SUM = $FILE_SUM"
|
||||||
|
|
||||||
log_note "Create a snapshot and mount it..."
|
log_note "Create a snapshot and mount it..."
|
||||||
@ -83,7 +76,7 @@ log_note "Append to the original file..."
|
|||||||
log_must file_write -o append -f $TESTDIR/$TESTFILE -b $BLOCKSZ \
|
log_must file_write -o append -f $TESTDIR/$TESTFILE -b $BLOCKSZ \
|
||||||
-c $NUM_WRITES -d $DATA
|
-c $NUM_WRITES -d $DATA
|
||||||
|
|
||||||
SNAP_FILE_SUM=`sum -r $SNAPDIR/$TESTFILE | awk '{ print $1 }'`
|
read -r SNAP_FILE_SUM _ < <(cksum $SNAPDIR/$TESTFILE)
|
||||||
if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
|
if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
|
||||||
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
|
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
|
||||||
fi
|
fi
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# to the originally snapshot'd file system, after the file
|
# to the originally snapshot'd file system, after the file
|
||||||
# system has been changed. Uses 'sum -r'.
|
# system has been changed. Uses 'cksum'.
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1) Create a file in the zfs dataset
|
# 1) Create a file in the zfs dataset
|
||||||
@ -72,7 +72,7 @@ log_must file_write -o create -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
|
|||||||
-c $NUM_WRITES -d $DATA
|
-c $NUM_WRITES -d $DATA
|
||||||
|
|
||||||
log_note "Sum the file, save for later comparison..."
|
log_note "Sum the file, save for later comparison..."
|
||||||
FILE_SUM=`sum -r $TESTDIR1/$TESTFILE | awk '{ print $1 }'`
|
read -r FILE_SUM _ < <(cksum $TESTDIR1/$TESTFILE)
|
||||||
log_note "FILE_SUM = $FILE_SUM"
|
log_note "FILE_SUM = $FILE_SUM"
|
||||||
|
|
||||||
log_note "Create a snapshot and mount it..."
|
log_note "Create a snapshot and mount it..."
|
||||||
@ -82,8 +82,8 @@ log_note "Append to the original file..."
|
|||||||
log_must file_write -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
|
log_must file_write -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
|
||||||
-c $NUM_WRITES -d $DATA
|
-c $NUM_WRITES -d $DATA
|
||||||
|
|
||||||
SNAP_FILE_SUM=`sum -r $SNAPDIR1/$TESTFILE | awk '{ print $1 }'`
|
read -r SNAP_FILE_SUM _ < <(cksum $SNAPDIR1/$TESTFILE)
|
||||||
if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
|
if [ $SNAP_FILE_SUM -ne $FILE_SUM ]; then
|
||||||
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
|
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user