tests: remove udf/101
[xfstests-dev.git] / tests / generic / 349
1 #! /bin/bash
2 # FS QA Test No. 349
3 #
4 # Test fallocate(ZERO_RANGE) on a block device, which should be able to
5 # WRITE SAME (or equivalent) the range.
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 7 15
33
34 _cleanup()
35 {
36     cd /
37     rm -rf $tmp.*
38 }
39
40 # get standard environment, filters and checks
41 . ./common/rc
42 . ./common/filter
43 . ./common/scsi_debug
44
45 # real QA test starts here
46 _supported_os Linux
47 _require_scsi_debug
48 _require_xfs_io_command "fzero"
49
50 echo "Create and format"
51 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
52 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
53
54 echo "Zero range"
55 $XFS_IO_PROG -c "fzero -k 512k 1m" $dev
56
57 echo "Zero range without keep_size"
58 $XFS_IO_PROG -c "fzero 384k 64k" $dev
59
60 echo "Zero range past EOD"
61 $XFS_IO_PROG -c "fzero -k 3m 4m" $dev
62
63 echo "Check contents"
64 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
65
66 echo "Zero range to MAX_LFS_FILESIZE"
67 # zod = MAX_LFS_FILESIZE
68 case "$(getconf LONG_BIT)" in
69 "32")
70         zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
71         ;;
72 "64")
73         zod=9223372036854775807
74         ;;
75 *)
76         _fail "sizeof(long) == $(getconf LONG_BIT)?"
77         ;;
78 esac
79 $XFS_IO_PROG -c "fzero -k 0 $zod" $dev
80
81 echo "Check contents"
82 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
83
84 echo "Destroy device"
85 _put_scsi_debug_dev
86
87 # success, all done
88 status=0
89 exit