linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Catherine Hoang <catherine.hoang@oracle.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH v2 2/4] xfs: add parent pointer test
Date: Wed, 12 Oct 2022 11:02:20 +0800	[thread overview]
Message-ID: <20221012030220.ng5xra7deoeutb77@zlang-mailbox> (raw)
In-Reply-To: <20221012013812.82161-3-catherine.hoang@oracle.com>

On Tue, Oct 11, 2022 at 06:38:10PM -0700, Catherine Hoang wrote:
> From: Allison Henderson <allison.henderson@oracle.com>
> 
> Add a test to verify basic parent pointers operations (create, move, link,
> unlink, rename, overwrite).
> 
> Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> ---
>  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.

> +
> +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?

> +
> +# 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.

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
> 


  reply	other threads:[~2022-10-12  3:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  1:38 [PATCH v2 0/4] xfstests: add parent pointer tests Catherine Hoang
2022-10-12  1:38 ` [PATCH v2 1/4] common: add helpers for " Catherine Hoang
2022-10-12  1:38 ` [PATCH v2 2/4] xfs: add parent pointer test Catherine Hoang
2022-10-12  3:02   ` Zorro Lang [this message]
2022-10-12  3:10     ` Zorro Lang
2022-10-13 19:55       ` Allison Henderson
2022-10-14  1:24         ` Zorro Lang
2022-10-13 19:07     ` Allison Henderson
2022-10-12  1:38 ` [PATCH v2 3/4] xfs: add multi link " Catherine Hoang
2022-10-12  1:38 ` [PATCH v2 4/4] xfs: add parent pointer inject test Catherine Hoang

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=20221012030220.ng5xra7deoeutb77@zlang-mailbox \
    --to=zlang@redhat.com \
    --cc=catherine.hoang@oracle.com \
    --cc=fstests@vger.kernel.org \
    --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).