progs: mkfs-tests: Skip test if truncate failed with EFBIG
PATCH v2 1/1 progs: mkfs-tests: Skip test if truncate failed with EFBIG
From: Marcos Paulo de Souza <[email protected]>
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
---
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(-)
tests/mkfs-tests/018-multidevice-overflow/test.sh +9 -1
@@ -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"
Signature · 1 line
2.25.0
Quoted 7 lines · Marcos Paulo de Souza
From: Marcos Paulo de Souza <[email protected]>
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.
Issue: #192
Quoted 1 line
Signed-off-by Marcos Paulo de Souza <[email protected]>
Added to devel, thanks.
Quoted 10 lines · David Sterba
Quoted 7 lines · Marcos Paulo de Souza
From: Marcos Paulo de Souza <[email protected]>
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.
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
Quoted 4 lines
Quoted 2 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>Added to devel, thanks.
From 52b96ac75c2f8876f1ed9424cef92a4557306009 Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <[email protected]>
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
--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
tests/mkfs-tests/018-multidevice-overflow/test.sh +11 -1
@@ -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"
Signature · 1 line
2.25.0
Quoted 43 lines · Marcos Paulo de Souza
Quoted 10 lines · David Sterba
Quoted 7 lines · Marcos Paulo de Souza
From: Marcos Paulo de Souza <[email protected]>
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.
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,
MarcosQuoted 6 lines
Quoted 2 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>Added to devel, thanks.
From
52b96ac75c2f8876f1ed9424cef92a4557306009Mon Sep 17 00:00:00 2001From: Marcos Paulo de Souza <[email protected]>
Date: Sat, 15 Feb 2020 19:47:12 -0300
Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failed with EFBIGThe 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 <[email protected]>--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)tests/mkfs-tests/018-multidevice-overflow/test.sh +0
-0
tests/mkfs-tests/018-multidevice-overflow/test.sh prepare_test_dev · line 18
Quoted 6 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh +2
-1@@ -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 $(...)
Quoted 15 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh +9
-0+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"Signature · 1 line
2.25.0
Quoted 26 lines · David Sterba
Quoted 24 lines · Marcos Paulo de Souza
Quoted 1 line
From
52b96ac75c2f8876f1ed9424cef92a4557306009Mon Sep 17 00:00:00 2001From: Marcos Paulo de Souza <[email protected]>
Date: Sat, 15 Feb 2020 19:47:12 -0300
Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failed with EFBIGThe 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 <[email protected]>--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)tests/mkfs-tests/018-multidevice-overflow/test.sh +0
-0@@ -14,7 +14,17 @@ prepare_test_dev run_check_mkfs_test_dev run_check_mount_test_dev
Quoted 7 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh prepare_test_dev · line 18
Quoted 3 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh +2
-1-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.
From f54ec71fa4e6c4153a57d519b3524300946cd8b8 Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <[email protected]>
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.
--- tests/common | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
tests/common +31 -0
@@ -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()
Signature · 1 line
2.25.0
From 085708404477cbb40d1c6b43f4a59d9611e5eddc Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <[email protected]>
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
--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tests/mkfs-tests/018-multidevice-overflow/test.sh +12 -1
@@ -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"
Signature · 1 line
2.25.0
Humble ping :)
Quoted 47 lines · Marcos Paulo de Souza
Quoted 1 line · David Sterba
On Mon, Mar 02, 2020 at 05:30:06PM -0300, Marcos Paulo de Souza
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
From
52b96ac75c2f8876f1ed9424cef92a4557306009Mon Sep 1700:00:00 2001
Quoted 3 lines
Quoted 3 lines
From: Marcos Paulo de Souza <[email protected]>
Date: Sat, 15 Feb 2020 19:47:12 -0300
Subject: [PATCH] progs: mkfs-tests: Skip test if truncate failedwith EFBIG
Quoted 2 lines
Quoted 2 lines
The truncate command can fail in some platform like PPC32[1]
because it
Quoted 1 line
Quoted 1 line
can't create files up to 6E in size. Skip the test if this was
the
Quoted 7 lines
Quoted 7 lines
problem why truncate failed.
[1]: https://github.com/kdave/btrfs-progs/issues/192
Signed-off-by Marcos Paulo de Souza <[email protected]>--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 12+++++++++++-
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 11 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/tests/mkfs-tests/018-multidevice-overflow/test.shQuoted 9 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh prepare_test_dev · line 17
Quoted 9 lines
index
6c2f4dba..b8e2b18d100755tests/mkfs-tests/018-multidevice-overflow/test.sh +1
-1@@ -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 6Efile
Quoted 4 lines
tests/mkfs-tests/018-multidevice-overflow/test.sh prepare_test_dev · line 18
Quoted 1 line
tests/mkfs-tests/018-multidevice-overflow/test.sh +1
-0+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
Quoted 1 line
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.