svn commit: r322068 - projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror
Alan Somers
asomers at FreeBSD.org
Fri Aug 4 22:40:27 UTC 2017
Author: asomers
Date: Fri Aug 4 22:40:26 2017
New Revision: 322068
URL: https://svnweb.freebsd.org/changeset/base/322068
Log:
Fix multiple issues in scrub_mirror:scrub_mirror_003_pos.
This test has never worked correctly.
tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib
* Fix usage of fill_fs. The arguments were passed in the wrong
order, resulting in writes with absurdly low block sizes, causing
the test to time out.
* Look for the files in the correct location. fill_fs creates its
files subdirectories, not directly in the directory passed as the
first argument.
* Don't bother to checksum nonexistent files
* Remove an extraneous umount command
* Remove some kshisms
tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg
Define TESTFILE
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg Fri Aug 4 22:35:05 2017 (r322067)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg Fri Aug 4 22:40:26 2017 (r322068)
@@ -51,3 +51,4 @@ export MIRROR_MEGS=70
export MIRROR_SIZE=${MIRROR_MEGS}m # default mirror size
export BLOCKSZ=$(( 64 * 1024 ))
export WRITE_COUNT=$(( MIRROR_MEGS * 1024 * 1024 / BLOCKSZ ))
+export TESTFILE=testfile${TESTCASE_ID}
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib Fri Aug 4 22:35:05 2017 (r322067)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib Fri Aug 4 22:40:26 2017 (r322068)
@@ -37,14 +37,15 @@ function overwrite_verify_mirror
set -A cksums
set -A newcksums
- fill_fs $TESTDIR $FILE_COUNT $BLOCKSZ $WRITE_COUNT
- while (( atfile < FILE_COUNT )); do
- cksums[$atfile]=$($CKSUM ${TESTDIR}/${TESTFILE}.${i})
- (( atfile = atfile + 1 ))
+ fill_fs $TESTDIR -1 $FILE_COUNT $BLOCKSZ $WRITE_COUNT
+ while [ "$atfile" -lt "$FILE_COUNT" ]; do
+ if [ -f ${TESTDIR}/0/${TESTFILE}.${atfile} ]; then
+ cksums[$atfile]=$($CKSUM ${TESTDIR}/0/${TESTFILE}.${atfile})
+ fi
+ (( atfile = $atfile + 1 ))
done
# unmount and export before dd
- log_must $UMOUNT $TESTDIR
log_must $ZPOOL export $POOL
# dd the affected side of the mirror
@@ -58,19 +59,21 @@ function overwrite_verify_mirror
atfile=0
typeset -i failedcount=0
- while (( atfile < FILE_COUNT )); do
- newcksum=$($CKSUM $TESTDIR/${TESTFILE}.${i})
- if [[ $newcksum != ${cksums[$atfile]} ]]; then
- (( failedcount = failedcount + 1 ))
- else
- log_note "${TESTFILE}.${i} checksums match:"\
- "old ${cksums[$atfile]} new $newcksum"
+ while [ "$atfile" -lt "$FILE_COUNT" ]; do
+ if [ -f ${TESTDIR}/0/${TESTFILE}.${atfile} ]; then
+ newcksum=$($CKSUM $TESTDIR/0/${TESTFILE}.${atfile})
+ if [[ $newcksum != ${cksums[$atfile]} ]]; then
+ (( failedcount = $failedcount + 1 ))
+ else
+ log_note "${TESTFILE}.${atfile} checksums match:"\
+ "old ${cksums[$atfile]} new $newcksum"
+ fi
+ $RM -f ${files[$atfile]}
fi
- $RM -f ${files[$atfile]}
- (( atfile = atfile + 1 ))
+ (( atfile = $atfile + 1 ))
done
- if (( $failedcount > 0 )); then
+ if [ "$failedcount" -gt 0 ]; then
log_fail "of the $FILE_COUNT files $failedcount did not " \
"have the same checksum before and after."
fi
More information about the svn-src-projects
mailing list