fstests: check for filesystem FS_IOC_FSSETXATTR support
[xfstests-dev.git] / tests / xfs / 289
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 289
6 #
7 # Test to ensure xfs_growfs command rejects non-existent mount points
8 # and accepts mounted targets.
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     $UMOUNT_PROG $tmpdir
22     $UMOUNT_PROG $tmpbind
23     rmdir $tmpdir
24     rm -f $tmpsymlink
25     rmdir $tmpbind
26     rm -f $tmpfile
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # remove previous $seqres.full before test
34 rm -f $seqres.full
35
36 # real QA test starts here
37
38 # Modify as appropriate.
39 _supported_fs xfs
40 _supported_os Linux
41 _require_test
42 _require_loop
43
44 tmpfile=$TEST_DIR/fsfile
45 tmpdir=$TEST_DIR/tmpdir
46 tmpsymlink=$TEST_DIR/tmpsymlink.$$
47 tmpbind=$TEST_DIR/tmpbind.$$
48
49 mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir"
50
51 echo "=== mkfs.xfs ==="
52 $MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1
53
54 echo "=== truncate ==="
55 $XFS_IO_PROG -fc "truncate 256m" $tmpfile
56
57 echo "=== xfs_growfs - unmounted, command should be rejected ==="
58 $XFS_GROWFS_PROG $tmpdir 2>&1 |  _filter_test_dir
59
60 echo "=== xfs_growfs - check relative path, unmounted ==="
61 cd $TEST_DIR
62 $XFS_GROWFS_PROG ./tmpdir 2>&1 | _filter_test_dir
63
64 echo "=== xfs_growfs - no path, unmounted ==="
65 $XFS_GROWFS_PROG tmpdir 2>&1 | _filter_test_dir
66
67 echo "=== xfs_growfs - plain file - should be rejected ==="
68 $XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir
69
70 echo "=== mount ==="
71 $MOUNT_PROG -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount"
72
73 echo "=== xfs_growfs - mounted - check absolute path ==="
74 $XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_test_dir > /dev/null
75
76 echo "=== xfs_growfs - check relative path ==="
77 $XFS_GROWFS_PROG -D 12288 ./tmpdir > /dev/null
78
79 echo "=== xfs_growfs - no path ==="
80 $XFS_GROWFS_PROG -D 16384 tmpdir > /dev/null
81
82 echo "=== xfs_growfs - symbolic link ==="
83 ln -s $tmpdir $tmpsymlink
84 $XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_test_dir > /dev/null
85
86 echo "=== xfs_growfs - symbolic link using relative path ==="
87 $XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ > /dev/null
88
89 echo "=== xfs_growfs - symbolic link using no path ==="
90 $XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ > /dev/null
91
92 echo "=== xfs_growfs - bind mount ==="
93 mkdir $tmpbind
94 $MOUNT_PROG -o bind $tmpdir $tmpbind
95 $XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_test_dir > /dev/null
96
97 echo "=== xfs_growfs - bind mount - relative path ==="
98 $XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ > /dev/null
99
100 echo "=== xfs_growfs - bind mount - no path ==="
101 $XFS_GROWFS_PROG -D 40960 tmpbind.$$ > /dev/null
102
103 echo "=== xfs_growfs - plain file - should be rejected ==="
104 $XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir
105
106 # success, all done
107 status=0
108 exit