fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 349
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 349
6 #
7 # Test fallocate(ZERO_RANGE) on a block device, which should be able to
8 # WRITE SAME (or equivalent) the range.
9 #
10 . ./common/preamble
11 _begin_fstest blockdev rw zero
12
13 _register_cleanup "_cleanup" BUS
14
15 # Import common functions.
16 . ./common/filter
17 . ./common/scsi_debug
18
19 # real QA test starts here
20 _require_scsi_debug
21 _require_xfs_io_command "fzero"
22
23 echo "Create and format"
24 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
25 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
26
27 echo "Zero range"
28 $XFS_IO_PROG -c "fzero -k 512k 1m" $dev
29
30 echo "Zero range without keep_size"
31 $XFS_IO_PROG -c "fzero 384k 64k" $dev
32
33 echo "Zero range past EOD"
34 $XFS_IO_PROG -c "fzero -k 3m 4m" $dev
35
36 echo "Check contents"
37 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
38
39 echo "Zero range to MAX_LFS_FILESIZE"
40 # zod = MAX_LFS_FILESIZE
41 zod=$(_get_max_lfs_filesize)
42 $XFS_IO_PROG -c "fzero -k 0 $zod" $dev
43
44 echo "Check contents"
45 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
46
47 echo "Destroy device"
48 _put_scsi_debug_dev
49
50 # success, all done
51 status=0
52 exit