xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 426
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
4 #
5 # FS QA Test No. 426
6 #
7 # Check stale handles pointing to unlinked files
8 # and non-stale handles pointing to linked files
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30
31 # Modify as appropriate.
32 _supported_fs generic
33 _supported_os Linux
34 _require_test
35 # _require_exportfs already requires open_by_handle, but let's not count on it
36 _require_test_program "open_by_handle"
37 _require_exportfs
38
39 NUMFILES=1024
40 testdir=$TEST_DIR/$seq-dir
41 mkdir -p $testdir
42
43 # Create empty test files in test dir
44 create_test_files()
45 {
46         local dir=$1
47         local opt=$2
48
49         mkdir -p $dir
50         rm -f $dir/*
51         $here/src/open_by_handle -c $dir $NUMFILES
52 }
53
54 # Test encode/decode file handles
55 test_file_handles()
56 {
57         local dir=$1
58         local opt=$2
59
60         echo test_file_handles $* | _filter_test_dir
61         $here/src/open_by_handle $opt $dir $NUMFILES
62 }
63
64 # Check stale handles to deleted files
65 create_test_files $testdir
66 test_file_handles $testdir -d
67
68 # Check non-stale handles to linked files
69 create_test_files $testdir
70 test_file_handles $testdir
71
72 # Check non-stale handles to files that were hardlinked and original deleted
73 create_test_files $testdir
74 test_file_handles $testdir -l
75 test_file_handles $testdir -u
76
77 status=0
78 exit