fstests: move test group info to test files
[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 . ./common/preamble
9 _begin_fstest auto quick dir
10
11 # Import common functions.
12 . ./common/filter
13
14 # real QA test starts here
15 _supported_fs generic
16 _require_test
17
18 testdir=$TEST_DIR/test-$seq
19 rm -rf $testdir
20 mkdir $testdir
21
22 # Use small getdents bufsize to fit less than 10 entries
23 # stuct linux_dirent64 is 20 bytes not including d_name
24 bufsize=200
25
26 # Check readdir content of an empty dir changes when adding a new file
27 echo -e "\nCreate file 0 in an open dir:" >> $seqres.full
28 $here/src/t_dir_offset2 $testdir $bufsize "+0" 2>&1 >> $seqres.full || \
29         echo "Missing created file in open dir (see $seqres.full for details)"
30
31 # Create enough files to be returned in multiple gendents() calls.
32 # At least one of the files that we delete will not be listed in the
33 # first call, so we may encounter stale entries in following calls.
34 for n in {1..100}; do
35     touch $testdir/$n
36 done
37
38 # Check readdir content changes after removing files
39 for n in {1..10}; do
40         echo -e "\nRemove file ${n}0 in an open dir:" >> $seqres.full
41         $here/src/t_dir_offset2 $testdir $bufsize "-${n}0" 2>&1 >> $seqres.full || \
42                 echo "Found unlinked files in open dir (see $seqres.full for details)"
43 done
44
45 # success, all done
46 echo "Silence is golden"
47 status=0