fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / generic / 135
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 135
6 #
7 # Concurrent I/O to same file to ensure no deadlocks
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 trap "exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs generic
24 _supported_os Linux
25
26 _require_odirect
27 _require_scratch
28 _scratch_mkfs >/dev/null 2>&1
29 _scratch_mount
30
31 cd $SCRATCH_MNT
32
33 # create file with async I/O
34 $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x12 0 4k' async_file > /dev/null
35
36 # create file with sync I/O
37 $XFS_IO_PROG -f -s -c 'pwrite -b 4k -S 0x34 0 4k' sync_file > /dev/null
38
39 # create file with direct I/O
40 $XFS_IO_PROG -f -d -c 'pwrite -b 4k -S 0x56 0 4k' direct_file > /dev/null
41
42 # create file, truncate and then dirty again
43 $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' trunc_file > /dev/null
44 $XFS_IO_PROG -f -c 'truncate 2k' trunc_file > /dev/null
45 $XFS_IO_PROG -c 'pwrite 1k 0 1k' trunc_file > /dev/null
46
47 pushd / > /dev/null
48 _scratch_cycle_mount
49 popd > /dev/null
50
51 # check file size and contents
52 od -Ad -x async_file
53 od -Ad -x sync_file
54 od -Ad -x direct_file
55 od -Ad -x trunc_file
56
57 rm -f async_file sync_file direct_file trunc_file
58
59 status=0
60 exit