mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR
As preparation step for configuring test/scratch base fs for overlay tests: - Rename OVERLAY_LOWER/UPPER/WORK_DIR => OVL_LOWER/UPPER/WORK because we want to use OVL_ prefix for all base fs vars - Prepend "ovl-" prefix to lower/upper/work path values to isolate the overlay test dirs when running on a base fs that is also used to run non overlay tests - Make those vars values non-configurable, because lower/upper/work directory names are an internal test detail which should not concern the user and because we wish to simplify and document the overlay tests setup - Add helper _filter_ovl_dirs and use it to filter output of test overlay/023 which matches the constant string "work" Signed-off-by: Amir Goldstein <amir73il@gmail.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
7626c85341
commit
6f5ba68b7b
+5
-3
@@ -77,9 +77,11 @@ export XFS_MKFS_OPTIONS=${XFS_MKFS_OPTIONS:=-bsize=4096}
|
||||
export TIME_FACTOR=${TIME_FACTOR:=1}
|
||||
export LOAD_FACTOR=${LOAD_FACTOR:=1}
|
||||
export DEBUGFS_MNT=${DEBUGFS_MNT:="/sys/kernel/debug"}
|
||||
export OVERLAY_UPPER_DIR=${OVERLAY_UPPER_DIR:="upper"}
|
||||
export OVERLAY_LOWER_DIR=${OVERLAY_LOWER_DIR:="lower"}
|
||||
export OVERLAY_WORK_DIR=${OVERLAY_WORK_DIR:="work"}
|
||||
|
||||
# some constants for overlayfs setup
|
||||
export OVL_UPPER="ovl-upper"
|
||||
export OVL_LOWER="ovl-lower"
|
||||
export OVL_WORK="ovl-work"
|
||||
|
||||
export PWD=`pwd`
|
||||
#export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
|
||||
|
||||
@@ -424,5 +424,12 @@ _filter_lostfound()
|
||||
sed -e '/^lost+found$/d'
|
||||
}
|
||||
|
||||
_filter_ovl_dirs()
|
||||
{
|
||||
sed -e "s,$OVL_LOWER,OVL_LOWER,g" \
|
||||
-e "s,$OVL_UPPER,OVL_UPPER,g" \
|
||||
-e "s,$OVL_WORK,OVL_WORK,g"
|
||||
}
|
||||
|
||||
# make sure this script returns success
|
||||
/bin/true
|
||||
|
||||
@@ -277,7 +277,7 @@ _common_dev_mount_options()
|
||||
|
||||
_overlay_basic_mount_options()
|
||||
{
|
||||
echo "-o lowerdir=$1/$OVERLAY_LOWER_DIR,upperdir=$1/$OVERLAY_UPPER_DIR,workdir=$1/$OVERLAY_WORK_DIR"
|
||||
echo "-o lowerdir=$1/$OVL_LOWER,upperdir=$1/$OVL_UPPER,workdir=$1/$OVL_WORK"
|
||||
}
|
||||
|
||||
_overlay_mount_options()
|
||||
@@ -336,6 +336,15 @@ _overlay_mount_dirs()
|
||||
-o workdir=$workdir $*
|
||||
}
|
||||
|
||||
_overlay_mkdirs()
|
||||
{
|
||||
local dir=$1
|
||||
|
||||
mkdir -p $dir/$OVL_UPPER
|
||||
mkdir -p $dir/$OVL_LOWER
|
||||
mkdir -p $dir/$OVL_WORK
|
||||
}
|
||||
|
||||
# Given a dir, set up 3 subdirectories and mount on the given mnt.
|
||||
# The dir is used as the mount device so it can be seen from df or mount
|
||||
_overlay_mount()
|
||||
@@ -346,12 +355,10 @@ _overlay_mount()
|
||||
|
||||
_supports_filetype $dir || _notrun "upper fs needs to support d_type"
|
||||
|
||||
mkdir -p $dir/$OVERLAY_UPPER_DIR
|
||||
mkdir -p $dir/$OVERLAY_LOWER_DIR
|
||||
mkdir -p $dir/$OVERLAY_WORK_DIR
|
||||
_overlay_mkdirs $dir
|
||||
|
||||
_overlay_mount_dirs $dir/$OVERLAY_LOWER_DIR $dir/$OVERLAY_UPPER_DIR \
|
||||
$dir/$OVERLAY_WORK_DIR $OVERLAY_MOUNT_OPTIONS \
|
||||
_overlay_mount_dirs $dir/$OVL_LOWER $dir/$OVL_UPPER \
|
||||
$dir/$OVL_WORK $OVERLAY_MOUNT_OPTIONS \
|
||||
$SELINUX_MOUNT_OPTIONS $* $dir $mnt
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ _scratch_mkfs
|
||||
_require_fs_space $SCRATCH_DEV $((4*1024*1024*2 + 8))
|
||||
|
||||
# Create test files with different sizes in lower dir
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
touch $lowerdir/zero_size
|
||||
$XFS_IO_PROG -fc "pwrite 0 4k" $lowerdir/less_than_4g >>$seqres.full
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ _require_scratch
|
||||
_scratch_mkfs
|
||||
|
||||
# Create our test file.
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
touch $lowerdir/foobar
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ _require_scratch
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test files dirs in lower dir
|
||||
lowerdir=${SCRATCH_DEV}/${OVERLAY_LOWER_DIR}
|
||||
lowerdir=${SCRATCH_DEV}/${OVL_LOWER}
|
||||
mkdir -p $lowerdir
|
||||
|
||||
touch ${lowerdir}/test_file
|
||||
|
||||
+2
-2
@@ -53,8 +53,8 @@ _require_user
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test file in lower dir
|
||||
lowerdir=${SCRATCH_DEV}/${OVERLAY_LOWER_DIR}
|
||||
upperdir=${SCRATCH_DEV}/${OVERLAY_UPPER_DIR}
|
||||
lowerdir=${SCRATCH_DEV}/${OVL_LOWER}
|
||||
upperdir=${SCRATCH_DEV}/${OVL_UPPER}
|
||||
mkdir -p $lowerdir
|
||||
touch ${lowerdir}/attr_file1
|
||||
chmod 000 ${lowerdir}/attr_file1
|
||||
|
||||
+5
-5
@@ -57,15 +57,15 @@ echo "Silence is golden"
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test file/dir before mount
|
||||
mkdir $SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
mkdir $SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
touch $SCRATCH_DEV/$OVERLAY_LOWER_DIR/lowertestfile
|
||||
mkdir $SCRATCH_DEV/$OVERLAY_UPPER_DIR/uppertestdir
|
||||
mkdir -p $SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $SCRATCH_DEV/$OVL_UPPER
|
||||
touch $SCRATCH_DEV/$OVL_LOWER/lowertestfile
|
||||
mkdir $SCRATCH_DEV/$OVL_UPPER/uppertestdir
|
||||
|
||||
_scratch_mount
|
||||
|
||||
# rename lowertestfile to uppertestdir, this triggers copyup and creates
|
||||
# whiteout in $OVERLAY_UPPER_DIR
|
||||
# whiteout in $OVL_UPPER
|
||||
mv $SCRATCH_MNT/lowertestfile $SCRATCH_MNT/uppertestdir
|
||||
# the lowertestfile can be removed
|
||||
rm $SCRATCH_MNT/uppertestdir/lowertestfile
|
||||
|
||||
+4
-4
@@ -56,14 +56,14 @@ _require_user
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test file on lower dir, and chown to fsgqa user
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
mkdir $lowerdir
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
touch $lowerdir/testfile
|
||||
chown fsgqa:fsgqa $lowerdir/testfile
|
||||
|
||||
# chown upperdir to fsgqa user, so new file/dir can be created by the user
|
||||
upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
mkdir $upperdir
|
||||
upperdir=$SCRATCH_DEV/$OVL_UPPER
|
||||
mkdir -p $upperdir
|
||||
chown fsgqa:fsgqa $upperdir
|
||||
|
||||
_scratch_mount
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ _require_scratch
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test file in lowerdir
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
touch $lowerdir/testfile
|
||||
|
||||
|
||||
+4
-4
@@ -55,10 +55,10 @@ _scratch_mkfs
|
||||
|
||||
# Need two lower dirs in this test, and we mount overlay ourselves,
|
||||
# create upper and workdir as well
|
||||
lowerdir1=$SCRATCH_DEV/$OVERLAY_LOWER_DIR.1
|
||||
lowerdir2=$SCRATCH_DEV/$OVERLAY_LOWER_DIR.2
|
||||
upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
workdir=$SCRATCH_DEV/$OVERLAY_WORK_DIR
|
||||
lowerdir1=$SCRATCH_DEV/$OVL_LOWER.1
|
||||
lowerdir2=$SCRATCH_DEV/$OVL_LOWER.2
|
||||
upperdir=$SCRATCH_DEV/$OVL_UPPER
|
||||
workdir=$SCRATCH_DEV/$OVL_WORK
|
||||
mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
|
||||
|
||||
# One lowerdir contains test dir and test files, the other contains whiteout
|
||||
|
||||
+2
-2
@@ -58,8 +58,8 @@ _require_attrs
|
||||
_scratch_mkfs
|
||||
|
||||
# Create test dir on upper and make it opaque by setting proper xattr
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
upperdir=$SCRATCH_DEV/$OVL_UPPER
|
||||
mkdir -p $lowerdir/testdir
|
||||
mkdir -p $upperdir/testdir
|
||||
$SETFATTR_PROG -n "trusted.overlay.opaque" -v "y" $upperdir/testdir
|
||||
|
||||
+2
-2
@@ -55,8 +55,8 @@ _require_scratch
|
||||
# remove all files from previous runs
|
||||
_scratch_mkfs
|
||||
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
upperdir=$SCRATCH_DEV/$OVL_UPPER
|
||||
mkdir -p $lowerdir/test
|
||||
|
||||
_scratch_mount
|
||||
|
||||
+2
-2
@@ -54,8 +54,8 @@ _require_test_program "t_truncate_self"
|
||||
_scratch_mkfs
|
||||
|
||||
# copy test program to lower and upper dir
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
upperdir=$SCRATCH_DEV/$OVL_UPPER
|
||||
mkdir -p $lowerdir
|
||||
mkdir -p $upperdir
|
||||
cp $here/src/t_truncate_self $lowerdir/test_lower
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ _scratch_mkfs
|
||||
umask 022
|
||||
|
||||
# Create test dir in lower dir and set sgid bit
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir/dir
|
||||
chown $qa_user:$qa_group $lowerdir/dir
|
||||
chmod 2775 $lowerdir/dir
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ rm -f $seqres.full
|
||||
_scratch_mkfs >>$seqres.full 2>&1
|
||||
|
||||
# Create our test files.
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
echo "This is old news" > $lowerdir/foo
|
||||
echo "This is old news" > $lowerdir/bar
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ _scratch_mkfs >>$seqres.full 2>&1
|
||||
# Not dealing with hardlinks here, because there is more to test
|
||||
# then stable inode number.
|
||||
# Hardlinks will get a test of their own.
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
mkdir $lowerdir/dir
|
||||
touch $lowerdir/file
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ rm -f $seqres.full
|
||||
_scratch_mkfs >>$seqres.full 2>&1
|
||||
|
||||
# Create 2 hardlinked files in lower
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
echo "patient zero" >> $lowerdir/foo
|
||||
ln $lowerdir/foo $lowerdir/bar
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ _require_scratch
|
||||
# Remove all files from previous tests
|
||||
_scratch_mkfs
|
||||
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir
|
||||
|
||||
_scratch_mount
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ _require_scratch
|
||||
# Remove all files from previous tests
|
||||
_scratch_mkfs
|
||||
|
||||
lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
|
||||
lowerdir=$SCRATCH_DEV/$OVL_LOWER
|
||||
mkdir -p $lowerdir/dir
|
||||
|
||||
_scratch_mount
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user