mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
7e98d41a6e
Refactor every test in the entire test suite to use the new boilerplate functions. This also migrates all the test group information into the test files. This patch has been autogenerated via the command: ./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
82 lines
2.6 KiB
Bash
Executable File
82 lines
2.6 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 207
|
|
#
|
|
# Test setting the extsz and cowextsz hints:
|
|
# - Ensure that we can set both on a zero-byte file.
|
|
# - Ensure that we can set only cowextsz on a many-byte file.
|
|
# - Ensure that whatever we set we get back later.
|
|
#
|
|
. ./common/preamble
|
|
_begin_fstest auto quick clone
|
|
|
|
# Import common functions.
|
|
. ./common/filter
|
|
. ./common/reflink
|
|
|
|
# real QA test starts here
|
|
_supported_fs xfs
|
|
_require_scratch_reflink
|
|
_require_cp_reflink
|
|
_require_xfs_io_command "fiemap"
|
|
_require_xfs_io_command "cowextsize"
|
|
|
|
# Takes the fsxattr.xflags line,
|
|
# i.e. fsxattr.xflags = 0x0 [--------------C-]
|
|
# and tests whether a flag character is set
|
|
test_xflag()
|
|
{
|
|
local flg=$1
|
|
grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
|
|
}
|
|
|
|
echo "Format and mount"
|
|
_scratch_mkfs > $seqres.full 2>&1
|
|
_scratch_mount >> $seqres.full 2>&1
|
|
_xfs_force_bdev data $SCRATCH_MNT
|
|
|
|
testdir=$SCRATCH_MNT/test-$seq
|
|
mkdir $testdir
|
|
|
|
echo "Create the original files"
|
|
$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file1 >> $seqres.full
|
|
$XFS_IO_PROG -f -c "pwrite -S 0x61 0 1048576" $testdir/file2 >> $seqres.full
|
|
$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file3 >> $seqres.full
|
|
_scratch_cycle_mount
|
|
|
|
echo "Set extsz and cowextsz on zero byte file"
|
|
$XFS_IO_PROG -c "extsize 1048576" $testdir/file1 | _filter_scratch
|
|
$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 | _filter_scratch
|
|
|
|
echo "Set extsz and cowextsz on 1Mbyte file"
|
|
$XFS_IO_PROG -c "extsize 1048576" $testdir/file2 | _filter_scratch
|
|
$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file2 | _filter_scratch
|
|
_scratch_cycle_mount
|
|
|
|
echo "Check extsz and cowextsz settings on zero byte file"
|
|
$XFS_IO_PROG -c "extsize" $testdir/file1 | _filter_scratch
|
|
$XFS_IO_PROG -c "cowextsize" $testdir/file1 | _filter_scratch
|
|
|
|
echo "Check extsz and cowextsz settings on 1Mbyte file"
|
|
$XFS_IO_PROG -c "extsize" $testdir/file2 | _filter_scratch
|
|
$XFS_IO_PROG -c "cowextsize" $testdir/file2 | _filter_scratch
|
|
|
|
echo "Set cowextsize and check flag"
|
|
$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
|
|
_scratch_cycle_mount
|
|
|
|
$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
|
|
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
|
|
|
|
echo "Unset cowextsize and check flag"
|
|
$XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
|
|
_scratch_cycle_mount
|
|
|
|
$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
|
|
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
|
|
|
|
status=0
|
|
exit
|