mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfs/001: update to handle v5 filesystems
xfs/001 fuzzes various extent fields using xfs_db. There's nothing in it that's specific to v4 filesystems, so upgrade the test to be able to handle v5 filesystems. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
beae6dead9
commit
75337edb8c
+15
@@ -774,3 +774,18 @@ _scratch_get_sfdir_prefix() {
|
||||
_scratch_xfs_db -c "inode ${dir_ino}" -c 'p' >> $seqres.full
|
||||
return 1
|
||||
}
|
||||
|
||||
_scratch_get_bmx_prefix() {
|
||||
local ino="$1"
|
||||
|
||||
for prefix in "u3.bmx" "u.bmx"; do
|
||||
if [ -n "$(_scratch_xfs_get_metadata_field \
|
||||
"${prefix}[0].startblock" \
|
||||
"inode ${ino}")" ]; then
|
||||
echo "${prefix}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
_scratch_xfs_db -c "inode ${ino}" -c 'p' >> $seqres.full
|
||||
return 1
|
||||
}
|
||||
|
||||
+12
-6
@@ -49,9 +49,8 @@ _do_bit_test()
|
||||
_supported_fs xfs
|
||||
_supported_os Linux
|
||||
_require_scratch_nocheck
|
||||
_require_xfs_mkfs_crc
|
||||
|
||||
_scratch_mkfs -m crc=0 >/dev/null 2>&1
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_mount
|
||||
|
||||
# create the test file
|
||||
@@ -68,11 +67,18 @@ BMBT_STARTOFF_BITLEN=54
|
||||
BMBT_STARTBLOCK_BITLEN=52
|
||||
BMBT_BLOCKCOUNT_BITLEN=21
|
||||
|
||||
prefix=$(_scratch_get_bmx_prefix $FILE_INO)
|
||||
test -n "$prefix" || _fail "could not find bmx prefix from inode $FILE_INO"
|
||||
|
||||
filter_output() {
|
||||
sed -e "s/${prefix}/u.bmx/g"
|
||||
}
|
||||
|
||||
# test setting the BMBT entries from 0 to past the valid number.
|
||||
_do_bit_test "u.bmx[0].extentflag" $BMBT_EXNTFLAG_BITLEN
|
||||
_do_bit_test "u.bmx[0].startoff" $BMBT_STARTOFF_BITLEN
|
||||
_do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
|
||||
_do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
|
||||
_do_bit_test "${prefix}[0].extentflag" $BMBT_EXNTFLAG_BITLEN | filter_output
|
||||
_do_bit_test "${prefix}[0].startoff" $BMBT_STARTOFF_BITLEN | filter_output
|
||||
_do_bit_test "${prefix}[0].startblock" $BMBT_STARTBLOCK_BITLEN | filter_output
|
||||
_do_bit_test "${prefix}[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN | filter_output
|
||||
# test setting the 32 bit generation number
|
||||
_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0x5a"
|
||||
_scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0xa5"
|
||||
|
||||
Reference in New Issue
Block a user