Re: [PATCH 2/2] xfs: test setting labels with xfs_admin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> >
> > Test setting filesystem labels with xfs_admin.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > ---
> >  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
> >



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux