mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
overlay: run unionmount testsuite test cases
Add support for running unionmount-testsuite from xfstests. This requires that unionmount-testsuite is installed under src dir or that UNIONMOUNT_TESTSUITE variable points to the location of the testsuite. It also requires a recent version of unionmount-testsuite that supports setting basedir path via UNIONMOUNT_* environment variables. Add tests for three basic configurations: 1. overlay with upper/lower on same fs 2. overlay with upper/lower not on same fs without xino 3. overlay with upper/lower not on same fs with xino The samefs test uses scratch partition for lower/upper layers. The non samefs tests use the scratch partition for upper layer and the test partition for lower layer. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
04416cee21
commit
35c7a37928
@@ -50,3 +50,18 @@ In the example above, MOUNT_OPTIONS will be used to mount the base scratch fs,
|
||||
TEST_FS_MOUNT_OPTS will be used to mount the base test fs,
|
||||
OVERLAY_MOUNT_OPTIONS will be used to mount both test and scratch overlay and
|
||||
OVERLAY_FSCK_OPTIONS will be used to check both test and scratch overlay.
|
||||
|
||||
|
||||
Unionmount Testsuite
|
||||
====================
|
||||
|
||||
xfstests can be used as a test harness to run unionmount testsuite test cases
|
||||
and provide extended test coverage for overlayfs.
|
||||
|
||||
To enable running unionmount testsuite, clone the git repository from:
|
||||
https://github.com/amir73il/unionmount-testsuite.git
|
||||
under the xfstests src directory, or set the environment variable
|
||||
UNIONMOUNT_TESTSUITE to the local path where the repository was cloned.
|
||||
|
||||
Run './check -overlay -g overlay/union' to execute all the unionmount testsuite
|
||||
test cases.
|
||||
|
||||
@@ -71,6 +71,8 @@ export OVL_LOWER="ovl-lower"
|
||||
export OVL_WORK="ovl-work"
|
||||
# overlay mount point parent must be the base fs root
|
||||
export OVL_MNT="ovl-mnt"
|
||||
# By default unionmount-testsuite is expected under src
|
||||
export UNIONMOUNT_TESTSUITE=${UNIONMOUNT_TESTSUITE:=$here/src/unionmount-testsuite}
|
||||
|
||||
# From e2fsprogs/e2fsck/e2fsck.h:
|
||||
# Exit code used by fsck-type programs
|
||||
|
||||
@@ -363,3 +363,57 @@ _repair_overlay_scratch_fs()
|
||||
esac
|
||||
return $res
|
||||
}
|
||||
|
||||
# This test requires that unionmount testsuite is installed at
|
||||
# $UNIONMOUNT_TESTSUITE and that it supports configuring layers and overlay
|
||||
# mount paths via UNIONMOUNT_* environment variables.
|
||||
_require_unionmount_testsuite()
|
||||
{
|
||||
[ -x "$UNIONMOUNT_TESTSUITE/run" ] || \
|
||||
_notrun "unionmount testsuite required."
|
||||
|
||||
# Verify that UNIONMOUNT_* vars are supported
|
||||
local usage=`UNIONMOUNT_BASEDIR=_ "$UNIONMOUNT_TESTSUITE/run" 2>&1`
|
||||
echo $usage | grep -wq "UNIONMOUNT_BASEDIR" || \
|
||||
_notrun "newer version of unionmount testsuite required."
|
||||
}
|
||||
|
||||
_unionmount_testsuite_run()
|
||||
{
|
||||
[ "$FSTYP" = overlay ] || \
|
||||
_notrun "Filesystem $FSTYP not supported with unionmount testsuite."
|
||||
|
||||
# Provide the mounted base fs for upper and lower dirs and the
|
||||
# overlay mount point.
|
||||
# unionmount testsuite will perform the overlay mount.
|
||||
# test fs is used for lower layer in non-samefs runs.
|
||||
# scratch fs is used for upper layer in non-samefs runs and
|
||||
# for both layers in samefs runs.
|
||||
if (echo $* | grep -qv samefs) ; then
|
||||
_overlay_base_test_mount
|
||||
export UNIONMOUNT_LOWERDIR=$OVL_BASE_TEST_DIR/union
|
||||
fi
|
||||
export UNIONMOUNT_BASEDIR=$OVL_BASE_SCRATCH_MNT/union
|
||||
|
||||
_scratch_mkfs
|
||||
rm -rf $UNIONMOUNT_BASEDIR $UNIONMOUNT_LOWERDIR
|
||||
mkdir -p $UNIONMOUNT_BASEDIR $UNIONMOUNT_LOWERDIR
|
||||
|
||||
cd $UNIONMOUNT_TESTSUITE
|
||||
echo "run $* ..." > $seqres.full
|
||||
./run $* >> $seqres.full || \
|
||||
echo "unionmount testsuite failed! see $seqres.full for details."
|
||||
}
|
||||
|
||||
_unionmount_testsuite_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -f $tmp.*
|
||||
|
||||
[ -n "$UNIONMOUNT_BASEDIR" ] || return 0
|
||||
|
||||
# Cleanup overlay mount after unionmount testsuite run
|
||||
cd $UNIONMOUNT_TESTSUITE
|
||||
echo "run --clean-up ..." >> $seqres.full
|
||||
./run --clean-up >> $seqres.full 2>&1
|
||||
}
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#! /bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2020 CTERA Networks. All Rights Reserved.
|
||||
#
|
||||
# FS QA Test 100
|
||||
#
|
||||
# Run unionmount testsuite to verify correctness
|
||||
# with single lower layer on same fs as upper
|
||||
#
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "_unionmount_testsuite_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
|
||||
# remove previous $seqres.full before test
|
||||
rm -f $seqres.full
|
||||
|
||||
# real QA test starts here
|
||||
|
||||
_supported_fs overlay
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_unionmount_testsuite
|
||||
|
||||
_unionmount_testsuite_run --ov --samefs --verify
|
||||
|
||||
# success, all done
|
||||
echo "Silence is golden"
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,2 @@
|
||||
QA output created by 100
|
||||
Silence is golden
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#! /bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2020 CTERA Networks. All Rights Reserved.
|
||||
#
|
||||
# FS QA Test 101
|
||||
#
|
||||
# Run unionmount testsuite to verify correctness
|
||||
# with single lower layer not on same fs as upper
|
||||
#
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "_unionmount_testsuite_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
|
||||
# remove previous $seqres.full before test
|
||||
rm -f $seqres.full
|
||||
|
||||
# real QA test starts here
|
||||
|
||||
_supported_fs overlay
|
||||
_supported_os Linux
|
||||
_require_test
|
||||
_require_scratch
|
||||
_require_unionmount_testsuite
|
||||
|
||||
_unionmount_testsuite_run --ov --verify
|
||||
|
||||
# success, all done
|
||||
echo "Silence is golden"
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,2 @@
|
||||
QA output created by 101
|
||||
Silence is golden
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#! /bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2020 CTERA Networks. All Rights Reserved.
|
||||
#
|
||||
# FS QA Test 102
|
||||
#
|
||||
# Run unionmount testsuite to verify correctness
|
||||
# with single lower layer not on same fs as upper
|
||||
# with xino enabled
|
||||
#
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "_unionmount_testsuite_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
|
||||
# remove previous $seqres.full before test
|
||||
rm -f $seqres.full
|
||||
|
||||
# real QA test starts here
|
||||
|
||||
_supported_fs overlay
|
||||
_supported_os Linux
|
||||
_require_test
|
||||
_require_scratch
|
||||
_require_unionmount_testsuite
|
||||
|
||||
_unionmount_testsuite_run --ov --xino --verify
|
||||
|
||||
# success, all done
|
||||
echo "Silence is golden"
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,2 @@
|
||||
QA output created by 102
|
||||
Silence is golden
|
||||
@@ -77,3 +77,6 @@
|
||||
072 auto quick copyup hardlink
|
||||
073 auto quick whiteout
|
||||
074 auto quick exportfs dangerous
|
||||
100 auto quick union samefs
|
||||
101 auto quick union nonsamefs
|
||||
102 auto quick union nonsamefs xino
|
||||
|
||||
Reference in New Issue
Block a user