linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fstests: btrfs/219 add a test to test -o rescue=all
@ 2020-09-08 15:42 Josef Bacik
  2020-09-09  7:15 ` Johannes Thumshirn
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2020-09-08 15:42 UTC (permalink / raw)
  To: linux-btrfs, fstests, kernel-team

This new mount option makes sure we can still mount the file system if
any of the core roots are corrupted.  This test corrupts each of these
roots and validates that it can still mount the fs and read the file.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/btrfs/219     | 54 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/219.out |  2 ++
 tests/btrfs/group   |  1 +
 3 files changed, 57 insertions(+)
 create mode 100755 tests/btrfs/219
 create mode 100644 tests/btrfs/219.out

diff --git a/tests/btrfs/219 b/tests/btrfs/219
new file mode 100755
index 00000000..b63bf899
--- /dev/null
+++ b/tests/btrfs/219
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Facebook.  All Rights Reserved.
+#
+# FS QA Test 219
+#
+# A test to exercise the various failure scenarios for -o rescue=all.  This is
+# mainly a regression test for
+#
+#   btrfs: introduce rescue=all
+#
+# We simply corrupt a bunch of core roots and validate that it works the way we
+# expect it to.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+_require_test
+_require_scratch_mountopt "-o rescue=all,ro"
+
+# if error
+exit
+
+# optional stuff if your test has verbose output to help resolve problems
+#echo
+#echo "If failure, check $seqres.full (this) and $seqres.full.ok (reference)"
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/219.out b/tests/btrfs/219.out
new file mode 100644
index 00000000..162074d3
--- /dev/null
+++ b/tests/btrfs/219.out
@@ -0,0 +1,2 @@
+QA output created by 219
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 3295856d..f4dbfafb 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -221,3 +221,4 @@
 216 auto quick seed
 217 auto quick trim dangerous
 218 auto quick volume
+219 auto quick
-- 
2.26.2


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

end of thread, other threads:[~2020-09-09 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 15:42 [PATCH] fstests: btrfs/219 add a test to test -o rescue=all Josef Bacik
2020-09-09  7:15 ` Johannes Thumshirn
2020-09-09 12:20   ` Josef Bacik

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