Re: [PATCH v2 2/4] xfs: add parent pointer test

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

 



On Wed, 2022-10-12 at 11:02 +0800, Zorro Lang wrote:
> On Tue, Oct 11, 2022 at 06:38:10PM -0700, Catherine Hoang wrote:
> > From: Allison Henderson <allison.henderson@xxxxxxxxxx>
> > 
> > Add a test to verify basic parent pointers operations (create,
> > move, link,
> > unlink, rename, overwrite).
> > 
> > Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx>
> > Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx>
> > ---
> >  doc/group-names.txt |   1 +
> >  tests/xfs/554       | 125
> > ++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/554.out   |  59 +++++++++++++++++++++
> >  3 files changed, 185 insertions(+)
> >  create mode 100755 tests/xfs/554
> >  create mode 100644 tests/xfs/554.out
> > 
> > diff --git a/doc/group-names.txt b/doc/group-names.txt
> > index ef411b5e..8e35c699 100644
> > --- a/doc/group-names.txt
> > +++ b/doc/group-names.txt
> > @@ -77,6 +77,7 @@ nfs4_acl              NFSv4 access control lists
> >  nonsamefs              overlayfs layers on different filesystems
> >  online_repair          online repair functionality tests
> >  other                  dumping ground, do not add more tests to
> > this group
> > +parent                 Parent pointer tests
> >  pattern                        specific IO pattern tests
> >  perms                  access control and permission checking
> >  pipe                   pipe functionality
> > diff --git a/tests/xfs/554 b/tests/xfs/554
> > new file mode 100755
> > index 00000000..26914e4c
> > --- /dev/null
> > +++ b/tests/xfs/554
> > @@ -0,0 +1,125 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2022, Oracle and/or its affiliates.  All Rights
> > Reserved.
> > +#
> > +# FS QA Test 554
> > +#
> > +# simple parent pointer test
> > +#
> > +
> > +. ./common/preamble
> > +_begin_fstest auto quick parent
> > +
> > +cleanup()
> > +{
> > +       cd /
> > +       rm -f $tmp.*
> > +}
> 
> This's same with common cleanup function, you can remove this
> function.
Ok, these tests were initially written before these helpers were
hoisted into a common location, so it makes sense to clean them out
now.

> 
> > +
> > +full()
> > +{
> > +    echo ""            >>$seqres.full
> > +    echo "*** $* ***"  >>$seqres.full
> > +    echo ""            >>$seqres.full
> > +}
> 
> What's this function for? I didn't see this function is called in
> this case.
> Am I missing something?
I think it's another common helper that's over in common/log now.  I
suspect it was just reminiscent of the test case I modeled this after
at the time.  It should likely come out now too.

> 
> > +
> > +# get standard environment, filters and checks
> > +. ./common/filter
> > +. ./common/reflink
> > +. ./common/inject
> > +. ./common/parent
> > +
> > +# Modify as appropriate
> > +_supported_fs xfs
> > +_require_scratch
> > +_require_xfs_sysfs debug/larp
> > +_require_xfs_io_error_injection "larp"
> > +_require_xfs_parent
> > +_require_xfs_io_command "parent"
> > +
> > +# real QA test starts here
> > +
> > +# Create a directory tree using a protofile and
> > +# make sure all inodes created have parent pointers
> > +
> > +protofile=$tmp.proto
> > +
> > +cat >$protofile <<EOF
> > +DUMMY1
> > +0 0
> > +: root directory
> > +d--777 3 1
> > +: a directory
> > +testfolder1 d--755 3 1
> > +file1 ---755 3 1 /dev/null
> > +$
> > +: back in the root
> > +testfolder2 d--755 3 1
> > +file2 ---755 3 1 /dev/null
> > +: done
> > +$
> > +EOF
> > +
> > +if [ $? -ne 0 ]
> > +then
> > +    _fail "failed to create test protofile"
> > +fi
> 
> It just writes a general file, right? Is there any special reason
> might cause
> write fail?
> 
> I think we don't need to check each step's return value. And if we
> fail to write
> a file, bash helps to output error message to break golden image too.
> 
I think I had borrowed this from the protofile test case
(tests/xfs/019).  But yes, if the file creation were to fail, I think
the mkfs command will just error out.  It should be fine to take it out
if folks prefer.  Thanks for the reviews!

Allison

> Thanks,
> Zorro
> 
> > +
> > +_scratch_mkfs -f -n parent=1 -p $protofile >>$seqres.full 2>&1 \
> > +       || _fail "mkfs failed"
> > +_check_scratch_fs
> > +
> > +_scratch_mount >>$seqres.full 2>&1 \
> > +       || _fail "mount failed"
> > +
> > +testfolder1="testfolder1"
> > +testfolder2="testfolder2"
> > +file1="file1"
> > +file2="file2"
> > +file3="file3"
> > +file4="file4"
> > +file5="file5"
> > +file1_ln="file1_link"
> > +
> > +echo ""
> > +# Create parent pointer test
> > +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1"
> > +
> > +echo ""
> > +# Move parent pointer test
> > +mv $SCRATCH_MNT/$testfolder1/$file1
> > $SCRATCH_MNT/$testfolder2/$file1
> > +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1"
> > +
> > +echo ""
> > +# Hard link parent pointer test
> > +ln $SCRATCH_MNT/$testfolder2/$file1
> > $SCRATCH_MNT/$testfolder1/$file1_ln
> > +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln"
> > +_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1"
> > +_verify_parent "$testfolder2" "$file1"    "$testfolder1/$file1_ln"
> > +_verify_parent "$testfolder2" "$file1"    "$testfolder2/$file1"
> > +
> > +echo ""
> > +# Remove hard link parent pointer test
> > +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)"
> > +rm $SCRATCH_MNT/$testfolder2/$file1
> > +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln"
> > +_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln"
> > +
> > +echo ""
> > +# Rename parent pointer test
> > +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)"
> > +mv $SCRATCH_MNT/$testfolder1/$file1_ln
> > $SCRATCH_MNT/$testfolder1/$file2
> > +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2"
> > +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2"
> > +
> > +echo ""
> > +# Over write parent pointer test
> > +touch $SCRATCH_MNT/$testfolder2/$file3
> > +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3"
> > +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)"
> > +mv -f $SCRATCH_MNT/$testfolder2/$file3
> > $SCRATCH_MNT/$testfolder1/$file2
> > +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/554.out b/tests/xfs/554.out
> > new file mode 100644
> > index 00000000..67ea9f2b
> > --- /dev/null
> > +++ b/tests/xfs/554.out
> > @@ -0,0 +1,59 @@
> > +QA output created by 554
> > +
> > +*** testfolder1 OK
> > +*** testfolder1/file1 OK
> > +*** testfolder1/file1 OK
> > +*** Verified parent pointer: name:file1, namelen:5
> > +*** Parent pointer OK for child testfolder1/file1
> > +
> > +*** testfolder2 OK
> > +*** testfolder2/file1 OK
> > +*** testfolder2/file1 OK
> > +*** Verified parent pointer: name:file1, namelen:5
> > +*** Parent pointer OK for child testfolder2/file1
> > +
> > +*** testfolder1 OK
> > +*** testfolder1/file1_link OK
> > +*** testfolder1/file1_link OK
> > +*** Verified parent pointer: name:file1_link, namelen:10
> > +*** Parent pointer OK for child testfolder1/file1_link
> > +*** testfolder1 OK
> > +*** testfolder2/file1 OK
> > +*** testfolder1/file1_link OK
> > +*** Verified parent pointer: name:file1_link, namelen:10
> > +*** Parent pointer OK for child testfolder2/file1
> > +*** testfolder2 OK
> > +*** testfolder1/file1_link OK
> > +*** testfolder2/file1 OK
> > +*** Verified parent pointer: name:file1, namelen:5
> > +*** Parent pointer OK for child testfolder1/file1_link
> > +*** testfolder2 OK
> > +*** testfolder2/file1 OK
> > +*** testfolder2/file1 OK
> > +*** Verified parent pointer: name:file1, namelen:5
> > +*** Parent pointer OK for child testfolder2/file1
> > +
> > +*** testfolder1 OK
> > +*** testfolder1/file1_link OK
> > +*** testfolder1/file1_link OK
> > +*** Verified parent pointer: name:file1_link, namelen:10
> > +*** Parent pointer OK for child testfolder1/file1_link
> > +*** testfolder1/file1_link OK
> > +
> > +*** testfolder1 OK
> > +*** testfolder1/file2 OK
> > +*** testfolder1/file2 OK
> > +*** Verified parent pointer: name:file2, namelen:5
> > +*** Parent pointer OK for child testfolder1/file2
> > +*** testfolder1/file2 OK
> > +
> > +*** testfolder2 OK
> > +*** testfolder2/file3 OK
> > +*** testfolder2/file3 OK
> > +*** Verified parent pointer: name:file3, namelen:5
> > +*** Parent pointer OK for child testfolder2/file3
> > +*** testfolder1 OK
> > +*** testfolder1/file2 OK
> > +*** testfolder1/file2 OK
> > +*** Verified parent pointer: name:file2, namelen:5
> > +*** Parent pointer OK for child testfolder1/file2
> > -- 
> > 2.25.1
> > 
> 





[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