diff mbox

[1/3] btrfs-progs: test: umount if confirmation failed

Message ID 1449207447-1203-2-git-send-email-naota@elisp.net (mailing list archive)
State New, archived
Headers show

Commit Message

Naohiro Aota Dec. 4, 2015, 5:37 a.m. UTC
When a check in check_inode() failed, the test should umount test target
file system. This commit add clean up umount line in failure path.

Signed-off-by: Naohiro Aota <naota@elisp.net>
---
 tests/fsck-tests/012-leaf-corruption/test.sh | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Sterba Dec. 7, 2015, 3:33 p.m. UTC | #1
On Fri, Dec 04, 2015 at 02:37:25PM +0900, Naohiro Aota wrote:
> When a check in check_inode() failed, the test should umount test target
> file system. This commit add clean up umount line in failure path.

The lack of cleanup after failed tests is intentional (exceptions
possible). The tests are supposed to do cleanup if they pass but if they
fail the test environment could be examined. In case of more complex
setups (loop devices, dm devices) it's some work to set it up again.

We could add an optional per-test script cleanup.sh that does the
cleanup on demand (and is also run from tests/clean-tests.sh).
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Naohiro Aota Dec. 8, 2015, 2:18 a.m. UTC | #2
On Tue, Dec 8, 2015 at 12:33 AM, David Sterba <dsterba@suse.cz> wrote:
> On Fri, Dec 04, 2015 at 02:37:25PM +0900, Naohiro Aota wrote:
>> When a check in check_inode() failed, the test should umount test target
>> file system. This commit add clean up umount line in failure path.
>
> The lack of cleanup after failed tests is intentional (exceptions
> possible). The tests are supposed to do cleanup if they pass but if they
> fail the test environment could be examined. In case of more complex
> setups (loop devices, dm devices) it's some work to set it up again.
>
> We could add an optional per-test script cleanup.sh that does the
> cleanup on demand (and is also run from tests/clean-tests.sh).

I see.
Well, I overlooked the README.md stating about clean-tests.sh...
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/fsck-tests/012-leaf-corruption/test.sh b/tests/fsck-tests/012-leaf-corruption/test.sh
index 6e23145..bfdd0ea 100755
--- a/tests/fsck-tests/012-leaf-corruption/test.sh
+++ b/tests/fsck-tests/012-leaf-corruption/test.sh
@@ -57,6 +57,7 @@  check_inode()
 	# Check whether the inode exists
 	exists=$($SUDO_HELPER find $path -inum $ino)
 	if [ -z "$exists" ]; then
+		$SUDO_HELPER umount $TEST_MNT
 		_fail "inode $ino not recovered correctly"
 	fi
 
@@ -64,17 +65,20 @@  check_inode()
 	found_mode=$(printf "%o" 0x$($SUDO_HELPER stat $exists -c %f))
 	if [ $found_mode -ne $mode ]; then
 		echo "$found_mode"
+		$SUDO_HELPER umount $TEST_MNT
 		_fail "inode $ino modes not recovered"
 	fi
 
 	# Check inode size
 	found_size=$($SUDO_HELPER stat $exists -c %s)
 	if [ $mode -ne 41700 -a $found_size -ne $size ]; then
+		$SUDO_HELPER umount $TEST_MNT
 		_fail "inode $ino size not recovered correctly"
 	fi
 
 	# Check inode name
 	if [ "$(basename $exists)" != "$name" ]; then
+		$SUDO_HELPER umount $TEST_MNT
 		_fail "inode $ino name not recovered correctly"
 	else
 		return 0