fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / generic / 637
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2021 CTERA Networks. All Rights Reserved.
4 #
5 # Check that directory modifications to an open dir are observed
6 # by a new open fd
7 #
8 seq=`basename $0`
9 seqres=$RESULT_DIR/$seq
10 echo "QA output created by $seq"
11
12 here=`pwd`
13 tmp=/tmp/$$
14 status=1        # failure is the default!
15
16 _cleanup()
17 {
18         cd /
19         rm -f $tmp.*
20 }
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/filter
26
27 # real QA test starts here
28 _supported_fs generic
29 _require_test
30
31 rm -f $seqres.full
32
33 testdir=$TEST_DIR/test-$seq
34 rm -rf $testdir
35 mkdir $testdir
36
37 # Use small getdents bufsize to fit less than 10 entries
38 # stuct linux_dirent64 is 20 bytes not including d_name
39 bufsize=200
40
41 # Check readdir content of an empty dir changes when adding a new file
42 echo -e "\nCreate file 0 in an open dir:" >> $seqres.full
43 $here/src/t_dir_offset2 $testdir $bufsize "+0" 2>&1 >> $seqres.full || \
44         echo "Missing created file in open dir (see $seqres.full for details)"
45
46 # Create enough files to be returned in multiple gendents() calls.
47 # At least one of the files that we delete will not be listed in the
48 # first call, so we may encounter stale entries in following calls.
49 for n in {1..100}; do
50     touch $testdir/$n
51 done
52
53 # Check readdir content changes after removing files
54 for n in {1..10}; do
55         echo -e "\nRemove file ${n}0 in an open dir:" >> $seqres.full
56         $here/src/t_dir_offset2 $testdir $bufsize "-${n}0" 2>&1 >> $seqres.full || \
57                 echo "Found unlinked files in open dir (see $seqres.full for details)"
58 done
59
60 # success, all done
61 echo "Silence is golden"
62 status=0