xfs: no excessive warnings about dprecated mount options on remount
[xfstests-dev.git] / tests / xfs / 019
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 019
6 #
7 # mkfs protofile test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 seqfull="$seqres.full"
16 status=1        # failure is the default!
17 # get standard environment, filters and checks
18 . ./common/rc
19 . ./common/filter
20
21 _cleanup()
22 {
23     echo "*** unmount"
24     _scratch_unmount 2>/dev/null
25     rm -f $tmp.*
26 }
27 trap "_cleanup; exit \$status" 0 1 2 3 15
28
29 _full()
30 {
31     echo ""            >>$seqfull
32     echo "*** $* ***"  >>$seqfull
33     echo ""            >>$seqfull
34 }
35
36 _filter_stat()
37 {
38     sed '
39         /^Access:/d;
40         /^Modify:/d;
41         /^Change:/d;
42         s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
43         s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
44         s/Size: *[0-9][0-9]* *Filetype: Dir/Size: <DSIZE> Filetype: Dir/;
45     ' | tr -s ' '
46 }
47
48 # real QA test starts here
49 _supported_fs xfs
50
51 _require_scratch
52
53 # mkfs cannot create a filesystem with protofiles if realtime is enabled, so
54 # don't run this test if the rtinherit is anywhere in the mkfs options.
55 echo "$MKFS_OPTIONS" | grep -q "rtinherit" && \
56         _notrun "Cannot mkfs with a protofile and -d rtinherit."
57
58 protofile=$tmp.proto
59 tempfile=$tmp.file
60
61 echo fish >$tempfile
62 $here/src/devzero -b 2048 -n 2 -c -v 44 $tempfile.2 
63
64 cat >$protofile <<EOF
65 DUMMY1
66 0 0
67 : root directory
68 d--777 3 1
69 : a directory
70 directory d--755 3 1 
71 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_0 ---755 3 1 $tempfile
72 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_1 ---755 3 1 $tempfile
73 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_2 ---755 3 1 $tempfile
74 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_3 ---755 3 1 $tempfile
75 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_4 ---755 3 1 $tempfile
76 $
77 : back in the root
78 setuid -u-666 0 0 $tempfile
79 setgid --g666 0 0 $tempfile
80 setugid -ug666 0 0 $tempfile
81 block_device b--012 3 1 161 162 
82 char_device c--345 3 1 177 178
83 pipe p--670 0 0
84 symlink l--123 0 0 bigfile
85 : a file we actually read
86 bigfile ---666 3 0 $tempfile.2
87 : done
88 $
89 EOF
90
91 if [ $? -ne 0 ]
92 then
93     _fail "failed to create test protofile"
94 fi
95
96 _verify_fs()
97 {
98         echo "*** create FS version $1"
99         VERSION="-n version=$1"
100
101         rm -f $seqfull
102         _scratch_unmount >/dev/null 2>&1
103
104         _full "mkfs"
105         _scratch_mkfs_xfs $VERSION -p $protofile >>$seqfull 2>&1 \
106                 || _fail "mkfs failed"
107
108         echo "*** check FS"
109         _check_scratch_fs
110
111         echo "*** mount FS"
112         _full " mount"
113         _try_scratch_mount >>$seqfull 2>&1 \
114                 || _fail "mount failed"
115
116         echo "*** verify FS"
117         (cd $SCRATCH_MNT ; find . | LC_COLLATE=POSIX sort \
118                 | grep -v ".use_space" \
119                 | xargs $here/src/lstat64 | _filter_stat)
120         diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
121                 || _fail "bigfile corrupted"
122
123         echo "*** unmount FS"
124         _full "umount"
125         _scratch_unmount >>$seqfull 2>&1 \
126                 || _fail "umount failed"
127 }
128
129 #_verify_fs 1
130 _verify_fs 2
131
132 echo "*** done"
133 rm $seqfull
134 status=0
135 exit