diff mbox series

[1/5] common/verity: use the correct options for btrfs-corrupt-block

Message ID 0b2ef42d6fb3e3b6ebe91c84b9a5e698af13d80b.1710871719.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Btrfs fstests fixups and updates | expand

Commit Message

David Sterba March 19, 2024, 6:12 p.m. UTC
From: Josef Bacik <josef@toxicpanda.com>

A long time ago we changed the short options to long options in
btrfs-corrupt-block, so adjust the helper to use the correct options so
the verity tests pass properly.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 common/verity | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anand Jain March 20, 2024, 9:58 a.m. UTC | #1
On 3/19/24 23:42, David Sterba wrote:
> From: Josef Bacik <josef@toxicpanda.com>
> 
> A long time ago we changed the short options to long options in
> btrfs-corrupt-block, so adjust the helper to use the correct options so
> the verity tests pass properly.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   common/verity | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/verity b/common/verity
> index 03d175ce1b7a18..0e5f0d75e746a8 100644
> --- a/common/verity
> +++ b/common/verity
> @@ -402,7 +402,7 @@ _fsv_scratch_corrupt_merkle_tree()
>   			# in the default filesystem tree (-r 5) and corrupt one byte (-b 1) at
>   			# $offset (-o $offset) with the ascii representation of the byte we read
>   			# (-v $ascii)

> -			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 -v $ascii -o $offset -b 1 $SCRATCH_DEV
> +			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 --value $ascii --offset $offset -b 1 $SCRATCH_DEV


Can we still make it work with the older btrfs-corrupt-block?

How about..

corrupt_block_value_opt()
{
	$BTRFS_CORRUPT_BLOCK_PROG -h 2>&1 | grep -q -e "--value"
	if [ $? == 0 ]; then
		echo "--value"
	else
		echo "-v"
	fi
}

And to use,

$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 $(corrupt_block_value_opt) 
$ascii --offset $offset -b 1 $SCRATCH_DEV


I will make this change before submitting the PR if no objection.

Thanks, Anand

>   			(( offset += 1 ))
>   		done
>   		_scratch_mount
David Sterba March 20, 2024, 3:23 p.m. UTC | #2
On Wed, Mar 20, 2024 at 03:28:52PM +0530, Anand Jain wrote:
> On 3/19/24 23:42, David Sterba wrote:
> > From: Josef Bacik <josef@toxicpanda.com>
> > 
> > A long time ago we changed the short options to long options in
> > btrfs-corrupt-block, so adjust the helper to use the correct options so
> > the verity tests pass properly.
> > 
> > Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> > ---
> >   common/verity | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/common/verity b/common/verity
> > index 03d175ce1b7a18..0e5f0d75e746a8 100644
> > --- a/common/verity
> > +++ b/common/verity
> > @@ -402,7 +402,7 @@ _fsv_scratch_corrupt_merkle_tree()
> >   			# in the default filesystem tree (-r 5) and corrupt one byte (-b 1) at
> >   			# $offset (-o $offset) with the ascii representation of the byte we read
> >   			# (-v $ascii)
> 
> > -			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 -v $ascii -o $offset -b 1 $SCRATCH_DEV
> > +			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 --value $ascii --offset $offset -b 1 $SCRATCH_DEV
> 
> 
> Can we still make it work with the older btrfs-corrupt-block?
> 
> How about..
> 
> corrupt_block_value_opt()
> {
> 	$BTRFS_CORRUPT_BLOCK_PROG -h 2>&1 | grep -q -e "--value"
> 	if [ $? == 0 ]; then
> 		echo "--value"
> 	else
> 		echo "-v"
> 	fi
> }
> 
> And to use,
> 
> $BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 $(corrupt_block_value_opt) 
> $ascii --offset $offset -b 1 $SCRATCH_DEV
> 
> 
> I will make this change before submitting the PR if no objection.

Thanks, that would be great. The option changed in btrfs-progs 5.18
which is still relatively recent so both options should be supported.
Anand Jain March 24, 2024, 7:56 a.m. UTC | #3
On 3/20/24 20:53, David Sterba wrote:
> On Wed, Mar 20, 2024 at 03:28:52PM +0530, Anand Jain wrote:
>> On 3/19/24 23:42, David Sterba wrote:
>>> From: Josef Bacik <josef@toxicpanda.com>
>>>
>>> A long time ago we changed the short options to long options in
>>> btrfs-corrupt-block, so adjust the helper to use the correct options so
>>> the verity tests pass properly.
>>>
>>> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>>> ---
>>>    common/verity | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/common/verity b/common/verity
>>> index 03d175ce1b7a18..0e5f0d75e746a8 100644
>>> --- a/common/verity
>>> +++ b/common/verity
>>> @@ -402,7 +402,7 @@ _fsv_scratch_corrupt_merkle_tree()
>>>    			# in the default filesystem tree (-r 5) and corrupt one byte (-b 1) at
>>>    			# $offset (-o $offset) with the ascii representation of the byte we read
>>>    			# (-v $ascii)
>>
>>> -			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 -v $ascii -o $offset -b 1 $SCRATCH_DEV
>>> +			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 --value $ascii --offset $offset -b 1 $SCRATCH_DEV
>>
>>
>> Can we still make it work with the older btrfs-corrupt-block?
>>
>> How about..
>>
>> corrupt_block_value_opt()
>> {
>> 	$BTRFS_CORRUPT_BLOCK_PROG -h 2>&1 | grep -q -e "--value"
>> 	if [ $? == 0 ]; then
>> 		echo "--value"
>> 	else
>> 		echo "-v"
>> 	fi
>> }
>>
>> And to use,
>>
>> $BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 $(corrupt_block_value_opt)
>> $ascii --offset $offset -b 1 $SCRATCH_DEV
>>
>>
>> I will make this change before submitting the PR if no objection.
> 
> Thanks, that would be great. The option changed in btrfs-progs 5.18
> which is still relatively recent so both options should be supported.


This patch has been replaced, [1], is for review comments.

[1] 
https://lore.kernel.org/fstests/cover.1711097698.git.anand.jain@oracle.com/

Thanks, Anand
diff mbox series

Patch

diff --git a/common/verity b/common/verity
index 03d175ce1b7a18..0e5f0d75e746a8 100644
--- a/common/verity
+++ b/common/verity
@@ -402,7 +402,7 @@  _fsv_scratch_corrupt_merkle_tree()
 			# in the default filesystem tree (-r 5) and corrupt one byte (-b 1) at
 			# $offset (-o $offset) with the ascii representation of the byte we read
 			# (-v $ascii)
-			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 -v $ascii -o $offset -b 1 $SCRATCH_DEV
+			$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 --value $ascii --offset $offset -b 1 $SCRATCH_DEV
 			(( offset += 1 ))
 		done
 		_scratch_mount