generic: test for file fsync after moving it to a new parent directory
[xfstests-dev.git] / tests / generic / 383
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 383
6 #
7 # Test xfs_quota when project names beginning with digits.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 qa_user=""
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 . ./common/quota
29
30 # remove previous $seqres.full before test
31 rm -f $seqres.full
32
33 # real QA test starts here
34 _supported_fs generic
35 _supported_os Linux
36 _require_scratch
37 _require_quota
38 _require_xfs_quota_foreign
39
40 _scratch_mkfs >/dev/null 2>&1
41 _scratch_enable_pquota
42
43 do_project_test()
44 {
45         local qa_project=123456-project
46         local dir=$SCRATCH_MNT/project
47
48         mkdir $dir 2>/dev/null
49
50         #project quota files
51         cat >$tmp.projects <<EOF
52 10:$dir
53 EOF
54
55         cat >$tmp.projid <<EOF
56 $qa_project:10
57 EOF
58
59         $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
60                 -c "project -s $qa_project" $SCRATCH_MNT > /dev/null
61
62         # We set & test inodes, because xfs vs ext4 consume differing
63         # amounts of space for an empty dir, but an inode is an inode...
64         $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
65                 -c "limit -p isoft=100 ihard=200 $qa_project" $SCRATCH_MNT
66
67         echo "=== quota command output ==="
68         $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid \
69                 -c "quota -p -v -i $qa_project" $SCRATCH_MNT | _filter_quota
70
71         echo "=== report command output ==="
72         $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
73                 -c "report -p -N -i" $SCRATCH_MNT | _filter_project_quota
74 }
75
76 # Test project
77 _qmount_option "usrquota,prjquota"
78 _qmount
79 _require_prjquota $SCRATCH_DEV
80 do_project_test
81
82 # success, all done
83 status=0
84 exit