common/xfs: refactor commands to select a particular xfs backing device
[xfstests-dev.git] / tests / xfs / 127
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 127
6 #
7 # Tests xfs_growfs on a reflinked filesystem
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
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 . ./common/filter
27 . ./common/reflink
28
29 # real QA test starts here
30 _supported_fs xfs
31 _require_scratch_reflink
32 _require_no_large_scratch_dev
33 _require_cp_reflink
34
35 echo "Format and mount"
36 _scratch_mkfs_sized $((512 * 1024 * 1024)) > $seqres.full 2>&1
37 _scratch_mount >> $seqres.full 2>&1
38
39 testdir=$SCRATCH_MNT/test-$seq
40 mkdir $testdir
41
42 echo "Create the original file and reflink to copy1, copy2"
43 blksz="$(_get_block_size $testdir)"
44 _pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full
45 _cp_reflink $testdir/original $testdir/copy1
46 _cp_reflink $testdir/copy1 $testdir/copy2
47
48 echo "Grow fs"
49 $XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 |  _filter_growfs >> $seqres.full
50 _scratch_cycle_mount
51
52 echo "Create more reflink copies"
53 _cp_reflink $testdir/original $testdir/copy3
54
55 $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
56
57 # success, all done
58 status=0
59 exit