]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
populate: fix some silly errors when modifying a fs while fuzzing
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 21 Jan 2017 08:10:44 +0000 (00:10 -0800)
committerEryu Guan <eguan@redhat.com>
Tue, 24 Jan 2017 10:23:48 +0000 (18:23 +0800)
There were some silly errors in _scratch_fuzz_modify such that it
wasn't really doing much of anything because of undefined variables.
(Sloppy refactoring when converting xfsfuzz.sh into xfstests.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/populate

index 23a8ffde2a6a2d78b2ffc865ae66b4c425b68d0e..1afab469aa2573108f1f0a8c005ea21f2680c16f 100644 (file)
@@ -596,7 +596,7 @@ _scratch_populate() {
                _scratch_xfs_populate
                _scratch_xfs_populate_check
                ;;
-       "ext4")
+       "ext2"|"ext3"|"ext4")
                _scratch_ext4_populate
                _scratch_ext4_populate_check
                ;;
@@ -612,22 +612,24 @@ _scratch_fuzz_modify() {
 
        test -z "${nr}" && nr=50000
        echo "+++ touch ${nr} files"
-       $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${BLK_SZ}" "/tmp/afile" > /dev/null
+       blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT})
+       $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null
        date="$(date)"
        find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do
                setfattr -n "user.date" -v "${date}" "$f"
                cat "/tmp/afile" >> "$f"
                mv "$f" "$f.longer"
        done
+       sync
        rm -rf "/tmp/afile"
 
        echo "+++ create files"
-       cp -pRdu "${SRCDIR}" "${SCRATCH_MNT}/test.moo"
+       mkdir -p "${SCRATCH_MNT}/test.moo"
+       $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk"
        sync
 
        echo "+++ remove files"
        rm -rf "${SCRATCH_MNT}/test.moo"
-       rm -rf "${SCRATCH_MNT}/test.1"
 }
 
 # Try to access files after fuzzing