btrfs/139: require 2GB scratch dev
[xfstests-dev.git] / tests / btrfs / 059
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/059
6 #
7 # Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c)
8 # from an inode wouldn't clear its compression property.
9 # This was fixed in the following linux kernel patch:
10 #
11 #     Btrfs: add missing compression property remove in btrfs_ioctl_setflags
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         rm -fr $tmp
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/filter.btrfs
32
33 # real QA test starts here
34 _supported_fs btrfs
35 _supported_os Linux
36 _require_test
37 _require_scratch
38 _require_btrfs_command "property"
39
40 rm -f $seqres.full
41
42 _scratch_mkfs >> $seqres.full 2>&1
43 _scratch_mount
44
45 mkdir $SCRATCH_MNT/testdir
46 echo "Setting compression flag in the directory..."
47 $CHATTR_PROG +c $SCRATCH_MNT/testdir
48 echo "Directory compression property value:"
49 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
50         _filter_btrfs_compress_property
51
52 touch $SCRATCH_MNT/testdir/file1
53 echo "file1 compression property value:"
54 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
55         _filter_btrfs_compress_property
56
57 echo "Clearing compression flag from directory..."
58 $CHATTR_PROG -c $SCRATCH_MNT/testdir
59 echo "Directory compression property value:"
60 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
61         _filter_btrfs_compress_property
62
63 touch $SCRATCH_MNT/testdir/file2
64 echo "file2 compression property value:"
65 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
66         _filter_btrfs_compress_property
67
68 touch $SCRATCH_MNT/testdir/file1
69 echo "file1 compression property value:"
70 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
71         _filter_btrfs_compress_property
72
73 status=0
74 exit