generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 124
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. 124
6 #
7 # Test preallocated_rw_pattern_test modified from CXFSQA test preallocated_rw_pattern_test
8 #
9 # pat stands for pattern.  First 8 bytes contains the 64-bit number 0,
10 # second is 1, ..., until last 8 bytes (1048568-1048575) contain 131071.
11 # patw preallocates the file and then writes the pattern, patr checks it
12 #
13 . ./common/preamble
14 _begin_fstest pattern auto quick
15
16 # Override the default cleanup function.
17 _cleanup()
18 {
19     cd /
20 }
21
22 # Import common functions.
23 . ./common/filter
24
25 # real QA test starts here
26 _supported_fs generic
27
28 _require_test
29 _require_scratch
30 _scratch_mkfs >/dev/null 2>&1
31 _scratch_mount
32
33 # Run preallo_rw_pattern on both test and scratch partitions
34 for TESTFILE in $TEST_DIR/rw_pattern.tmp $SCRATCH_MNT/rw_pattern.tmp
35   do
36   count=1
37   while (( count < 101 ))
38     do
39     $here/src/preallo_rw_pattern_writer $TESTFILE
40     $here/src/preallo_rw_pattern_reader $TESTFILE
41     if (test $? -ne 0) then
42         echo Read/Write Pattern Test FAILED.
43         _cleanup
44         exit 1
45     fi
46     rm $TESTFILE
47     ((count=count+1))
48   done #done for count of  100
49 done
50
51 if (test $? -eq 0 ) then
52     status=0
53 fi
54
55 _scratch_unmount
56
57 exit