btrfs-progs: mkfs-test: Fix check for truncate command failing
PATCH 1/1 btrfs-progs: mkfs-test: Fix check for truncate command failing
From: Marcos Paulo de Souza <[email protected]>
Commit 31f477ee ("btrfs-progs: mkfs-tests: skip test if truncate fails with EFBIG") tried to detect a failure in truncate command by checking the $? expecting it to be an errno, when it actually returns 0 or 1.
To fix this test just check if the command failed (returned 1) and look for the output, skipping the test if the OS cannot create a 6E file.
--- tests/mkfs-tests/018-multidevice-overflow/test.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tests/mkfs-tests/018-multidevice-overflow/test.sh +7 -6
@@ -15,14 +15,15 @@ run_check_mkfs_test_dev run_check_mount_test_dev # truncate can fail with EFBIG if the OS cannot create a 6EiB file -run_mayfail $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" +out=$(run_mayfail_stdout $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" 2>&1) ret=$? -if [ $ret == 27 ]; then - _not_run "Current kernel could not create a 6E file" -fi -if [ $ret -gt 0 ]; then - _fail "truncate -s 6E failed: $ret" +if [ $ret -ne 0 ]; then + run_check_umount_test_dev + if [[ "$out" == *"File too large"* ]]; then + _not_run "Current kernel could not create a 6E file" + fi + _fail "Command failed: $out" fi run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2"
Signature · 1 line
2.25.1
Quoted 6 lines · Marcos Paulo de Souza
From: Marcos Paulo de Souza <[email protected]>
Commit
31f477ee("btrfs-progs: mkfs-tests: skip test if truncate fails with EFBIG") tried to detect a failure in truncate command by checking the $? expecting it to be an errno, when it actually returns 0 or 1.
Quoted 7 lines
To fix this test just check if the command failed (returned 1) and look for the output, skipping the test if the OS cannot create a 6E file.
Fixes #241Tested-by Erhard Furtner <[email protected]>Signed-off-by Marcos Paulo de Souza <[email protected]>
Added to devel, thanks.