common/f2fs: introduce _require_f2fs_io_command
PATCH 1/1 common/f2fs: introduce _require_f2fs_io_command
Update existing f2fs testcases to utilize the new _require_f2fs_io_command() helper for verifying required f2fs_io subcommands instead of basic executable checks or open coding.
Signed-off-by Chao Yu <[email protected]>
--- common/f2fs | 16 ++++++++++++++++ tests/f2fs/003 | 1 + tests/f2fs/004 | 1 + tests/f2fs/007 | 1 + tests/f2fs/009 | 1 + tests/f2fs/010 | 2 +- tests/f2fs/011 | 2 +- tests/f2fs/012 | 2 +- tests/f2fs/013 | 2 +- tests/f2fs/025 | 2 +- 10 files changed, 25 insertions(+), 5 deletions(-)
common/f2fs +16 -0
@@ -96,3 +96,19 @@ _require_inject_f2fs_command() $F2FS_INJECT_PROG "--$metaarea" "$val" "-h" | grep "$member:" > /dev/null || \ _notrun "--$metaarea --mb $member support is missing" } + +# Check that f2fs_io supports specific subcommand(s) +_require_f2fs_io_command() +{ + _require_command "$F2FS_IO_PROG" f2fs_io + + if [ -z "$1" ]; then + echo "Usage: _require_f2fs_io_command command..." 1>&2 + _exit 1 + fi + + for command in "$@"; do + $F2FS_IO_PROG help | awk '{print $1}' | grep -qw "$command" || \ + _notrun "f2fs_io $command support is missing" + done +}
tests/f2fs/003 +1 -0
@@ -30,6 +30,7 @@ _fixed_by_kernel_commit b40a2b003709 \ _require_scratch _require_xfs_io_command "fpunch" +_require_f2fs_io_command "write" "gc" _scratch_mkfs >> $seqres.full _scratch_mount >> $seqres.full
tests/f2fs/004 +1 -0
@@ -30,6 +30,7 @@ _fixed_by_kernel_commit b2c160f4f3cf \ _require_scratch _require_odirect +_require_f2fs_io_command "write" _scratch_mkfs >> $seqres.full _scratch_mount >> $seqres.full
tests/f2fs/007 +1 -0
@@ -15,6 +15,7 @@ _fixed_by_kernel_commit 26413ce18e85 \ "f2fs: compress: fix inconsistent update of i_blocks in release_compress_blocks and reserve_compress_blocks" _require_scratch +_require_f2fs_io_command "compress" "get_cblocks" "release_cblocks" "reserve_cblocks" "decompress" testfile_prefix=$SCRATCH_MNT/testfile fio_config=$tmp.fio
tests/f2fs/009 +1 -0
@@ -15,6 +15,7 @@ _require_scratch _require_scratch_shutdown _require_inject_f2fs_command node i_links _require_command "$(type -P socket)" socket +_require_f2fs_io_command "write" _fixed_by_git_commit f2fs-tools 958cd6e \ "fsck.f2fs: support to repair corrupted i_links"
tests/f2fs/010 +1 -1
@@ -30,7 +30,7 @@ _fixed_by_kernel_commit 03511e936916 \ "f2fs: fix inconsistent dirty state of atomic file" _require_scratch -_require_command "$F2FS_IO_PROG" f2fs_io +_require_f2fs_io_command "write" _scratch_mkfs >> $seqres.full _scratch_mount >> $seqres.full
tests/f2fs/011 +1 -1
@@ -27,7 +27,7 @@ _fixed_by_kernel_commit f7f8932ca6bb \ "f2fs: fix to avoid running out of free segments" _require_scratch -_require_command "$F2FS_IO_PROG" f2fs_io +_require_f2fs_io_command "pinfile" _scratch_mkfs_sized $((1*1024*1024*1024)) >> $seqres.full _scratch_mount -o checkpoint=disable:10%
tests/f2fs/012 +1 -1
@@ -19,7 +19,7 @@ _fixed_by_kernel_commit 91b587ba79e1 \ export LC_ALL=C.UTF-8 _require_scratch_nocheck -_require_command "$F2FS_IO_PROG" f2fs_io +_require_f2fs_io_command "setflags" _require_inject_f2fs_command dent d_hash #check whether f2fs supports "lookup_mode=x" mount option
tests/f2fs/013 +1 -1
@@ -19,7 +19,7 @@ . ./common/preamble _begin_fstest auto quick _require_kernel_config CONFIG_F2FS_FAULT_INJECTION -_require_command "$F2FS_IO_PROG" f2fs_io +_require_f2fs_io_command "write" "fsync" _cleanup() {
tests/f2fs/025 +1 -1
@@ -20,7 +20,7 @@ _require_scratch _require_scratch_shutdown _require_xfs_io_command "pwrite" _require_xfs_io_command "truncate" -_require_command "$F2FS_IO_PROG" f2fs_io +_require_f2fs_io_command gc_urgent _require_fs_sysfs_attr $TEST_DEV gc_urgent _require_check_dmesg
Signature · 1 line
2.49.0