* [PATCH 0/1] xfs: health tracking tests
@ 2019-05-20 22:31 Darrick J. Wong
2019-05-20 22:31 ` [PATCH ] xfs: basic testing of new xfs_spaceman health command Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2019-05-20 22:31 UTC (permalink / raw)
To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests
Hi all,
Tests for the new XFS online health reporting patches.
If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy!
Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=health-tracking
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=health-tracking
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=health-tracking
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH ] xfs: basic testing of new xfs_spaceman health command
2019-05-20 22:31 [PATCH 0/1] xfs: health tracking tests Darrick J. Wong
@ 2019-05-20 22:31 ` Darrick J. Wong
2019-05-26 14:49 ` Eryu Guan
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2019-05-20 22:31 UTC (permalink / raw)
To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests
From: Darrick J. Wong <darrick.wong@oracle.com>
Basic tests to make sure xfs_spaceman health command works properly.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
common/xfs | 7 ++++
tests/xfs/742 | 52 +++++++++++++++++++++++++++++++++
tests/xfs/742.out | 2 +
tests/xfs/743 | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/743.out | 4 +++
tests/xfs/group | 2 +
6 files changed, 151 insertions(+)
create mode 100755 tests/xfs/742
create mode 100644 tests/xfs/742.out
create mode 100755 tests/xfs/743
create mode 100644 tests/xfs/743.out
diff --git a/common/xfs b/common/xfs
index 42f02ff7..f8dafc6c 100644
--- a/common/xfs
+++ b/common/xfs
@@ -773,7 +773,12 @@ _require_xfs_spaceman_command()
_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
testfile=$TEST_DIR/$$.xfs_spaceman
+ touch $testfile
case $command in
+ "health")
+ testio=`$XFS_SPACEMAN_PROG -c "health $param" $TEST_DIR 2>&1`
+ param_checked=1
+ ;;
*)
testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
esac
@@ -787,6 +792,8 @@ _require_xfs_spaceman_command()
_notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
echo $testio | grep -q "foreign file active" && \
_notrun "xfs_spaceman $command not supported on $FSTYP"
+ echo $testio | grep -q "Inappropriate ioctl for device" && \
+ _notrun "xfs_spaceman $command support is missing (missing ioctl?)"
echo $testio | grep -q "Function not implemented" && \
_notrun "xfs_spaceman $command support is missing (missing syscall?)"
diff --git a/tests/xfs/742 b/tests/xfs/742
new file mode 100755
index 00000000..2529c40a
--- /dev/null
+++ b/tests/xfs/742
@@ -0,0 +1,52 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
+#
+# FS QA Test No. 742
+#
+# Ensure all xfs_spaceman commands are documented.
+
+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 /
+ rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
+_require_command "$MAN_PROG" man
+
+echo "Silence is golden"
+
+MANPAGE=$($MAN_PROG --path xfs_spaceman)
+
+case "$MANPAGE" in
+*.gz|*.z\|*.Z) CAT=zcat;;
+*.bz2) CAT=bzcat;;
+*.xz) CAT=xzcat;;
+*) CAT=cat;;
+esac
+_require_command `which $CAT` $CAT
+
+for COMMAND in `$XFS_SPACEMAN_PROG -c help $TEST_DIR | awk '{print $1}' | grep -v "^Use"`; do
+ $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
+ echo "$COMMAND not documented in the xfs_spaceman manpage"
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/742.out b/tests/xfs/742.out
new file mode 100644
index 00000000..ef4f23cd
--- /dev/null
+++ b/tests/xfs/742.out
@@ -0,0 +1,2 @@
+QA output created by 742
+Silence is golden
diff --git a/tests/xfs/743 b/tests/xfs/743
new file mode 100755
index 00000000..d0b7b3b0
--- /dev/null
+++ b/tests/xfs/743
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
+#
+# FS QA Test No. 743
+#
+# Basic tests of the xfs_spaceman health command.
+
+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 /
+ rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/fuzzy
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch_nocheck
+_require_scrub
+_require_xfs_spaceman_command "health"
+
+rm -f $seqres.full
+
+_scratch_mkfs > $tmp.mkfs
+_scratch_mount
+
+# Haven't checked anything, it should tell us to run scrub
+$XFS_SPACEMAN_PROG -c "health" $SCRATCH_MNT
+
+echo "Silence is golden"
+
+# Run scrub to collect health info.
+_scratch_scrub -n >> $seqres.full
+
+query() {
+ $XFS_SPACEMAN_PROG -c "$@" $SCRATCH_MNT | tee -a $seqres.full
+}
+
+query_health() {
+ query "$@" | grep -q ": ok$"
+}
+
+query_sick() {
+ query "$@" | grep -q ": unhealthy$"
+}
+
+# Let's see if we get at least one healthy rating for each health reporting
+# group.
+query_health "health -f" || \
+ echo "Didn't see a single healthy fs metadata?"
+
+query_health "health -a 0" || \
+ echo "Didn't see a single healthy ag metadata?"
+
+query_health "health $SCRATCH_MNT" || \
+ echo "Didn't see a single healthy file metadata?"
+
+# Unmount, corrupt filesystem
+_scratch_unmount
+_scratch_xfs_db -x -c 'sb 1' -c 'fuzz -d magicnum random' >> $seqres.full
+
+# Now let's see what the AG report says
+_scratch_mount
+_scratch_scrub -n >> $seqres.full 2>&1
+query_sick "health -a 1" || \
+ echo "Didn't see the expected unhealthy metadata?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/743.out b/tests/xfs/743.out
new file mode 100644
index 00000000..85232e52
--- /dev/null
+++ b/tests/xfs/743.out
@@ -0,0 +1,4 @@
+QA output created by 743
+Health status has not been collected for this filesystem.
+Please run xfs_scrub(8) to remedy this situation.
+Silence is golden
diff --git a/tests/xfs/group b/tests/xfs/group
index c8620d72..5a4ef4bf 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -502,3 +502,5 @@
502 auto quick unlink
503 auto copy metadump
739 auto quick mkfs label
+742 auto quick spaceman
+743 auto quick health
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH ] xfs: basic testing of new xfs_spaceman health command
2019-05-20 22:31 ` [PATCH ] xfs: basic testing of new xfs_spaceman health command Darrick J. Wong
@ 2019-05-26 14:49 ` Eryu Guan
0 siblings, 0 replies; 3+ messages in thread
From: Eryu Guan @ 2019-05-26 14:49 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, fstests
On Mon, May 20, 2019 at 03:31:41PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Basic tests to make sure xfs_spaceman health command works properly.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> common/xfs | 7 ++++
> tests/xfs/742 | 52 +++++++++++++++++++++++++++++++++
> tests/xfs/742.out | 2 +
> tests/xfs/743 | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/743.out | 4 +++
> tests/xfs/group | 2 +
> 6 files changed, 151 insertions(+)
> create mode 100755 tests/xfs/742
> create mode 100644 tests/xfs/742.out
> create mode 100755 tests/xfs/743
> create mode 100644 tests/xfs/743.out
>
>
> diff --git a/common/xfs b/common/xfs
> index 42f02ff7..f8dafc6c 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -773,7 +773,12 @@ _require_xfs_spaceman_command()
> _require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
>
> testfile=$TEST_DIR/$$.xfs_spaceman
> + touch $testfile
> case $command in
> + "health")
> + testio=`$XFS_SPACEMAN_PROG -c "health $param" $TEST_DIR 2>&1`
> + param_checked=1
> + ;;
> *)
> testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
> esac
> @@ -787,6 +792,8 @@ _require_xfs_spaceman_command()
> _notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
> echo $testio | grep -q "foreign file active" && \
> _notrun "xfs_spaceman $command not supported on $FSTYP"
> + echo $testio | grep -q "Inappropriate ioctl for device" && \
> + _notrun "xfs_spaceman $command support is missing (missing ioctl?)"
> echo $testio | grep -q "Function not implemented" && \
> _notrun "xfs_spaceman $command support is missing (missing syscall?)"
>
> diff --git a/tests/xfs/742 b/tests/xfs/742
> new file mode 100755
> index 00000000..2529c40a
> --- /dev/null
> +++ b/tests/xfs/742
> @@ -0,0 +1,52 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
> +#
> +# FS QA Test No. 742
> +#
> +# Ensure all xfs_spaceman commands are documented.
> +
> +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 /
> + rm -rf $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +_require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
> +_require_command "$MAN_PROG" man
> +
> +echo "Silence is golden"
> +
> +MANPAGE=$($MAN_PROG --path xfs_spaceman)
> +
> +case "$MANPAGE" in
> +*.gz|*.z\|*.Z) CAT=zcat;;
> +*.bz2) CAT=bzcat;;
> +*.xz) CAT=xzcat;;
> +*) CAT=cat;;
> +esac
> +_require_command `which $CAT` $CAT
> +
> +for COMMAND in `$XFS_SPACEMAN_PROG -c help $TEST_DIR | awk '{print $1}' | grep -v "^Use"`; do
> + $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
> + echo "$COMMAND not documented in the xfs_spaceman manpage"
> +done
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/742.out b/tests/xfs/742.out
> new file mode 100644
> index 00000000..ef4f23cd
> --- /dev/null
> +++ b/tests/xfs/742.out
> @@ -0,0 +1,2 @@
> +QA output created by 742
> +Silence is golden
> diff --git a/tests/xfs/743 b/tests/xfs/743
> new file mode 100755
> index 00000000..d0b7b3b0
> --- /dev/null
> +++ b/tests/xfs/743
> @@ -0,0 +1,84 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
> +#
> +# FS QA Test No. 743
> +#
> +# Basic tests of the xfs_spaceman health command.
> +
> +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 /
> + rm -rf $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/fuzzy
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +_require_scratch_nocheck
> +_require_scrub
> +_require_xfs_spaceman_command "health"
> +
> +rm -f $seqres.full
> +
> +_scratch_mkfs > $tmp.mkfs
I redirected both stdout and stderr to $seqres.full.
> +_scratch_mount
> +
> +# Haven't checked anything, it should tell us to run scrub
> +$XFS_SPACEMAN_PROG -c "health" $SCRATCH_MNT
> +
> +echo "Silence is golden"
This test doesn't need it, I updated the .out file as well.
Thanks,
Eryu
> +
> +# Run scrub to collect health info.
> +_scratch_scrub -n >> $seqres.full
> +
> +query() {
> + $XFS_SPACEMAN_PROG -c "$@" $SCRATCH_MNT | tee -a $seqres.full
> +}
> +
> +query_health() {
> + query "$@" | grep -q ": ok$"
> +}
> +
> +query_sick() {
> + query "$@" | grep -q ": unhealthy$"
> +}
> +
> +# Let's see if we get at least one healthy rating for each health reporting
> +# group.
> +query_health "health -f" || \
> + echo "Didn't see a single healthy fs metadata?"
> +
> +query_health "health -a 0" || \
> + echo "Didn't see a single healthy ag metadata?"
> +
> +query_health "health $SCRATCH_MNT" || \
> + echo "Didn't see a single healthy file metadata?"
> +
> +# Unmount, corrupt filesystem
> +_scratch_unmount
> +_scratch_xfs_db -x -c 'sb 1' -c 'fuzz -d magicnum random' >> $seqres.full
> +
> +# Now let's see what the AG report says
> +_scratch_mount
> +_scratch_scrub -n >> $seqres.full 2>&1
> +query_sick "health -a 1" || \
> + echo "Didn't see the expected unhealthy metadata?"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/743.out b/tests/xfs/743.out
> new file mode 100644
> index 00000000..85232e52
> --- /dev/null
> +++ b/tests/xfs/743.out
> @@ -0,0 +1,4 @@
> +QA output created by 743
> +Health status has not been collected for this filesystem.
> +Please run xfs_scrub(8) to remedy this situation.
> +Silence is golden
> diff --git a/tests/xfs/group b/tests/xfs/group
> index c8620d72..5a4ef4bf 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -502,3 +502,5 @@
> 502 auto quick unlink
> 503 auto copy metadump
> 739 auto quick mkfs label
> +742 auto quick spaceman
> +743 auto quick health
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-26 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 22:31 [PATCH 0/1] xfs: health tracking tests Darrick J. Wong
2019-05-20 22:31 ` [PATCH ] xfs: basic testing of new xfs_spaceman health command Darrick J. Wong
2019-05-26 14:49 ` Eryu Guan
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.