From: Eryu Guan <guaneryu@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 4/5] generic: test statx attribute_mask setting
Date: Thu, 7 Mar 2019 14:14:18 +0800 [thread overview]
Message-ID: <20190307061418.GL2824@desktop> (raw)
In-Reply-To: <155173437536.767.4083133841860983852.stgit@magnolia>
On Mon, Mar 04, 2019 at 01:19:35PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Make sure the filesystem reports attribute_mask for the attributes it
> supports.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
A few minor issues, and I can fix them all on commit (I'm sure I do test
the changes this time :)).
> ---
> tests/generic/713 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/713.out | 1 +
> tests/generic/group | 1 +
> 3 files changed, 69 insertions(+)
> create mode 100755 tests/generic/713
> create mode 100644 tests/generic/713.out
>
>
> diff --git a/tests/generic/713 b/tests/generic/713
> new file mode 100755
> index 00000000..cd128d9c
> --- /dev/null
> +++ b/tests/generic/713
> @@ -0,0 +1,67 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2019 Oracle, Inc. All Rights Reserved.
> +#
> +# FS QA Test No. 713
> +#
> +# Regression test for a bug where XFS fails to set statx attributes_mask but
> +# sets attribute flags anyway.
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.* $testfile
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_test
> +
> +get_attributes() {
> + $XFS_IO_PROG -r -c "statx -r" $1 | grep 'stat.attributes =' | cut -d ' ' -f 3
> +}
> +
> +get_attributes_mask() {
> + $XFS_IO_PROG -r -c "statx -r" $1 | grep 'stat.attributes_mask =' | cut -d ' ' -f 3
> +}
> +
> +check_statx_attributes()
> +{
> + attrs=$(get_attributes $testfile)
> + mask=$(get_attributes_mask $testfile)
Declare them as 'local'.
> +
> + echo "MASK:$mask:ATTRS:$attrs:" >> $seqres.full
> +
> + test -z "$mask" && _notrun "xfs_io statx command does not support attributes_mask"
> + test $(( mask )) -eq 0 && echo "attributes mask is zero"
> + test $(( attrs & ~(mask) )) -ne 0 && echo "attributes $attrs do not appear in mask $mask"
> +}
> +
Added the below here:
rm -f $seqres.full
echo "Silence is golden"
> +# Create file, check for incorrect mask
> +testfile=$TEST_DIR/$$.test
> +touch $testfile
> +check_statx_attributes
> +
> +# Do it again, but this time try to turn on one of the attributes.
> +if chattr +i $testfile > /dev/null 2>&1; then
> + check_statx_attributes
> + chattr -i $testfile
> +fi
> +if chattr +a $testfile > /dev/null 2>&1; then
> + check_statx_attributes
> + chattr -a $testfile
Change 'chattr' to '$CHATTR_PROG'.
Thanks,
Eryu
> +fi
> +
> +status=0
> +exit
> diff --git a/tests/generic/713.out b/tests/generic/713.out
> new file mode 100644
> index 00000000..066598d3
> --- /dev/null
> +++ b/tests/generic/713.out
> @@ -0,0 +1 @@
> +QA output created by 713
> diff --git a/tests/generic/group b/tests/generic/group
> index 15227b67..d04bf39f 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -534,3 +534,4 @@
> 529 auto quick attr
> 530 auto quick unlink
> 531 auto quick unlink
> +713 auto quick
>
next prev parent reply other threads:[~2019-03-07 6:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 21:19 [PATCH 0/5] fstests: various fixes Darrick J. Wong
2019-03-04 21:19 ` [PATCH 1/5] common/rc: fix get_max_lfs_filesize Darrick J. Wong
2019-03-06 12:55 ` Eryu Guan
2019-03-04 21:19 ` [PATCH 2/5] xfs/010: use correct type for finobt corrupting Darrick J. Wong
2019-03-04 21:19 ` [PATCH 3/5] shared/298: unmount filesystem before examining underlying storage Darrick J. Wong
2019-03-04 21:19 ` [PATCH 4/5] generic: test statx attribute_mask setting Darrick J. Wong
2019-03-07 6:14 ` Eryu Guan [this message]
2019-03-07 15:51 ` Darrick J. Wong
2019-03-04 21:19 ` [PATCH 5/5] populate: force large finobt creation on xfs Darrick J. Wong
2019-03-05 19:42 ` [PATCH 6/5] ext4/032: SCRATCH_DIR -> SCRATCH_MNT Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190307061418.GL2824@desktop \
--to=guaneryu@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox