9a9956cf44de68a1e5c7e43733ae68c6e77baf22
[xfstests-dev.git] / tests / shared / 003
1 #! /bin/bash
2 # FS QA Test 003
3 #
4 # Test mount a needs_recovery partition with noload option.
5 # ext4 used to Oops until part of this commit:
6 #
7 # 744692d ext4: use ext4_get_block_write in buffer write
8 #
9 # Also test on ext2/3.
10 #
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
13 #
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
17 #
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
26 #-----------------------------------------------------------------------
27 #
28
29 seq=`basename $0`
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40         cd /
41         rm -f $tmp.*
42 }
43
44 # get standard environment, filters and checks
45 . ./common/rc
46 . ./common/filter
47
48 # real QA test starts here
49 _supported_fs ext2 ext3 ext4
50 _supported_os Linux
51
52 # nofsck as we modify sb via debugfs
53 _require_scratch_nocheck
54
55 # remove previous $seqres.full before test
56 rm -f $seqres.full
57 echo "Silence is golden"
58
59 _scratch_mkfs >>$seqres.full 2>&1
60
61 # set needs_recovery feature bit
62 debugfs -w -R "feature +needs_recovery" $SCRATCH_DEV \
63         >>$seqres.full 2>&1
64
65 # mount with noload option
66 _try_scratch_mount "-o noload" >>$seqres.full 2>&1
67
68 # success, all done
69 status=0
70 exit