fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / generic / 009
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright 2014 (C) Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
4 #
5 # FS QA Test No. 009
6 #
7 # Test fallocate FALLOC_FL_ZERO_RANGE
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
17 _cleanup()
18 {
19     rm -f $tmp.*
20 }
21
22 trap "_cleanup ; exit \$status" 0 1 2 3 15
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/punch
28
29 # real QA test starts here
30 _supported_os Linux
31 _require_xfs_io_command "fzero"
32 _require_xfs_io_command "fiemap"
33 _require_xfs_io_command "falloc"
34 _require_test
35
36 testfile=$TEST_DIR/009.$$
37
38 # Disable extent zeroing for ext4 as that change where holes are created
39 if [ "$FSTYP" = "ext4" ]; then
40         _ext4_disable_extent_zeroout
41 fi
42
43 # When PAGE_SIZE > 4096 some filesystems extent layout is different so
44 # it would not match the output.
45 if [ "$FSTYP" = "xfs" -o "$FSTYP" = "btrfs" ]; then
46         PAGE_SIZE=`getconf PAGE_SIZE`
47         if [ $PAGE_SIZE -gt 4096 ]; then
48                 _notrun "Not supported on $FSTYP with page size > 4096"
49         fi
50 fi
51
52 # Standard zero range tests
53 _test_generic_punch falloc fzero fzero fiemap _filter_fiemap $testfile
54
55 # Delayed allocation zero range tests
56 _test_generic_punch -d falloc fzero fzero fiemap _filter_fiemap $testfile
57
58 # Multi zero range tests
59 _test_generic_punch -k falloc fzero fzero fiemap _filter_fiemap $testfile
60
61 # Delayed allocation multi zero range tests
62 _test_generic_punch -d -k falloc fzero fzero fiemap _filter_fiemap $testfile
63
64 status=0 ; exit