mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
47bb69de19
Rename _require_btrfs() to _require_btrfs_command() to avoid confusion, as all other _require_btrfs_* has a quite clear suffix, like _require_btrfs_mkfs_feature() or _require_btrfs_fs_feature(). Also enhance _require_btrfs_command() to accept 2nd level commands or options. Options will be determined by the first "-" char. This is quite useful for case like "btrfs inspect-internal dump-tree" and "btrfs check --qgroup-report". [eguan: make local vars in _require_btrfs_command "local"] Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
91 lines
2.7 KiB
Bash
Executable File
91 lines
2.7 KiB
Bash
Executable File
#! /bin/bash
|
|
# FS QA Test No. btrfs/059
|
|
#
|
|
# Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c)
|
|
# from an inode wouldn't clear its compression property.
|
|
# This was fixed in the following linux kernel patch:
|
|
#
|
|
# Btrfs: add missing compression property remove in btrfs_ioctl_setflags
|
|
#
|
|
#-----------------------------------------------------------------------
|
|
# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
|
|
# Author: Filipe Manana <fdmanana@suse.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it would be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#-----------------------------------------------------------------------
|
|
#
|
|
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
rm -fr $tmp
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
. ./common/filter.btrfs
|
|
|
|
# real QA test starts here
|
|
_supported_fs btrfs
|
|
_supported_os Linux
|
|
_require_test
|
|
_require_scratch
|
|
_require_btrfs_command "property"
|
|
|
|
rm -f $seqres.full
|
|
|
|
_scratch_mkfs >> $seqres.full 2>&1
|
|
_scratch_mount
|
|
|
|
mkdir $SCRATCH_MNT/testdir
|
|
echo "Setting compression flag in the directory..."
|
|
$CHATTR_PROG +c $SCRATCH_MNT/testdir
|
|
echo "Directory compression property value:"
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
|
|
_filter_btrfs_compress_property
|
|
|
|
touch $SCRATCH_MNT/testdir/file1
|
|
echo "file1 compression property value:"
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
|
|
_filter_btrfs_compress_property
|
|
|
|
echo "Clearing compression flag from directory..."
|
|
$CHATTR_PROG -c $SCRATCH_MNT/testdir
|
|
echo "Directory compression property value:"
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
|
|
_filter_btrfs_compress_property
|
|
|
|
touch $SCRATCH_MNT/testdir/file2
|
|
echo "file2 compression property value:"
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
|
|
_filter_btrfs_compress_property
|
|
|
|
touch $SCRATCH_MNT/testdir/file1
|
|
echo "file1 compression property value:"
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
|
|
_filter_btrfs_compress_property
|
|
|
|
status=0
|
|
exit
|