mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
7e98d41a6e
Refactor every test in the entire test suite to use the new boilerplate functions. This also migrates all the test group information into the test files. This patch has been autogenerated via the command: ./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
166 lines
5.9 KiB
Bash
Executable File
166 lines
5.9 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2014 Filipe Manana. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. btrfs/030
|
|
#
|
|
# Regression test for btrfs' incremental send feature:
|
|
#
|
|
# 1) Create several nested directories;
|
|
# 2) Create a read only snapshot;
|
|
# 3) Change the parentship of some of the deepest directories in a reverse
|
|
# way, so that parents become children and children become parents;
|
|
# 4) Create another read only snapshot and use it for an incremental send
|
|
# relative to the first snapshot.
|
|
#
|
|
# At step 4 btrfs' send entered an infinite loop, increasing the memory it
|
|
# used while building path strings until a krealloc was unable to allocate
|
|
# more memory, which caused a warning dump in dmesg.
|
|
#
|
|
. ./common/preamble
|
|
_begin_fstest auto quick send
|
|
|
|
tmp=`mktemp -d`
|
|
|
|
# Override the default cleanup function.
|
|
_cleanup()
|
|
{
|
|
rm -fr $tmp
|
|
}
|
|
|
|
# Import common functions.
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
_supported_fs btrfs
|
|
_require_scratch
|
|
_require_fssum
|
|
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
_scratch_mount
|
|
|
|
mkdir -p $SCRATCH_MNT/a/b/c
|
|
echo "hello" > $SCRATCH_MNT/a/b/c/file.txt
|
|
mkdir $SCRATCH_MNT/a/b/c/d
|
|
mkdir $SCRATCH_MNT/a/b/c2
|
|
mkdir $SCRATCH_MNT/a/b/www
|
|
echo "hey" > $SCRATCH_MNT/a/b/foobar.txt
|
|
mkdir -p $SCRATCH_MNT/a/b/c3/x/y
|
|
|
|
mkdir -p $SCRATCH_MNT/a/b/foo1/foo2
|
|
echo "hey" > $SCRATCH_MNT/a/b/foo1/foo2/f.txt
|
|
mkdir $SCRATCH_MNT/a/b/foo3
|
|
|
|
mkdir -p $SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4
|
|
echo "ola" > $SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4/hello.txt
|
|
|
|
# Directory tree looks like:
|
|
#
|
|
# . (ino 256)
|
|
# |-- a/ (ino 257)
|
|
# |-- b/ (ino 258)
|
|
# |-- c/ (ino 259)
|
|
# | |-- file.txt (ino 260)
|
|
# | |-- d/ (ino 261)
|
|
# |
|
|
# |-- c2/ (ino 262)
|
|
# |-- www/ (ino 263)
|
|
# |-- foobar.txt (ino 264)
|
|
# |
|
|
# |-- c3/ (ino 265)
|
|
# | |-- x/ (ino 266)
|
|
# | |-- y/ (ino 267)
|
|
# |
|
|
# |-- foo1/ (ino 268)
|
|
# | |---foo2/ (ino 269)
|
|
# | |---f.txt (ino 270)
|
|
# |
|
|
# |-- foo3/ (ino 271)
|
|
# |
|
|
# |-- bar1/ (ino 272)
|
|
# |-- bar2/ (ino 273)
|
|
# |-- bar3/ (ino 274)
|
|
# |-- bar4 (ino 275)
|
|
# |--hello.txt (ino 276)
|
|
|
|
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
|
|
|
|
echo " world" >> $SCRATCH_MNT/a/b/c/file.txt
|
|
mv $SCRATCH_MNT/a/b/c/d $SCRATCH_MNT/a/b/c2/d2
|
|
mv $SCRATCH_MNT/a/b/c $SCRATCH_MNT/a/b/c2/d2/cc
|
|
mv $SCRATCH_MNT/a/b/c3/x/y $SCRATCH_MNT/a/b/c2/y2
|
|
mv $SCRATCH_MNT/a/b/c3/x $SCRATCH_MNT/a/b/c2/y2/x2
|
|
mv $SCRATCH_MNT/a/b/c3 $SCRATCH_MNT/a/b/c2/y2/x2/Z
|
|
mv $SCRATCH_MNT/a/b/www $SCRATCH_MNT/a/b/c2/y2/x2/WWW
|
|
mv $SCRATCH_MNT/a/b/foobar.txt $SCRATCH_MNT/a/b/c2/y2/x2/qwerty.txt
|
|
ln $SCRATCH_MNT/a/b/c2/d2/cc/file.txt $SCRATCH_MNT/a/b/c2/y2/x2/Z/file_link.txt
|
|
mv $SCRATCH_MNT/a/b/c2/d2/cc/file.txt $SCRATCH_MNT/a/b/c2/y2/x2
|
|
|
|
mv $SCRATCH_MNT/a/b/foo3 $SCRATCH_MNT/a/b/foo1/foo33
|
|
mv $SCRATCH_MNT/a/b/foo1/foo2 $SCRATCH_MNT/a/b/foo1/foo33/foo22
|
|
mv $SCRATCH_MNT/a/b/foo1/foo33/foo22/f.txt \
|
|
$SCRATCH_MNT/a/b/foo1/foo33/foo22/fff.txt
|
|
|
|
echo " hello" >> $SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4/hello.txt
|
|
mv $SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4/hello.txt \
|
|
$SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4/hello2.txt
|
|
mv $SCRATCH_MNT/a/b/bar1/bar2/bar3/bar4 $SCRATCH_MNT/a/b/k44
|
|
mv $SCRATCH_MNT/a/b/bar1/bar2/bar3 $SCRATCH_MNT/a/b/k44
|
|
mv $SCRATCH_MNT/a/b/bar1/bar2 $SCRATCH_MNT/a/b/k44/bar3
|
|
mv $SCRATCH_MNT/a/b/bar1 $SCRATCH_MNT/a/b/k44/bar3/bar2/k11
|
|
|
|
# Directory tree now looks like:
|
|
#
|
|
# . (ino 256)
|
|
# |-- a/ (ino 257)
|
|
# |-- b/ (ino 258)
|
|
# |-- c2/ (ino 262)
|
|
# | |-- d2/ (ino 261)
|
|
# | | |-- cc/ (ino 259)
|
|
# | |
|
|
# | |-- y2/ (ino 267)
|
|
# | |-- x2/ (ino 266)
|
|
# | |-- file.txt (ino 260)
|
|
# | |-- qwerty.txt (ino 264)
|
|
# | |-- WWW/ (ino 263)
|
|
# | |-- Z/ (ino 265)
|
|
# | |-- file_link.txt
|
|
# |
|
|
# |-- foo1/ (ino 268)
|
|
# | |---foo33/ (ino 271)
|
|
# | |---foo22/ (ino 269)
|
|
# | |---fff.txt (ino 270)
|
|
# |
|
|
# |-- k44/ (ino 275)
|
|
# |-- hello2.txt (ino 276)
|
|
# |-- bar3/ (ino 274)
|
|
# |-- bar2/ (ino 273)
|
|
# |-- k11/ (ino 272)
|
|
|
|
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
|
|
|
|
run_check $FSSUM_PROG -A -f -w $tmp/1.fssum $SCRATCH_MNT/mysnap1
|
|
run_check $FSSUM_PROG -A -f -w $tmp/2.fssum -x $SCRATCH_MNT/mysnap2/mysnap1 \
|
|
$SCRATCH_MNT/mysnap2
|
|
|
|
_run_btrfs_util_prog send -f $tmp/1.snap $SCRATCH_MNT/mysnap1
|
|
_run_btrfs_util_prog send -f $tmp/2.snap -p $SCRATCH_MNT/mysnap1 \
|
|
$SCRATCH_MNT/mysnap2
|
|
|
|
_scratch_unmount
|
|
_check_btrfs_filesystem $SCRATCH_DEV
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
_scratch_mount
|
|
|
|
_run_btrfs_util_prog receive -f $tmp/1.snap $SCRATCH_MNT
|
|
run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
|
|
|
|
_run_btrfs_util_prog receive -f $tmp/2.snap $SCRATCH_MNT
|
|
run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
|
|
|
|
_scratch_unmount
|
|
_check_btrfs_filesystem $SCRATCH_DEV
|
|
|
|
status=0
|
|
exit
|