All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: guaneryu@gmail.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 2/2] xfs: test setting labels with xfs_admin
Date: Wed, 15 Jan 2020 21:11:42 -0800	[thread overview]
Message-ID: <157915150275.2375135.12157351351400702116.stgit@magnolia> (raw)
In-Reply-To: <157915149017.2375135.14166864164575311878.stgit@magnolia>

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 /
+}
+
+# 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"
+
+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 a6c9ef08..cc1d122a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -511,3 +511,4 @@
 511 auto quick quota
 747 auto quick scrub
 748 auto quick scrub
+912 auto quick label


  parent reply	other threads:[~2020-01-16  5:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
2020-02-17 18:05   ` Brian Foster
2020-01-16  5:11 ` Darrick J. Wong [this message]
2020-02-17 18:06   ` [PATCH 2/2] xfs: test setting labels with xfs_admin Brian Foster
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 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

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=157915150275.2375135.12157351351400702116.stgit@magnolia \
    --to=darrick.wong@oracle.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 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.