mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fstests: filter test and scratch together safely
Several tests uses both _filter_test_dir and _filter_scratch concatenated by pipe to filter $TEST_DIR and $SCRATCH_MNT. However, this would fail if the shorter string is a substring of the other (like "/mnt" and "/mnt2"). This patch introduces new common filter function to safely call both _filter_test_dir and _filter_scratch, and update tests and functions to use this new function. I checked this with btrfs/029, generic/409,410,411, and generic/381,383, xfs/106,108 (which calls _filter_quota). Thanks Eryu for advice. [eguan: folded 2nd patch into 1st patch and update commit log a bit] Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
0e641bc6eb
commit
948b1881f6
+3
-8
@@ -66,19 +66,14 @@ _scratch_mkfs > /dev/null 2>&1
|
||||
_scratch_mount
|
||||
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/original >> $seqres.full
|
||||
|
||||
_filter_testdirs()
|
||||
{
|
||||
_filter_test_dir | _filter_scratch
|
||||
}
|
||||
|
||||
_create_reflinks()
|
||||
{
|
||||
# auto reflink, should fall back to non-reflink
|
||||
rm -rf $2
|
||||
echo "reflink=auto:"
|
||||
cp --reflink=auto $1 $2
|
||||
md5sum $1 | _filter_testdirs
|
||||
md5sum $2 | _filter_testdirs
|
||||
md5sum $1 | _filter_testdir_and_scratch
|
||||
md5sum $2 | _filter_testdir_and_scratch
|
||||
|
||||
# always reflink, should fail outright
|
||||
rm -rf $2
|
||||
@@ -86,7 +81,7 @@ _create_reflinks()
|
||||
cp --reflink=always $1 $2 >> $seqres.full 2>&1 || echo "cp reflink failed"
|
||||
|
||||
# The failed target actually gets created by cp:
|
||||
ls $2 | _filter_testdirs
|
||||
ls $2 | _filter_testdir_and_scratch
|
||||
}
|
||||
|
||||
echo "test reflinks across different devices"
|
||||
|
||||
Reference in New Issue
Block a user