fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 350
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. 350
6 #
7 # Test fallocate(PUNCH_HOLE) on a block device, which should be able to
8 # zero-TRIM (or equivalent) the range.
9 #
10 . ./common/preamble
11 _begin_fstest blockdev rw punch
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 "fpunch"
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 punch"
28 $XFS_IO_PROG -c "fpunch 512k 1m" $dev
29
30 echo "Punch range past EOD"
31 $XFS_IO_PROG -c "fpunch 3m 4m" $dev
32
33 echo "Check contents"
34 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
35
36 echo "Punch to MAX_LFS_FILESIZE"
37 # zod = MAX_LFS_FILESIZE
38 zod=$(_get_max_lfs_filesize)
39 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
40
41 echo "Check contents"
42 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
43
44 echo "Destroy device"
45 _put_scsi_debug_dev
46
47 # success, all done
48 status=0
49 exit