common/rc: add _scratch_{u}mount_idmapped() helpers
[xfstests-dev.git] / tests / generic / 514
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 514
6 #
7 # Ensure that file size resource limits are respected when reflinking.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12 tmp=/tmp/$$
13 status=1        # failure is the default!
14 trap "_cleanup; exit \$status" 0 1 2 3 15
15
16 _cleanup()
17 {
18         cd /
19         rm -f $tmp.*
20 }
21
22 # get standard environment, filters and checks
23 . ./common/rc
24 . ./common/filter
25 . ./common/reflink
26
27 # real QA test starts here
28 _supported_fs generic
29 _require_scratch_reflink
30 _require_user
31
32 rm -f $seqres.full
33
34 _scratch_mkfs >>$seqres.full 2>&1
35 _scratch_mount
36
37 chmod a+rwx $SCRATCH_MNT
38 $XFS_IO_PROG -f -c "pwrite -S 0x18 0 1m" $SCRATCH_MNT/foo >>$seqres.full
39 su -s/bin/bash - $qa_user -c "ulimit -f 64 ; $XFS_IO_PROG -f -c \"reflink $SCRATCH_MNT/foo\" $SCRATCH_MNT/bar" >> $seqres.full 2>&1
40
41 sz="$(_get_filesize $SCRATCH_MNT/bar)"
42 if [ "$sz" -ne 0 ] && [ "$sz" -ne 65536 ]; then
43         echo "Oddball file size $sz??"
44 fi
45
46 echo Silence is golden.
47 status=0
48 exit