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

* Re: [PATCH] fstests: btrfs/219 add a test to test -o rescue=all
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2020-09-09  7:15 UTC (permalink / raw)
  To: Josef Bacik, linux-btrfs, fstests, kernel-team

On 08/09/2020 21:39, Josef Bacik wrote:
> +# 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

This looks very much like the test template. The only thing it does is check if 
the mount option exit and then exit, doesn't it?

So it either gets skipped if the mount option isn't present or it exits with a 
failure.

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

* Re: [PATCH] fstests: btrfs/219 add a test to test -o rescue=all
  2020-09-09  7:15 ` Johannes Thumshirn
@ 2020-09-09 12:20   ` Josef Bacik
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2020-09-09 12:20 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-btrfs, fstests, kernel-team

On 9/9/20 3:15 AM, Johannes Thumshirn wrote:
> On 08/09/2020 21:39, Josef Bacik wrote:
>> +# 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
> 
> This looks very much like the test template. The only thing it does is check if
> the mount option exit and then exit, doesn't it?
> 
> So it either gets skipped if the mount option isn't present or it exits with a
> failure.
> 

Lol Jesus Christ, I git format-patch'ed to copy the test to the box I 
was actually going to use and fixed it there, but then forgot to copy 
the new one back over and sent the template.  I'm an idiot, I'll resend 
the actual test.  Thanks,

Josef

^ permalink raw reply	[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).