fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / xfs / 246
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 246
6 #
7 # Create an empty file and try to query the (nonexistant) CoW fork.
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 -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_os Linux
30 _supported_fs xfs
31 _require_xfs_debug
32 _require_xfs_io_command "bmap" "-c"
33 _require_scratch
34
35 rm -f $seqres.full
36
37 echo "Format and mount"
38 _scratch_mkfs > $seqres.full 2>&1
39 _scratch_mount >> $seqres.full 2>&1
40
41 testdir=$SCRATCH_MNT/test-$seq
42 mkdir $testdir
43
44 echo "Create the original files"
45 touch $testdir/file1
46 sync
47
48 echo "Dump extents after sync"
49 echo "Hole CoW extents:"
50 $XFS_IO_PROG -c "bmap -clpv" $testdir/file1 | _filter_scratch
51
52 # success, all done
53 status=0
54 exit