Re: [PATCH] xfs: Add test for printing deprec. mount options
From: Pavel Reichl <hidden>
Date: 2021-02-23 16:43:41
On 2/22/21 10:22 PM, Darrick J. Wong wrote:
On Sat, Feb 20, 2021 at 11:15:48PM +0100, Pavel Reichl wrote:quoted
Verify that warnings about deprecated mount options are properly printed. Verify that no excessive warnings are printed during remounts. Signed-off-by: Pavel Reichl <redacted> --- tests/xfs/528 | 88 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/528.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 91 insertions(+) create mode 100755 tests/xfs/528 create mode 100644 tests/xfs/528.outdiff --git a/tests/xfs/528 b/tests/xfs/528 new file mode 100755 index 00000000..0fc57cef --- /dev/null +++ b/tests/xfs/528@@ -0,0 +1,88 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc.. All Rights Reserved. +# +# FS QA Test 528 +# +# Verify that warnings about deprecated mount options are properly printed. +# +# Verify that no excessive warnings are printed during remounts. +# + +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 -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc + +# remove previous $seqres.full before test +rm -f $seqres.full + +_require_check_dmesg +_supported_fs xfs +_require_scratch + +log_tag() +{ + echo "fstests $seqnum [tag]" > /dev/kmsg_require_check_dmesg?
Yeah? I mean it's right above _supported_fs_xfs and _require_scratch...I guess I should move it right next to _require_scratch, OK?
quoted
+} + +dmesg_since_test_tag() +{ + dmesg | tac | sed -ne "0,\#fstests $seqnum \[tag\]#p" | \ + tac +} + +check_dmesg_for_since_tag() +{ + dmesg_since_test_tag | egrep -q "$1" +} + +echo "Silence is golden." + +log_tag + +# Test mount +for VAR in {attr2,ikeep,noikeep}; do + _scratch_mkfs > $seqres.full 2>&1 + _scratch_mount -o $VAR + check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \ + echo "Could not find deprecation warning for $VAR"I think this is going to regress on old stable kernels that don't know about the mount option deprecation, right? Shouldn't there be some logic to skip the test in that case?
I think you are right, thanks for the catch. Do you know how to make sure that xfstest is executed only on the kernel that implements the tested feature? I tried to do some grepping but I didn't find anything yet. Adding check for the output of `uname -r' directly to test seems a bit too crude.
--Dquoted
+ umount $SCRATCH_MNT +done + +# Test mount with default options (attr2 and noikeep) and remount with +# 2 groups of options +# 1) the defaults (attr2, noikeep) +# 2) non defaults (noattr2, ikeep) +_scratch_mount +for VAR in {attr2,noikeep}; do + log_tag + mount -o $VAR,remount $SCRATCH_MNT + check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated." && \ + echo "Should not be able to find deprecation warning for $VAR" +done +for VAR in {noattr2,ikeep}; do + log_tag + mount -o $VAR,remount $SCRATCH_MNT + check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \ + echo "Could not find deprecation warning for $VAR" +done +umount $SCRATCH_MNT + +# success, all done +status=0 +exit +diff --git a/tests/xfs/528.out b/tests/xfs/528.out new file mode 100644 index 00000000..762dccc0 --- /dev/null +++ b/tests/xfs/528.out@@ -0,0 +1,2 @@ +QA output created by 528 +Silence is golden.diff --git a/tests/xfs/group b/tests/xfs/group index e861cec9..ad3bd223 100644 --- a/tests/xfs/group +++ b/tests/xfs/group@@ -525,3 +525,4 @@ 525 auto quick mkfs 526 auto quick mkfs 527 auto quick quota +528 auto quick mount-- 2.29.2