fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / generic / 525
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Oracle and/or its affiliates.
4 # Copyright (C) 2019, CTERA Networks.
5 # All Rights Reserved.
6 #
7 # FS QA Test No. 525
8 #
9 # Check that high-offset reads and writes work.
10 #
11 # This is a variant of test generic/466 for filesystems that
12 # do not support mkfs_sized.
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1    # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $tmp.*
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # real QA test starts here
34 _supported_fs generic
35 _require_scratch
36
37 rm -f $seqres.full
38
39 _scratch_mkfs >>$seqres.full 2>&1
40 _scratch_mount
41
42 testdir=$SCRATCH_MNT
43
44 echo "++ Create the original files" >> $seqres.full
45 bigoff=$(echo "2^63 - 2" | $BC_PROG)
46 len=$(echo "2^63 - 1" | $BC_PROG)
47 $XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full 2>&1
48 if [ ! -s $testdir/file0 ]; then
49         # If we can't set a large file size then don't bother
50         # with read/write tests, because fs doesn't support it.
51         _notrun "filesystem does not support huge file size"
52 fi
53 _pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
54
55 echo "++ Check file creation" >> $seqres.full
56 _scratch_cycle_mount
57
58 $XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file1
59
60 # success, all done
61 status=0
62 exit