linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Su Yue <suy.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <dsterba@suse.com>
Subject: [PATCH v3 3/3] btrfs-progs: fsck-tests/016: lowmem mode check for images
Date: Thu, 12 Jan 2017 11:53:30 +0800	[thread overview]
Message-ID: <20170112035330.21376-3-suy.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <20170112035330.21376-1-suy.fnst@cn.fujitsu.com>

Since lowmem mode can repair inode nbytes error now, modify this test case
to allow lowmem mode repair.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
v3: add this patch.
---
 tests/fsck-tests/016-wrong-inode-nbytes/test.sh | 33 +++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100755 tests/fsck-tests/016-wrong-inode-nbytes/test.sh

diff --git a/tests/fsck-tests/016-wrong-inode-nbytes/test.sh b/tests/fsck-tests/016-wrong-inode-nbytes/test.sh
new file mode 100755
index 0000000..f8466cb
--- /dev/null
+++ b/tests/fsck-tests/016-wrong-inode-nbytes/test.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# check inode nbytes in both normal and lowmem mode
+
+source $TOP/tests/common
+
+check_prereq btrfs
+
+check_image() {
+	local image
+	local image2;
+
+	image=$1
+	image2=$image"_2"
+	cp "$image" "$image2"
+
+	echo "testing image $(basename $image)" >> "$RESULTS"
+	"$TOP/btrfs" check "$image" >> "$RESULTS" 2>&1
+	[ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
+
+	run_check "$TOP/btrfs" check --repair "$image"
+	run_check "$TOP/btrfs" check "$image"
+
+	echo "testing image $(basename $image2)" >> "$RESULTS"
+	"$TOP/btrfs" check --mode=lowmem "$image2" >> "$RESULTS" 2>&1
+	[ $? -eq 0 ] && _fail "btrfs lowmem check should detected corruption"
+
+	run_check "$TOP/btrfs" check --mode=lowmem --repair "$image2"
+	run_check "$TOP/btrfs" check --mode=lowmem "$image2"
+
+	rm "$image2"
+}
+
+check_all_images
-- 
2.11.0




      parent reply	other threads:[~2017-01-12  3:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  3:53 [PATCH v3 1/3] btrfs-progs: cmds-check.c: supports inode nbytes fix in lowmem Su Yue
2017-01-12  3:53 ` [PATCH v3 2/3] btrfs-progs: cmds-check.c: supports inode isize " Su Yue
2017-01-12  3:53 ` Su Yue [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170112035330.21376-3-suy.fnst@cn.fujitsu.com \
    --to=suy.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).