diff mbox series

fstests: btrfs/219 add a test to test -o rescue=all

Message ID 5e29c56193c6de8bbc364f22595479d292da13d3.1599579754.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series fstests: btrfs/219 add a test to test -o rescue=all | expand

Commit Message

Josef Bacik Sept. 8, 2020, 3:42 p.m. UTC
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

Comments

Johannes Thumshirn Sept. 9, 2020, 7:15 a.m. UTC | #1
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.
Josef Bacik Sept. 9, 2020, 12:20 p.m. UTC | #2
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
diff mbox series

Patch

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