linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Eryu Guan <guaneryu@gmail.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>
Subject: Re: [PATCH 2/2] xfs: test setting labels with xfs_admin
Date: Thu, 6 Feb 2020 09:53:42 -0800	[thread overview]
Message-ID: <20200206175342.GF6869@magnolia> (raw)
In-Reply-To: <CAOQ4uxi5i-iTZG7+BgybvS7SQqat94k5jQXUK2LW-9iDf2NgnQ@mail.gmail.com>

On Wed, Feb 05, 2020 at 08:40:35AM +0200, Amir Goldstein wrote:
> On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Test setting filesystem labels with xfs_admin.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/912.out |   43 ++++++++++++++++++++++
> >  tests/xfs/group   |    1 +
> >  3 files changed, 147 insertions(+)
> >  create mode 100755 tests/xfs/912
> >  create mode 100644 tests/xfs/912.out
> >
> >
> > diff --git a/tests/xfs/912 b/tests/xfs/912
> > new file mode 100755
> > index 00000000..1eef36cd
> > --- /dev/null
> > +++ b/tests/xfs/912
> > @@ -0,0 +1,103 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# FS QA Test No. 912
> > +#
> > +# Check that xfs_admin can set and clear filesystem labels offline and online.
> > +
> > +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()
> > +{
> > +       cd /
> 
> odd cleanup.
> I think the standard rm tmp files is needed for in-case common
> helpers generate tmp files.

Heh, ok, will add that.

> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_xfs_db_command label
> > +_require_xfs_io_command label
> > +grep -q "xfs_io" "$(which xfs_admin)" || \
> > +       _notrun "xfs_admin does not support online label setting of any kind"
> 
> odd test. If it cannot be prettier than than perhaps hide this inside
> a _require helper?

There's only one user of it so far, though I guess if I'm going to add
get/set fs uuid ioctls then maybe this should get refactored...

...assuming Eric doesn't just nuke xfs_admin online updates out of
existence entirely. :)

--D

> > +
> > +rm -f $seqres.full
> > +
> > +echo
> > +echo "Format with label"
> > +_scratch_mkfs -L "label0" > $seqres.full
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -L "label1"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label online"
> > +_scratch_xfs_admin -L "label2"
> > +
> > +echo "Read label online"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Clear label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -L "--"
> > +
> > +echo "Read label online"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label offline"
> > +_scratch_xfs_admin -L "label3"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Clear label offline"
> > +_scratch_xfs_admin -L "--"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/912.out b/tests/xfs/912.out
> > new file mode 100644
> > index 00000000..186d827f
> > --- /dev/null
> > +++ b/tests/xfs/912.out
> > @@ -0,0 +1,43 @@
> > +QA output created by 912
> > +
> > +Format with label
> > +Read label offline
> > +label = "label0"
> > +Read label online
> > +label = "label0"
> > +
> > +Set label offline
> > +writing all SBs
> > +new label = "label1"
> > +Read label offline
> > +label = "label1"
> > +Read label online
> > +label = "label1"
> > +
> > +Set label online
> > +label = "label2"
> > +Read label online
> > +label = "label2"
> > +Read label offline
> > +label = "label2"
> > +
> > +Clear label online
> > +label = ""
> > +Read label online
> > +label = ""
> > +Read label offline
> > +label = ""
> > +
> > +Set label offline
> > +writing all SBs
> > +new label = "label3"
> > +Read label offline
> > +label = "label3"
> > +
> > +Clear label offline
> > +writing all SBs
> > +new label = ""
> > +Read label offline
> > +label = ""
> > +Read label online
> > +label = ""
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index edffef9a..898bd9e4 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -512,3 +512,4 @@
> >  512 auto quick acl attr
> >  747 auto quick scrub
> >  748 auto quick scrub
> > +912 auto quick label
> >

  reply	other threads:[~2020-02-06 17:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
2020-02-05  6:35   ` Amir Goldstein
2020-02-05 16:23     ` Darrick J. Wong
2020-02-05  0:02 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
2020-02-05  6:40   ` Amir Goldstein
2020-02-06 17:53     ` Darrick J. Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-16  5:11 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2020-01-16  5:11 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
2020-02-17 18:06   ` Brian Foster

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=20200206175342.GF6869@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=amir73il@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).