fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: guaneryu@gmail.com, linux-xfs@vger.kernel.org,
	fstests@vger.kernel.org, guan@eryu.me
Subject: Re: [PATCH 1/2] xfs: test the xfs_db path command
Date: Thu, 25 Mar 2021 15:03:14 +0530	[thread overview]
Message-ID: <87mturo9wl.fsf@garuda> (raw)
In-Reply-To: <161647322430.3430916.12437291741320143904.stgit@magnolia>

On 23 Mar 2021 at 09:50, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Add a new test to make sure the xfs_db path command works the way the
> author thinks it should.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/917     |   98 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/917.out |   19 ++++++++++
>  tests/xfs/group   |    1 +
>  3 files changed, 118 insertions(+)
>  create mode 100755 tests/xfs/917
>  create mode 100644 tests/xfs/917.out
>
>
> diff --git a/tests/xfs/917 b/tests/xfs/917
> new file mode 100755
> index 00000000..bf21b290
> --- /dev/null
> +++ b/tests/xfs/917
> @@ -0,0 +1,98 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test No. 917
> +#
> +# Make sure the xfs_db path command works the way the author thinks it does.
> +# This means that it can navigate to random inodes, fails on paths that don't
> +# resolve.
> +#
> +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
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_xfs_db_command "path"
> +_require_scratch
> +
> +echo "Format filesystem and populate"
> +_scratch_mkfs > $seqres.full
> +_scratch_mount >> $seqres.full
> +
> +mkdir $SCRATCH_MNT/a
> +mkdir $SCRATCH_MNT/a/b
> +$XFS_IO_PROG -f -c 'pwrite 0 61' $SCRATCH_MNT/a/c >> $seqres.full
> +ln -s -f c $SCRATCH_MNT/a/d
> +mknod $SCRATCH_MNT/a/e b 8 0
> +ln -s -f b $SCRATCH_MNT/a/f

Later in the test script, there are two checks corresponding to accessibility
of file symlink and dir symlink. However, $SCRATCH_MNT/a/d and
$SCRATCH_MNT/a/f are actually referring to non-existant files since current
working directory at the time of invocation of ln command is the xfstests
directory.

i.e. 'c' and 'b' arguments to 'ln' command above must be qualified with
$SCRATCH_MNT/a/.

> +
> +_scratch_unmount
> +
> +echo "Check xfs_db path on directories"
> +_scratch_xfs_db -c 'path /a' -c print | grep -q 'sfdir.*count.* 5$' || \
> +	echo "Did not find directory /a"
> +
> +_scratch_xfs_db -c 'path /a/b' -c print | grep -q sfdir || \
> +	echo "Did not find empty sf directory /a/b"
> +
> +echo "Check xfs_db path on files"
> +_scratch_xfs_db -c 'path /a/c' -c print | grep -q 'core.size.*61' || \
> +	echo "Did not find 61-byte file /a/c"
> +
> +echo "Check xfs_db path on file symlinks"
> +_scratch_xfs_db -c 'path /a/d' -c print | grep -q symlink || \
> +	echo "Did not find symlink /a/d"
> +
> +echo "Check xfs_db path on bdevs"
> +_scratch_xfs_db -c 'path /a/e' -c print | grep -q 'format.*dev' || \
> +	echo "Did not find bdev /a/e"
> +
> +echo "Check xfs_db path on dir symlinks"
> +_scratch_xfs_db -c 'path /a/f' -c print | grep -q symlink || \
> +	echo "Did not find symlink /a/f"

--
chandan

  reply	other threads:[~2021-03-25  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  4:20 [PATCHSET 0/2] fstests: test xfs_db directory navigation Darrick J. Wong
2021-03-23  4:20 ` [PATCH 1/2] xfs: test the xfs_db path command Darrick J. Wong
2021-03-25  9:33   ` Chandan Babu R [this message]
2021-03-25 16:33     ` Darrick J. Wong
2021-03-26  3:31       ` Chandan Babu R
2021-03-23  4:20 ` [PATCH 2/2] xfs: test the xfs_db ls command Darrick J. Wong
2021-03-25 10:08   ` Chandan Babu R
2021-03-25 16:35     ` Darrick J. Wong
2021-03-25 16:36   ` [PATCH v1.1 " Darrick J. Wong
2021-03-26  3:32     ` Chandan Babu R
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27 19:03 [PATCH RFC 0/2] xfs_db: add minimal directory navigation Darrick J. Wong
2020-10-27 19:03 ` [PATCH 1/2] xfs: test the xfs_db path command 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=87mturo9wl.fsf@garuda \
    --to=chandanrlinux@gmail.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).