Re: [PATCH 1/2] xfs: test the xfs_db path command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25 Mar 2021 at 22:03, Darrick J. Wong wrote:
> On Thu, Mar 25, 2021 at 03:03:14PM +0530, Chandan Babu R wrote:
>> On 23 Mar 2021 at 09:50, Darrick J. Wong wrote:
>> > From: Darrick J. Wong <djwong@xxxxxxxxxx>
>> >
>> > 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@xxxxxxxxxx>
>> > ---
>> >  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/.
>
> Hm?  d and f look fine to me:
>
> $ ./check xfs/917
> $ mount /dev/sdf /opt
> $ cd /opt/a
> $ ls
> total 4
> drwxr-xr-x 2 root root    6 Mar 25 09:25 b/
> -rw------- 1 root root   61 Mar 25 09:25 c
> lrwxrwxrwx 1 root root    1 Mar 25 09:25 d -> c
> brw-r--r-- 1 root root 8, 0 Mar 25 09:25 e
> lrwxrwxrwx 1 root root    1 Mar 25 09:25 f -> b/
>
> The link target is copied verbatim into the symlink, so I don't see why
> they need to be qualified?
>
> (FWIW the path command doesn't resolve symlinks, so it really only
> checks that /a/d and /a/f exist and are of type symlink.)

Sorry, I got confused. The patch looks good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@xxxxxxxxx>

-- 
chandan



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux