generic/611: Use _getfattr instead of GETFATTR_PROG
[xfstests-dev.git] / tests / generic / 235
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Jan Kara.  All Rights Reserved.
4 # Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
5 #
6 # FS QA Test No. 235
7 #
8 # Test whether quota gets properly reenabled after remount read-write
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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22 . ./common/quota
23
24 # real QA test starts here
25 _supported_fs generic
26 _require_scratch
27 _require_quota
28 _require_user
29
30 do_repquota()
31 {
32         repquota -u -g $SCRATCH_MNT  | grep -v -E '^root|^$' | _filter_scratch
33 }
34
35 # real QA test starts here
36 rm -f $seqres.full
37
38 _scratch_mkfs >> $seqres.full 2>&1
39 _scratch_mount "-o usrquota,grpquota"
40 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
41 quotaon $SCRATCH_MNT 2>/dev/null
42
43 touch $SCRATCH_MNT/testfile
44 chown $qa_user:$qa_user $SCRATCH_MNT/testfile
45
46 do_repquota
47
48 # If remount fails with this problem:
49 #
50 # https://bugzilla.redhat.com/show_bug.cgi?id=563267
51 #
52 # then you need a more recent mount binary.
53 _try_scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
54 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
55 _try_scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
56
57 touch $SCRATCH_MNT/testfile2
58 chown $qa_user:$qa_user $SCRATCH_MNT/testfile2
59
60 do_repquota
61
62 _scratch_unmount 2>/dev/null
63
64 status=0
65 exit