All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
@ 2020-02-24 18:05 Marcos Paulo de Souza
  2020-03-02 20:07 ` David Sterba
  0 siblings, 1 reply; 6+ messages in thread
From: Marcos Paulo de Souza @ 2020-02-24 18:05 UTC (permalink / raw)
  To: dsterba, linux-btrfs, wqu; +Cc: Marcos Paulo de Souza

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(-)

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"
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
  2020-02-24 18:05 [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG Marcos Paulo de Souza
@ 2020-03-02 20:07 ` David Sterba
  2020-03-02 20:30   ` Marcos Paulo de Souza
  0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2020-03-02 20:07 UTC (permalink / raw)
  To: Marcos Paulo de Souza; +Cc: dsterba, linux-btrfs, wqu, Marcos Paulo de Souza

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
  2020-03-02 20:07 ` David Sterba
@ 2020-03-02 20:30   ` Marcos Paulo de Souza
  2020-03-02 20:36     ` David Sterba
  0 siblings, 1 reply; 6+ messages in thread
From: Marcos Paulo de Souza @ 2020-03-02 20:30 UTC (permalink / raw)
  To: dsterba, dsterba, linux-btrfs, wqu, Marcos Paulo de Souza

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

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.

[-- Attachment #2: 0001-progs-mkfs-tests-Skip-test-if-truncate-failed-with-E.patch --]
[-- Type: text/x-patch, Size: 1488 bytes --]

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)
+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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
  2020-03-02 20:30   ` Marcos Paulo de Souza
@ 2020-03-02 20:36     ` David Sterba
  2020-03-06  3:39       ` Marcos Paulo de Souza
  0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2020-03-02 20:36 UTC (permalink / raw)
  To: Marcos Paulo de Souza
  Cc: dsterba, dsterba, linux-btrfs, wqu, Marcos Paulo de Souza

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
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
  2020-03-02 20:36     ` David Sterba
@ 2020-03-06  3:39       ` Marcos Paulo de Souza
  2020-03-19 15:03         ` Marcos Paulo de Souza
  0 siblings, 1 reply; 6+ messages in thread
From: Marcos Paulo de Souza @ 2020-03-06  3:39 UTC (permalink / raw)
  To: dsterba, dsterba, linux-btrfs, wqu, Marcos Paulo de Souza

[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]

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.

[-- Attachment #2: 0001-btrfs-progs-tests-common-Introduce-run_mayfail_stdou.patch --]
[-- Type: text/x-patch, Size: 1667 bytes --]

From f54ec71fa4e6c4153a57d519b3524300946cd8b8 Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <mpdesouza@suse.com>
Date: Thu, 5 Mar 2020 23:57:52 -0300
Subject: [PATCH 1/2] btrfs-progs: tests: common: Introduce run_mayfail_stdout

This helper would help to run tests that can fail, but depending on the
output of the error we can skip the test instead of failing.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 tests/common | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/common b/tests/common
index f5efc58b..2f698e08 100644
--- a/tests/common
+++ b/tests/common
@@ -216,6 +216,37 @@ run_mayfail()
 	fi
 }
 
+# same as run_mayfail but prints the error message to stdout too
+run_mayfail_stdout()
+{
+	local spec
+	local ins
+	local ret
+
+	ins=$(_get_spec_ins "$@")
+	spec=$(($ins-1))
+	spec=$(_cmd_spec "${@:$spec}")
+	set -- "${@:1:$(($ins-1))}" $spec "${@: $ins}"
+	echo "====== RUN MAYFAIL $@" >> "$RESULTS" 2>&1
+	if [[ $TEST_LOG =~ tty ]]; then echo "CMD(mayfail): $@" > /dev/tty; fi
+
+	if [ "$1" = 'root_helper' ]; then
+		"$@" 2>&1 | tee -a "$RESULTS"
+	else
+		$INSTRUMENT "$@" 2>&1 | tee -a "$RESULTS"
+	fi
+	ret=${PIPESTATUS[0]}
+	if [ $ret != 0 ]; then
+		echo "failed (ignored, ret=$ret): $@" >> "$RESULTS"
+		if [ $ret == 139 ]; then
+			_fail "mayfail: returned code 139 (SEGFAULT), not ignored"
+		elif [ $ret == 134 ]; then
+			_fail "mayfail: returned code 134 (SIGABRT), not ignored"
+		fi
+		return $ret
+	fi
+}
+
 # first argument is error message to print if it fails, otherwise
 # same as run_check but expects the command to fail, output is logged
 run_mustfail()
-- 
2.25.0


[-- Attachment #3: 0002-progs-mkfs-tests-018-Skip-test-if-truncate-failed-wi.patch --]
[-- Type: text/x-patch, Size: 1538 bytes --]

From 085708404477cbb40d1c6b43f4a59d9611e5eddc 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 2/2] progs: mkfs-tests: 018: 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 | 13 ++++++++++++-
 1 file changed, 12 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..23c0b634 100755
--- a/tests/mkfs-tests/018-multidevice-overflow/test.sh
+++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh
@@ -14,7 +14,18 @@ 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=$(run_mayfail_stdout $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" 2>&1)
+ret=$?
+
+if [ $ret -ne 0 ]; then
+	run_check_umount_test_dev
+	if [[ $stdout == *"File too large"* ]]; then
+		_not_run "Current kernel could not create a 6E file"
+	fi
+	_fail "Command failed: $stdout"
+fi
+
 run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2"
 run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img3"
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG
  2020-03-06  3:39       ` Marcos Paulo de Souza
@ 2020-03-19 15:03         ` Marcos Paulo de Souza
  0 siblings, 0 replies; 6+ messages in thread
From: Marcos Paulo de Souza @ 2020-03-19 15:03 UTC (permalink / raw)
  To: dsterba, dsterba, linux-btrfs, wqu, Marcos Paulo de Souza

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-19 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 18:05 [PATCHv2] progs: mkfs-tests: Skip test if truncate failed with EFBIG Marcos Paulo de Souza
2020-03-02 20:07 ` David Sterba
2020-03-02 20:30   ` Marcos Paulo de Souza
2020-03-02 20:36     ` David Sterba
2020-03-06  3:39       ` Marcos Paulo de Souza
2020-03-19 15:03         ` Marcos Paulo de Souza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.