All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	fstests <fstests@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 4/4] xfstests: Check the stx_attributes settable by chattr
Date: Mon, 3 Apr 2017 14:02:02 +0300	[thread overview]
Message-ID: <CAOQ4uxj3heVi+x4Gf_-PBAK5gE36DVCsqi8wWXaNniZxNxgZQQ@mail.gmail.com> (raw)
In-Reply-To: <149121525845.22344.2910294693531349827.stgit@warthog.procyon.org.uk>

On Mon, Apr 3, 2017 at 1:27 PM, David Howells <dhowells@redhat.com> wrote:
> Check the stx_attributes that can be set by calling chattr.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
[...]
> diff --git a/tests/generic/421 b/tests/generic/421
> new file mode 100755
> index 0000000..6fca8f6
> --- /dev/null
> +++ b/tests/generic/421
> @@ -0,0 +1,94 @@
> +#! /bin/bash
> +# FS QA Test 421
> +#
> +# Test the statx stx_attribute flags that can be set with chattr
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 YOUR NAME HERE.  All Rights Reserved.
> +#
> +# 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=0

Better default to failure. see my comments on test 420.

> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +       cd /
> +       rm -f $tmp.*
> +       rm -f $seq-file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs generic
> +_supported_os IRIX Linux
> +_require_test
> +_require_test_program "stat_test"
> +_require_statx
> +_require_chattr
> +
> +function check_stat () {
> +    $here/src/stat_test $*
> +}
> +
> +touch $seq-file
> +
> +function try () {
> +    chattr $* $seq-file
> +    check_stat $seq-file \
> +              attr=${1/a/append} \
> +              attr=${2/c/compressed} \
> +              attr=${3/i/immutable} \
> +              attr=${4/d/nodump} \
> +              stx_type=file \
> +              stx_size=0 \
> +              stx_rdev_major=0 \
> +              stx_rdev_minor=0 \
> +              stx_nlink=1
> +}
> +
> +# We can turn on and off append (a), compressed (c), immutable (i) and
> +# no-dump (d)
> +for a in +a -a
> +do
> +    for c in +c -c
> +    do
> +       for i in +i -i
> +       do
> +           for d in +d -d
> +           do
> +               try $a $c $i $d
> +           done
> +       done
> +    done
> +done
> +
> +# Done.  We leave the determination to the output comparator.
> +exit
> diff --git a/tests/generic/421.out b/tests/generic/421.out
> new file mode 100644
> index 0000000..984fb43
> --- /dev/null
> +++ b/tests/generic/421.out
> @@ -0,0 +1 @@
> +QA output created by 421

If the output is meant to stay empty, please copy from the tests that do
echo "Silence is golden"
Again, I believe this is to protect from test crashing and resulting in empty
output (well in addition to the status thingy...)

> diff --git a/tests/generic/group b/tests/generic/group
> index 5678101..f8b01fc 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -423,3 +423,4 @@
>  418 auto rw
>  419 auto quick encrypt
>  420 auto quick
> +421 auto quick
>

      reply	other threads:[~2017-04-03 11:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 10:27 [PATCH 1/4] xfstests: Add an auxiliary program to create an AF_UNIX socket David Howells
2017-04-03 10:27 ` [PATCH 2/4] xfstests: Add first statx test David Howells
2017-04-03 10:53   ` Amir Goldstein
2017-04-03 11:18   ` David Howells
2017-04-03 11:32     ` Amir Goldstein
2017-04-03 11:46     ` David Howells
2017-04-03 11:54       ` Amir Goldstein
2017-04-03 10:27 ` [PATCH 3/4] xfstests: Partially expand the documentation David Howells
2017-04-03 10:27 ` [PATCH 4/4] xfstests: Check the stx_attributes settable by chattr David Howells
2017-04-03 11:02   ` Amir Goldstein [this message]

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=CAOQ4uxj3heVi+x4Gf_-PBAK5gE36DVCsqi8wWXaNniZxNxgZQQ@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=david@fromorbit.com \
    --cc=dhowells@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.