4 # Check open by file handle.
5 # This is a variant of test generic/426 that tests with less
6 # files and more use cases:
7 # - open directory by file handle
8 # - verify content integrity of file after opening by file handle
9 # - open by file handle of unlinked open files
10 # - open by file handle of renamed files
12 #-----------------------------------------------------------------------
13 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
14 # Author: Amir Goldstein <amir73il@gmail.com>
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
50 # real QA test starts here
52 # Modify as appropriate.
56 # _require_exportfs already requires open_by_handle, but let's not count on it
57 _require_test_program "open_by_handle"
61 testdir=$TEST_DIR/$seq-dir
63 # Create test dir and non-empty test files
70 $here/src/open_by_handle -cwp $dir $NUMFILES
73 # Test encode/decode file handles
79 echo test_file_handles $* | _filter_test_dir
80 $here/src/open_by_handle $opt $dir $NUMFILES
83 # Check stale handles to deleted files/dir
84 create_test_files $testdir
85 test_file_handles $testdir -dp
87 # Check non-stale handles to linked files/dir
88 create_test_files $testdir
89 test_file_handles $testdir -rp
91 # Check non-stale handles to unlinked open files
92 create_test_files $testdir
93 test_file_handles $testdir -dkr
95 # Check non-stale handles to files that were hardlinked and original deleted
96 create_test_files $testdir
97 test_file_handles $testdir -lr
98 test_file_handles $testdir -ur
100 # Check non-stale file handles of renamed files
101 create_test_files $testdir
102 test_file_handles $testdir -mr
104 # Check non-stale file handles after rename of parent
105 create_test_files $testdir
106 rm -rf $testdir.renamed
107 mv $testdir $testdir.renamed/
108 test_file_handles $testdir.renamed -rp
110 # Check non-stale file handles after move to new parent
111 create_test_files $testdir
113 mkdir -p $testdir.new
114 mv $testdir/* $testdir.new/
115 test_file_handles $testdir.new -rp