common/xfs: refactor commands to select a particular xfs backing device
[xfstests-dev.git] / tests / ext4 / 038
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test ext4/038
6 #
7 # Regression test for commit:
8 # c9eb13a ext4: fix hang when processing corrupted orphaned inode list
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # real QA test starts here
28 _supported_fs ext3 ext4
29 _require_scratch
30 _require_command "$DEBUGFS_PROG" debugfs
31
32 # remove previous $seqres.full before test
33 rm -f $seqres.full
34 echo "Silence is golden"
35
36 # Although the bug only happens when last_orphan is set to 5
37 # it is better to test all reserved inode numbers 1-10 here
38 for i in {1..10}; do
39         # create smaller filesystems to save test time
40         _scratch_mkfs_sized $((16 * 1024 * 1024)) >>$seqres.full 2>&1
41         $DEBUGFS_PROG -w -R "ssv last_orphan $i" $SCRATCH_DEV >>$seqres.full 2>&1
42         _scratch_mount
43         _scratch_unmount
44 done
45
46 # success, all done
47 status=0
48 exit