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 / +} + +# 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