common/xfs: refactor commands to select a particular xfs backing device
[xfstests-dev.git] / tests / xfs / 142
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 142
6 #
7 # This is a regression test for commit d0c20d38af13 "xfs: fix
8 # xfs_bmap_validate_extent_raw when checking attr fork of rt files", which
9 # fixes the bmap record validator so that it will not check the attr fork
10 # extent mappings of a realtime file against the size of the realtime volume.
11
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1    # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs xfs
33 _require_scratch
34 _require_realtime
35
36 rm -f $seqres.full
37
38 # Format filesystem with very tiny realtime volume
39 _scratch_mkfs -r size=256k > $seqres.full
40 _scratch_mount >> $seqres.full
41
42 # Create a realtime file
43 $XFS_IO_PROG -f -R -c 'pwrite 0 64k' -c stat $SCRATCH_MNT/v >> $seqres.full
44
45 # Add enough xattr data to force creation of xattr blocks at a higher address
46 # on the data device than the size of the realtime volume
47 for i in `seq 0 16`; do
48         $ATTR_PROG -s user.test$i $SCRATCH_MNT/v < $SCRATCH_MNT/v >> $seqres.full
49 done
50
51 # Force flushing extent maps to disk to trip the verifier
52 _scratch_cycle_mount
53
54 # Now let that unmount
55 echo Silence is golden.
56
57 # success, all done
58 status=0
59 exit