overlayfs: rudimentary test support

Adding basic overlayfs support to fstests, it doesn't test anything
overlayfs specific, but runs existing tests on top of overlayfs. It's
following the path from Eric's patchset and Zab's review back in Mar.

A new fstype "overlay" is added, and TEST_DEV/SCRATCH_DEV are required
to be fs paths, and overlayfs is mounted at TEST_DIR/SCRATCH_MNT, so
tests can be run there.

To test overlayfs, setup config as something like the following

TEST_DEV=/mnt/ovl/test
TEST_DIR=/mnt/testarea/test
SCRATCH_DEV=/mnt/ovl/scratch
SCRATCH_MNT=/mnt/testarea/scratch

then run

./check -overlay -g auto

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Eryu Guan
2015-12-21 18:07:47 +11:00
committed by Dave Chinner
parent 27d077ec0b
commit ed5d3c7166
3 changed files with 155 additions and 34 deletions
+12 -2
View File
@@ -246,6 +246,7 @@ case "$HOSTOS" in
export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
export MKFS_NFS_PROG="false"
export MKFS_CIFS_PROG="false"
export MKFS_OVERLAY_PROG="false"
export MKFS_REISER4_PROG="`set_prog_path mkfs.reiser4`"
;;
esac
@@ -284,6 +285,9 @@ _mount_opts()
cifs)
export MOUNT_OPTIONS=$CIFS_MOUNT_OPTIONS
;;
overlay)
export MOUNT_OPTIONS=$OVERLAY_MOUNT_OPTIONS
;;
ext2|ext3|ext4|ext4dev)
# acls & xattrs aren't turned on by default on ext$FOO
export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
@@ -488,9 +492,12 @@ get_next_config() {
fi
echo $TEST_DEV | grep -qE ":|//" > /dev/null 2>&1
if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
if [ ! -b "$TEST_DEV" -a "$?" != "0" -a "$FSTYP" != "overlay" ]; then
echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a network filesystem"
exit 1
elif [ "$FSTYP" == "overlay" -a ! -d "$TEST_DEV" ]; then
echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a directory for overlay"
exit 1
fi
if [ ! -d "$TEST_DIR" ]; then
@@ -511,9 +518,12 @@ get_next_config() {
fi
echo $SCRATCH_DEV | grep -qE ":|//" > /dev/null 2>&1
if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" -a "$FSTYP" != "overlay" ]; then
echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a network filesystem"
exit 1
elif [ ! -z "$SCRATCH_DEV" -a "$FSTYP" == "overlay" -a ! -d "$SCRATCH_DEV" ]; then
echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a directory for overlay"
exit 1
fi
if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then