The -v and -o short options in btrfs-corrupt-block were introduced and
replaced with the long options --value and --offset in the same
btrfs-progs release 5.19 by the following commits:
b2ada0594116 ("btrfs-progs: corrupt-block: corrupt generic item data")
22ffee3c6cf2 ("btrfs-progs: corrupt-block: use only long options for value and offset")
We hope that if these commits are backported, they are both backported at
the same time.
Use only the long options of btrfs-corrupt-block in the test cases. Also,
check if btrfs-corrupt-block has the options --value and --offset.
[zlang: use -w option for grep, and remove "ret" local value]
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
_require_btrfs_corrupt_block()
{
+ # An optional arg1 argument to also check the option.
+ local opt=$1
+
_require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block
+
+ if [ -z "$opt" ]; then
+ return
+ fi
+
+ $BTRFS_CORRUPT_BLOCK_PROG -h 2>&1 | grep -wq -- "--$opt"
+ if [ $? != 0 ]; then
+ _notrun "Require $BTRFS_CORRUPT_BLOCK_PROG option --$opt"
+ fi
}
_require_btrfs_send_version()