diff mbox series

[PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG

Message ID 20200224180534.15279-1-marcos@mpdesouza.com (mailing list archive)
State New, archived
Headers show
Series [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG | expand

Commit Message

Marcos Paulo de Souza Feb. 24, 2020, 6:05 p.m. UTC
From: Marcos Paulo de Souza <mpdesouza@suse.com>

The truncate command can fail in some platforms like PPC32[1] because it
can't create files up to 6E in size. Skip the test if this was the
problem why truncate failed.

[1]: https://github.com/kdave/btrfs-progs/issues/192

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
Changes from v1:
* Only check if truncate failed with EFBIG instead of skipping the test on 32bit
  platforms (Suggested by Wenruo)

 tests/mkfs-tests/018-multidevice-overflow/test.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

David Sterba March 2, 2020, 8:07 p.m. UTC | #1
On Mon, Feb 24, 2020 at 03:05:34PM -0300, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> The truncate command can fail in some platforms like PPC32[1] because it
> can't create files up to 6E in size. Skip the test if this was the
> problem why truncate failed.
> 
> [1]: https://github.com/kdave/btrfs-progs/issues/192

Issue: #192

> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>

Added to devel, thanks.
Marcos Paulo de Souza March 2, 2020, 8:30 p.m. UTC | #2
On Mon, Mar 02, 2020 at 09:07:16PM +0100, David Sterba wrote:
> On Mon, Feb 24, 2020 at 03:05:34PM -0300, Marcos Paulo de Souza wrote:
> > From: Marcos Paulo de Souza <mpdesouza@suse.com>
> > 
> > The truncate command can fail in some platforms like PPC32[1] because it
> > can't create files up to 6E in size. Skip the test if this was the
> > problem why truncate failed.
> > 
> > [1]: https://github.com/kdave/btrfs-progs/issues/192
> 
> Issue: #192

David, can you please drop this patch and use the attached one instead? This one
has been tested by the user who reported the issue in bug 192.

Thanks,
  Marcos
> 
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> Added to devel, thanks.
David Sterba March 2, 2020, 8:36 p.m. UTC | #3
On Mon, Mar 02, 2020 at 05:30:06PM -0300, Marcos Paulo de Souza wrote:
> On Mon, Mar 02, 2020 at 09:07:16PM +0100, David Sterba wrote:
> > On Mon, Feb 24, 2020 at 03:05:34PM -0300, Marcos Paulo de Souza wrote:
> > > From: Marcos Paulo de Souza <mpdesouza@suse.com>
> > > 
> > > The truncate command can fail in some platforms like PPC32[1] because it
> > > can't create files up to 6E in size. Skip the test if this was the
> > > problem why truncate failed.
> > > 
> > > [1]: https://github.com/kdave/btrfs-progs/issues/192
> > 
> > Issue: #192
> 
> David, can you please drop this patch and use the attached one instead? This one
> has been tested by the user who reported the issue in bug 192.
> 
> Thanks,
>   Marcos
> > 
> > > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> > 
> > Added to devel, thanks.

> >From 52b96ac75c2f8876f1ed9424cef92a4557306009 Mon Sep 17 00:00:00 2001
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> Date: Sat, 15 Feb 2020 19:47:12 -0300
> Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failed with EFBIG
> 
> The truncate command can fail in some platform like PPC32[1] because it
> can't create files up to 6E in size. Skip the test if this was the
> problem why truncate failed.
> 
> [1]: https://github.com/kdave/btrfs-progs/issues/192
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> ---
>  tests/mkfs-tests/018-multidevice-overflow/test.sh | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/mkfs-tests/018-multidevice-overflow/test.sh b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> index 6c2f4dba..b8e2b18d 100755
> --- a/tests/mkfs-tests/018-multidevice-overflow/test.sh
> +++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> @@ -14,7 +14,17 @@ prepare_test_dev
>  run_check_mkfs_test_dev
>  run_check_mount_test_dev
>  
> -run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1"
> +# truncate can fail with EFBIG if the OS cannot created a 6E file
> +stdout=$($SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" 2>&1)

So this is reading and parsing stdout, but not using the standard
helpers that also log the commands. The stdout approach probably works
but I'd still like to avoid using plain $(...)

> +ret=$?
> +
> +if [ $ret -ne 0 ]; then
> +	if [[ "$stdout" == *"File too large"* ]]; then
> +		_not_run "Current kernel could not create a 6E file"
> +	fi
> +	_fail "Truncate command failed: $ret"
> +fi
> +
>  run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2"
>  run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img3"
>  
> -- 
> 2.25.0
>
Marcos Paulo de Souza March 6, 2020, 3:39 a.m. UTC | #4
On Mon, Mar 02, 2020 at 09:36:49PM +0100, David Sterba wrote:
> On Mon, Mar 02, 2020 at 05:30:06PM -0300, Marcos Paulo de Souza wrote:
>
> > >From 52b96ac75c2f8876f1ed9424cef92a4557306009 Mon Sep 17 00:00:00 2001
> > From: Marcos Paulo de Souza <mpdesouza@suse.com>
> > Date: Sat, 15 Feb 2020 19:47:12 -0300
> > Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failed with EFBIG
> > 
> > The truncate command can fail in some platform like PPC32[1] because it
> > can't create files up to 6E in size. Skip the test if this was the
> > problem why truncate failed.
> > 
> > [1]: https://github.com/kdave/btrfs-progs/issues/192
> > 
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> > ---
> >  tests/mkfs-tests/018-multidevice-overflow/test.sh | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/mkfs-tests/018-multidevice-overflow/test.sh b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > index 6c2f4dba..b8e2b18d 100755
> > --- a/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > +++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > @@ -14,7 +14,17 @@ prepare_test_dev
> >  run_check_mkfs_test_dev
> >  run_check_mount_test_dev
> >  
> > -run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1"
> > +# truncate can fail with EFBIG if the OS cannot created a 6E file
> > +stdout=$($SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" 2>&1)
> 
> So this is reading and parsing stdout, but not using the standard
> helpers that also log the commands. The stdout approach probably works
> but I'd still like to avoid using plain $(...)

What do you think about the patches bellow? With these two patches applied you
can drop this one. Thanks.
Marcos Paulo de Souza March 19, 2020, 3:03 p.m. UTC | #5
Humble ping :)

On Fri, 2020-03-06 at 00:39 -0300, Marcos Paulo de Souza wrote:
> On Mon, Mar 02, 2020 at 09:36:49PM +0100, David Sterba wrote:
> > On Mon, Mar 02, 2020 at 05:30:06PM -0300, Marcos Paulo de Souza
> wrote:
> >
> > > >From 52b96ac75c2f8876f1ed9424cef92a4557306009 Mon Sep 17
> 00:00:00 2001
> > > From: Marcos Paulo de Souza <mpdesouza@suse.com>
> > > Date: Sat, 15 Feb 2020 19:47:12 -0300
> > > Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failed
> with EFBIG
> > > 
> > > The truncate command can fail in some platform like PPC32[1]
> because it
> > > can't create files up to 6E in size. Skip the test if this was
> the
> > > problem why truncate failed.
> > > 
> > > [1]: https://github.com/kdave/btrfs-progs/issues/192
> > > 
> > > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> > > ---
> > >  tests/mkfs-tests/018-multidevice-overflow/test.sh | 12
> +++++++++++-
> > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tests/mkfs-tests/018-multidevice-overflow/test.sh
> b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > > index 6c2f4dba..b8e2b18d 100755
> > > --- a/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > > +++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh
> > > @@ -14,7 +14,17 @@ prepare_test_dev
> > >  run_check_mkfs_test_dev
> > >  run_check_mount_test_dev
> > >  
> > > -run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1"
> > > +# truncate can fail with EFBIG if the OS cannot created a 6E
> file
> > > +stdout=$($SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" 2>&1)
> > 
> > So this is reading and parsing stdout, but not using the standard
> > helpers that also log the commands. The stdout approach probably
> works
> > but I'd still like to avoid using plain $(...)
> 
> What do you think about the patches bellow? With these two patches
> applied you
> can drop this one. Thanks.
diff mbox series

Patch

diff --git a/tests/mkfs-tests/018-multidevice-overflow/test.sh b/tests/mkfs-tests/018-multidevice-overflow/test.sh
index 6c2f4dba..14ecbf89 100755
--- a/tests/mkfs-tests/018-multidevice-overflow/test.sh
+++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh
@@ -14,7 +14,15 @@  prepare_test_dev
 run_check_mkfs_test_dev
 run_check_mount_test_dev
 
-run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1"
+# truncate can fail with EFBIG if the OS cannot created a 6E file
+run_mayfail $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1"
+ret=$?
+if [ $ret == 27 ]; then
+	_not_run "Current kernel could not create a 6E file"
+fi
+
+[ $ret -gt 0 ] && _fail "Truncate command failed: $ret"
+
 run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2"
 run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img3"