xfs/419: remove irrelevant swapfile test
[xfstests-dev.git] / tests / xfs / 245
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. 245
6 #
7 # Make sure that reflink deals with extents going beyond EOF.
8 # - fallocate 256k in file1
9 # - pwrite 252-257k to cause it to speculatively prealloc file1
10 # - reflink file1 to file2
11 # - compare file[12]
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1    # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24     cd /
25     rm -rf $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/reflink
32
33 # real QA test starts here
34 _supported_fs xfs
35 _require_xfs_debug
36 _require_scratch_reflink
37 _require_xfs_io_command "falloc"
38 _require_xfs_io_command "bmap" "-c"
39 _require_cp_reflink
40
41 rm -f $seqres.full
42
43 echo "Format and mount"
44 _scratch_mkfs > $seqres.full 2>&1
45 _scratch_mount >> $seqres.full 2>&1
46
47 testdir=$SCRATCH_MNT/test-$seq
48 mkdir $testdir
49
50 echo "Create the original files"
51 $XFS_IO_PROG -f -c "falloc 0 256k" -c "pwrite 252k 6k" $testdir/file1 >> $seqres.full
52 _scratch_cycle_mount
53 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
54
55 echo "Compare files"
56 md5sum $testdir/file1 | _filter_scratch
57 md5sum $testdir/file2 | _filter_scratch
58
59 echo "Unwritten data extents"
60 test $(_xfs_bmapx_find data $testdir/file1 '10000$') -gt 0 || \
61         echo "Expected to find an unwritten file1 extent"
62 echo "Shared data extents"
63 test $(_xfs_bmapx_find data $testdir/file1 '100000$') -gt 0 || \
64         echo "Expected to find a shared data extent"
65
66 echo "Hole data extents"
67 test $(_xfs_bmapx_find data $testdir/file2 'hole') -gt 0 || \
68         echo "Expected to find a hole data extent"
69 echo "Shared data extents"
70 test $(_xfs_bmapx_find data $testdir/file2 '100000$') -gt 0 || \
71         echo "Expected to find a shared data extent"
72
73 echo "Hole cow extents"
74 test $(_xfs_bmapx_find cow $testdir/file1 'hole') -gt 0 || \
75         echo "Expected to find a hole cow extent"
76 echo "Hole cow extents"
77 test $(_xfs_bmapx_find cow $testdir/file2 'hole') -gt 0 || \
78         echo "Expected to find a hole cow extent"
79
80 # success, all done
81 status=0
82 exit