diff mbox series

[14/14] xfs/851: test xfs_io parent -p too

Message ID 167899417839.17926.13744291683244196909.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series [01/14] xfs/122: update for parent pointers | expand

Commit Message

Darrick J. Wong March 16, 2023, 7:36 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Test the -p argument to the xfs_io parent command too.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/851     |   15 +++++++++++++++
 tests/xfs/851.out |   10 ++++++++++
 2 files changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/tests/xfs/851 b/tests/xfs/851
index 27870ec05a..8233c1563c 100755
--- a/tests/xfs/851
+++ b/tests/xfs/851
@@ -12,6 +12,7 @@  _begin_fstest auto quick parent
 
 # get standard environment, filters and checks
 . ./common/parent
+. ./common/filter
 
 # Modify as appropriate
 _supported_fs xfs
@@ -96,6 +97,20 @@  ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)"
 mv -f $SCRATCH_MNT/$testfolder2/$file3 $SCRATCH_MNT/$testfolder1/$file2
 _verify_parent "$testfolder1" "$file2" "$testfolder1/$file2"
 
+# Make sure that parent -p filtering works
+mkdir -p $SCRATCH_MNT/dira/ $SCRATCH_MNT/dirb/
+dira_inum=$(stat -c '%i' $SCRATCH_MNT/dira)
+dirb_inum=$(stat -c '%i' $SCRATCH_MNT/dirb)
+touch $SCRATCH_MNT/gorn
+ln $SCRATCH_MNT/gorn $SCRATCH_MNT/dira/file1
+ln $SCRATCH_MNT/gorn $SCRATCH_MNT/dirb/file1
+echo look for both
+$XFS_IO_PROG -c 'parent -p' $SCRATCH_MNT/gorn | _filter_scratch
+echo look for dira
+$XFS_IO_PROG -c 'parent -p -n dira' -c "parent -p -i $dira_inum" $SCRATCH_MNT/gorn | _filter_scratch
+echo look for dirb
+$XFS_IO_PROG -c 'parent -p -n dirb' -c "parent -p -i $dirb_inum" $SCRATCH_MNT/gorn | _filter_scratch
+
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/851.out b/tests/xfs/851.out
index c375ba5f00..f44d3e5d4f 100644
--- a/tests/xfs/851.out
+++ b/tests/xfs/851.out
@@ -57,3 +57,13 @@  QA output created by 851
 *** testfolder1/file2 OK
 *** Verified parent pointer: name:file2, namelen:5
 *** Parent pointer OK for child testfolder1/file2
+look for both
+SCRATCH_MNT/gorn
+SCRATCH_MNT/dira/file1
+SCRATCH_MNT/dirb/file1
+look for dira
+SCRATCH_MNT/dira/file1
+SCRATCH_MNT/dira/file1
+look for dirb
+SCRATCH_MNT/dirb/file1
+SCRATCH_MNT/dirb/file1