generic: convert tests to SPDX license tags
[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 _supported_os Linux
27 _require_scratch
28 _require_quota
29 _require_user
30
31 do_repquota()
32 {
33         repquota -u -g $SCRATCH_MNT  | grep -v -E '^root|^$' | _filter_scratch
34 }
35
36 # real QA test starts here
37 rm -f $seqres.full
38
39 _scratch_mkfs >> $seqres.full 2>&1
40 _scratch_mount "-o usrquota,grpquota"
41 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
42 quotaon $SCRATCH_MNT 2>/dev/null
43
44 touch $SCRATCH_MNT/testfile
45 chown $qa_user:$qa_user $SCRATCH_MNT/testfile
46
47 do_repquota
48
49 # If remount fails with this problem:
50 #
51 # https://bugzilla.redhat.com/show_bug.cgi?id=563267
52 #
53 # then you need a more recent mount binary.
54 _try_scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
55 touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
56 _try_scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
57
58 $XFS_IO_PROG -c 'pwrite 0 8k' -c 'fsync' \
59                         $SCRATCH_MNT/testfile >>$seqres.full 2>&1
60 do_repquota
61
62 _scratch_unmount 2>/dev/null
63
64 status=0
65 exit