mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: create _require_test_program to look for programs in src/
Create a helper that looks for a test program in src/ and fails the test if it doesn't exist. Refactor the existing testcases to use it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
@@ -1684,6 +1684,15 @@ _require_aiodio()
|
|||||||
_require_odirect
|
_require_odirect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this test requires that a test program exists under src/
|
||||||
|
# $1 - command (require)
|
||||||
|
#
|
||||||
|
_require_test_program()
|
||||||
|
{
|
||||||
|
SRC_TEST=src/$1
|
||||||
|
[ -x $SRC_TEST ] || _notrun "$SRC_TEST not built"
|
||||||
|
}
|
||||||
|
|
||||||
# run an aio-dio program
|
# run an aio-dio program
|
||||||
# $1 - command
|
# $1 - command
|
||||||
_run_aiodio()
|
_run_aiodio()
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ _filter_dbtest()
|
|||||||
. ./common/rc
|
. ./common/rc
|
||||||
. ./common/filter
|
. ./common/filter
|
||||||
|
|
||||||
[ -x $here/src/dbtest ] || _notrun "dbtest was not built for this platform"
|
_require_test_program "dbtest"
|
||||||
|
|
||||||
# real QA test starts here
|
# real QA test starts here
|
||||||
_supported_fs generic
|
_supported_fs generic
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ _scratch_mount > /dev/null 2>&1
|
|||||||
rm -f $seqres.full
|
rm -f $seqres.full
|
||||||
fiemapfile=$SCRATCH_MNT/$seq.fiemap
|
fiemapfile=$SCRATCH_MNT/$seq.fiemap
|
||||||
|
|
||||||
[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
|
_require_test_program "fiemap-tester"
|
||||||
|
|
||||||
seed=`date +%s`
|
seed=`date +%s`
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ rm -f $seqres.full
|
|||||||
fiemapfile=$SCRATCH_MNT/$seq.fiemap
|
fiemapfile=$SCRATCH_MNT/$seq.fiemap
|
||||||
fiemaplog=$SCRATCH_MNT/$seq.log
|
fiemaplog=$SCRATCH_MNT/$seq.log
|
||||||
|
|
||||||
[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
|
_require_test_program "fiemap-tester"
|
||||||
|
|
||||||
seed=`date +%s`
|
seed=`date +%s`
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ _require_seek_data_hole
|
|||||||
|
|
||||||
BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
|
BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
|
||||||
|
|
||||||
[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
|
_require_test_program "seek_sanity_test"
|
||||||
|
|
||||||
# Disable extent zeroing for ext4 as that change where holes are created
|
# Disable extent zeroing for ext4 as that change where holes are created
|
||||||
if [ "$FSTYP" = "ext4" ]; then
|
if [ "$FSTYP" = "ext4" ]; then
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ _require_seek_data_hole
|
|||||||
src=$TEST_DIR/seek_copy_testfile
|
src=$TEST_DIR/seek_copy_testfile
|
||||||
dest=$TEST_DIR/seek_copy_testfile.dest
|
dest=$TEST_DIR/seek_copy_testfile.dest
|
||||||
|
|
||||||
[ -x $here/src/seek_copy_test ] || _notrun "seek_copy_test not built"
|
_require_test_program "seek_copy_test"
|
||||||
|
|
||||||
_cleanup()
|
_cleanup()
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ _require_metadata_journaling $SCRATCH_DEV
|
|||||||
# the test system supports fallocate() for allocation
|
# the test system supports fallocate() for allocation
|
||||||
_require_xfs_io_command "falloc"
|
_require_xfs_io_command "falloc"
|
||||||
|
|
||||||
[ -x $here/src/fsync-tester ] || _notrun "fsync-tester not built"
|
_require_test_program "fsync-tester"
|
||||||
|
|
||||||
rm -f $seqres.full
|
rm -f $seqres.full
|
||||||
SEED=1
|
SEED=1
|
||||||
|
|||||||
+1
-2
@@ -40,8 +40,7 @@ _supported_fs xfs
|
|||||||
_supported_os IRIX Linux
|
_supported_os IRIX Linux
|
||||||
|
|
||||||
_require_scratch
|
_require_scratch
|
||||||
|
_require_test_program "feature"
|
||||||
[ $here/src/feature ] || _notrun "src/feature not built, skipping this test"
|
|
||||||
|
|
||||||
[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
|
[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
|
||||||
[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
|
[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
|
||||||
|
|||||||
+1
-1
@@ -124,7 +124,7 @@ _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
|
|||||||
[ $lversion -ne 1 ] && \
|
[ $lversion -ne 1 ] && \
|
||||||
_notrun "Cannot run this test yet using MKFS_OPTIONS specified"
|
_notrun "Cannot run this test yet using MKFS_OPTIONS specified"
|
||||||
|
|
||||||
[ $here/src/loggen ] || _notrun "loggen not built, skipping test"
|
_require_test_program "loggen"
|
||||||
|
|
||||||
_check_mount
|
_check_mount
|
||||||
_check_require_logdev
|
_check_require_logdev
|
||||||
|
|||||||
Reference in New Issue
Block a user