diff mbox series

[v2,01/12] btrfs-progs: fix running lowmem check tests

Message ID 45ba3fd15ba81f18136d9f6a7e10e7d6bc2422d5.1629322156.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: make check handle invalid bg items | expand

Commit Message

Josef Bacik Aug. 18, 2021, 9:33 p.m. UTC
When I added the invalid super image I saw that the lowmem tests were
passing, despite not having the detection code yet.  Turns out this is
because we weren't using a run command helper which does the proper
expansion and adds the --mode=lowmem option.  Fix this to use the proper
handler, and now the lowmem test fails properly without my patch to add
this support to the lowmem mode.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/common | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Qu Wenruo Aug. 19, 2021, 5:40 a.m. UTC | #1
On 2021/8/19 上午5:33, Josef Bacik wrote:
> When I added the invalid super image I saw that the lowmem tests were
> passing, despite not having the detection code yet.  Turns out this is
> because we weren't using a run command helper which does the proper
> expansion and adds the --mode=lowmem option.  Fix this to use the proper
> handler, and now the lowmem test fails properly without my patch to add
> this support to the lowmem mode.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   tests/common | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tests/common b/tests/common
> index 805a447c..5b255689 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -425,9 +425,8 @@ check_image()
>
>   	image=$1
>   	echo "testing image $(basename $image)" >> "$RESULTS"
> -	"$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1
> -	[ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
> -
> +	run_mustfail "btrfs check should have detected corruption" \
> +		"$TOP/btrfs" check "$image"
>   	run_check "$TOP/btrfs" check --repair --force "$image"
>   	run_check "$TOP/btrfs" check "$image"
>   }
>
David Sterba Aug. 23, 2021, 2:54 p.m. UTC | #2
On Wed, Aug 18, 2021 at 05:33:13PM -0400, Josef Bacik wrote:
> When I added the invalid super image I saw that the lowmem tests were
> passing, despite not having the detection code yet.  Turns out this is
> because we weren't using a run command helper which does the proper
> expansion and adds the --mode=lowmem option.  Fix this to use the proper
> handler, and now the lowmem test fails properly without my patch to add
> this support to the lowmem mode.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  tests/common | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/common b/tests/common
> index 805a447c..5b255689 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -425,9 +425,8 @@ check_image()
>  
>  	image=$1
>  	echo "testing image $(basename $image)" >> "$RESULTS"
> -	"$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1
> -	[ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
> -
> +	run_mustfail "btrfs check should have detected corruption" \
> +		"$TOP/btrfs" check "$image"

This seems correct but Qu sent a patch that processes the output looking
for some specific error messages so I've applied his version
("btrfs-progs: tests: also check subpage warning for check_image cases")

>  	run_check "$TOP/btrfs" check --repair --force "$image"
>  	run_check "$TOP/btrfs" check "$image"
>  }
> -- 
> 2.26.3
diff mbox series

Patch

diff --git a/tests/common b/tests/common
index 805a447c..5b255689 100644
--- a/tests/common
+++ b/tests/common
@@ -425,9 +425,8 @@  check_image()
 
 	image=$1
 	echo "testing image $(basename $image)" >> "$RESULTS"
-	"$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1
-	[ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
-
+	run_mustfail "btrfs check should have detected corruption" \
+		"$TOP/btrfs" check "$image"
 	run_check "$TOP/btrfs" check --repair --force "$image"
 	run_check "$TOP/btrfs" check "$image"
 }