From: Dave Chinner <david@fromorbit.com>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: [PATCH 1/3] xfstests: introduce _require_xfs_crc_sb pre-checkup routine
Date: Tue, 3 Dec 2013 11:37:59 +1100 [thread overview]
Message-ID: <20131203003759.GI10988@dastard> (raw)
In-Reply-To: <52983C41.8000004@oracle.com>
On Fri, Nov 29, 2013 at 03:03:29PM +0800, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
>
> Introduce _require_xfs_crc_sb to rc. We can use it in pre-checkup
> procedures to verify if the XFS test environment is configured with
> CRC enabled or not for some particular test cases.
>
> Introduce a new helper _xfs_sb_version to get XFS super block version
> to make the test case more flexiable if possible. e.g, if that is
> v5 super block, the tests behavior might be different to old v4 sb.
>
> Refactor xfs/299 to use it.
>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
> common/rc | 19 +++++++++++++++++++
> tests/xfs/299 | 9 +--------
> 2 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index f73414b..9f45279 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1579,6 +1579,25 @@ _check_xfs_filesystem()
> return 0
> }
>
> +# Get XFS super block version
> +_xfs_sb_version()
> +{
> + sb_version=`$XFS_DB_PROG -r -c version $SCRATCH_DEV | \
> + awk -F= '{print $2}' | awk -F, '{print $1}' | \
> + cut -c3-`
> + echo $sb_version
> +}
Ugh. I missed how nasty that code was originally. Maths, not string
manipulations shoul dbe used here. i.e:
versionnum filesystem version information. This value is
currently 1, 2, 3, or 4 in the low 4 bits.
[ Oh, look, xfs_db man page updates are needed ]
So:
$XFS_DB_PROG -r -c "sb 0" -c "p versionnum" $SCRATCH_DEV | \
awk '{ printf "%d\n", and(strtonum($3), 15) }'
> +# This test requires XFS crc-enabled (v5) super block support
> +_require_xfs_crc_sb()
> +{
> + version=`_xfs_sb_version`
> + if [ $version -lt 5 ]
> + then
> + _notrun "Can't run with older versions of superblock"
_notrun "Need version 5 superblock support for this test"
> + fi
> +}
> +
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-12-03 0:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 7:03 [PATCH 1/3] xfstests: introduce _require_xfs_crc_sb pre-checkup routine Jeff Liu
2013-12-03 0:37 ` Dave Chinner [this message]
2013-12-03 0:56 ` Dave Chinner
2013-12-03 7:48 ` Jeff Liu
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=20131203003759.GI10988@dastard \
--to=david@fromorbit.com \
--cc=jeff.liu@oracle.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox