fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 308
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 308
6 #
7 # Regression test for commit:
8 # f17722f ext4: Fix max file size and logical block counting of extent format file
9 #
10 . ./common/preamble
11 _begin_fstest auto quick
12
13 # Override the default cleanup function.
14 _cleanup()
15 {
16         cd /
17         rm -f $testfile
18 }
19
20 # Import common functions.
21 . ./common/filter
22
23 testfile=$TEST_DIR/testfile.$seq
24
25 # real QA test starts here
26 _supported_fs generic
27 _require_test
28
29 echo "Silence is golden"
30
31 block_size=`_get_block_size $TEST_DIR`
32
33 # On unpatched ext4, if an extent exists which includes the block right
34 # before the maximum file offset, and the block for the maximum file offset
35 # is written, the kernel panics
36 # On patched ext4, the write would get EFBIG since we lower s_maxbytes by
37 # one fs block
38
39 # Create a sparse file with an extent lays at one block before old s_maxbytes
40 offset=$(((2**32 - 2) * $block_size))
41 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >$seqres.full 2>&1
42
43 # Write to the block after the extent just created
44 offset=$(((2**32 - 1) * $block_size))
45 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >>$seqres.full 2>&1
46
47 # Got here without hitting BUG_ON(), test passed
48 status=0
49 exit