Files
apfstests/tests/generic/425
T
Kent Overstreet 986733634c fstests: initial bcachefs support
To get started, you'll need to get bcachefs from the kernel repository
  https://evilpiepirate.org/git/bcachefs.git/

and tools from
  https://evilpiepirate.org/git/bcache-tools.git/

Build kernel as normal, enabling CONFIG_BCACHEFS_FS (and probably
CONFIG_BCACHEFS_DEBUG), and build and install tools. Then running
fstests is exactly the same as other local filesystems - just set
FSTYP=bcachefs

Also see https://evilpiepirate.org/git/ktest.git/ for a tool for
conveniently building kernel and running fstests inside a qemu VM.

This patch also updates generic/441 to run the more thorough test on
bcachefs, and generic/425 to not run on bcachefs (since bcachefs does
not store xattrs in blocks)

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-05-30 21:16:10 +08:00

80 lines
1.8 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# FS QA Test No. 425
#
# Check that FIEMAP produces some output when we require an external
# block to hold extended attributes.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
wait
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/attr
# real QA test starts here
_supported_fs generic
[ $FSTYP = bcachefs ] && _notrun "bcachefs does not store xattrs in blocks"
_require_scratch
_require_attrs
_require_xfs_io_command "fiemap" "-a"
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq
mkdir $testdir
echo "Create the original files"
testfile=$testdir/attrfile
touch $testfile
blk_sz=$(_get_file_block_size $SCRATCH_MNT)
# Assume each attr eats at least 20 bytes. Try to fill 2 fs blocks.
max_attrs=$((2 * blk_sz / 20))
i=0
while [ $i -lt $max_attrs ]; do
n="$(printf "%010d" $i)"
$SETFATTR_PROG -n "user.$n" -v "$n" $testfile > $seqres.full 2>&1 || break
i=$((i + 1))
done
sync
echo "Check attr extent counts"
f1=$(_count_attr_extents $testfile)
echo "$f1 xattr extents" >> $seqres.full
$XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
test $f1 -gt 0 || echo "Expected at least one xattr extent."
_scratch_cycle_mount
echo "Check attr extent counts after remount"
f1=$(_count_attr_extents $testfile)
echo "$f1 xattr extents" >> $seqres.full
$XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
test $f1 -gt 0 || echo "Expected at least one xattr extent."
# success, all done
status=0
exit