generic: test for file fsync after moving it to a new parent directory
[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 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24     cd /
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs generic
33 _supported_os Linux
34
35 _require_test
36 _require_scratch
37 _scratch_mkfs >/dev/null 2>&1
38 _scratch_mount
39
40 # Run preallo_rw_pattern on both test and scratch partitions
41 for TESTFILE in $TEST_DIR/rw_pattern.tmp $SCRATCH_MNT/rw_pattern.tmp
42   do
43   count=1
44   while (( count < 101 ))
45     do
46     src/preallo_rw_pattern_writer $TESTFILE
47     src/preallo_rw_pattern_reader $TESTFILE
48     if (test $? -ne 0) then
49         echo Read/Write Pattern Test FAILED.
50         _cleanup
51         exit 1
52     fi
53     rm $TESTFILE
54     ((count=count+1))
55   done #done for count of  100
56 done
57
58 if (test $? -eq 0 ) then
59     status=0
60 fi
61
62 _scratch_unmount
63
64 exit