generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 014
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 014
6 #
7 # truncfile
8 #
9 . ./common/preamble
10 _begin_fstest rw udf auto quick
11
12 status=0        # success is the default!
13
14 # Override the default cleanup function.
15 _cleanup()
16 {
17     cd /
18     rm -f $tmp.*
19     rm -rf $TEST_DIR/truncfile.$$.*
20 }
21
22 # Import common functions.
23 . ./common/filter
24
25 _supported_fs generic
26
27 _require_test
28 _require_sparse_files
29
30 # ensure EOF preallocation doesn't massively extend the runtime of this test
31 # by limiting the amount of preallocation and therefore the amount of blocks
32 # zeroed during the truncfile test run.
33 if [ "$FSTYP" == "xfs" ]; then
34         _test_unmount
35         _test_mount -o allocsize=64k
36 fi
37
38 echo "brevity is wit..."
39
40 echo "------"
41 echo "test 1"
42 echo "------"
43 $here/src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
44 ret=$?
45 if [ "$ret" -ne 0 ]; then
46         out=`cat $tmp.out`
47         echo "truncfile returned $ret : \"$out\""
48 else
49         echo "OK"
50 fi
51
52 exit