generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 069
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 069
6 #
7 # Test out writes with O_APPEND flag sets.
8 #
9 . ./common/preamble
10 _begin_fstest rw udf auto quick
11
12 status=0        # success is the default!
13 _register_cleanup "rm -rf $tmp.*"
14
15 # Import common functions.
16 . ./common/filter
17
18 # real QA test starts here
19 _supported_fs generic
20
21 _require_scratch
22
23 _scratch_unmount >/dev/null 2>&1
24
25 echo "*** mkfs"
26 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
27
28 echo "*** mount FS"
29 _scratch_mount
30
31 cd $SCRATCH_MNT
32
33 sizes="1 20 300 40000 3000000 12345"
34 for size in $sizes ; do
35         $here/src/append_writer $size &
36         echo $! $size >> pids
37 done
38
39 cd $here
40
41 wait
42 ls -lh $SCRATCH_MNT >> $seqres.full
43 echo "*** PIDs file" >> $seqres.full
44 cat $SCRATCH_MNT/pids >> $seqres.full
45
46 cat $SCRATCH_MNT/pids | while read pid size
47 do
48         echo "*** checking file with $size integers"
49         echo checking pid=$pid size=$size >> $seqres.full
50         $here/src/append_reader $SCRATCH_MNT/testfile.$pid
51         status=$?
52         [ $status -ne 0 ] && \
53                 echo "maybe corrupt O_APPEND to $SCRATCH_MOUNT/testfile.$pid!"
54         echo status: $status >> $seqres.full
55 done
56
57 # success, all done
58 exit