public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
	fstests@vger.kernel.org,
	Chandan Rajendra <chandan@linux.vnet.ibm.com>
Subject: [PATCH] overlay/038: fix impure xattr test
Date: Fri, 15 Sep 2017 13:47:28 +0300	[thread overview]
Message-ID: <1505472448-588-1-git-send-email-amir73il@gmail.com> (raw)

On kvm-xfstest, getfattr (2.4.43) does not return failure exit code
when the requested xattr is not found.

Change the test to check the returned xattr value instead of exit code.

Cc: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---

Eryu,

This test is supposed to pass on master now and it does pass on my
Ubuntu 16.04, but fails on kvm-xfstests (Debian stretch).

The failure is due to different behavior of getfattr on different
systems and as a result of me suggesting to Chandan to check getfattr
exit code. So this patch is for my redemption ;-)

I surveyed for other places that check exit code of getfattr as
indication of ENODATA and found only one other instance in
_require_scratch_richacl_support() (for non xfs/ext4 FSTYP).
However, this instance is buggy regardless, because it provides no
file argument to getfattr.
I would fix it, but I am not sure what's the semantics and have no
idea how to test this.

Amir.


 tests/overlay/038 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/overlay/038 b/tests/overlay/038
index 24cd432..69fd76a 100755
--- a/tests/overlay/038
+++ b/tests/overlay/038
@@ -108,9 +108,9 @@ test_file_st_ino=$(stat -c '%i' $SCRATCH_MNT/test_file)
 
 mv $SCRATCH_MNT/test_file $impure_dir
 
-$GETFATTR_PROG --absolute-names -n 'trusted.overlay.impure' \
-	       $upperdir/test_dir/impure_dir >>$seqres.full 2>&1
-[[ $? == 0 ]] || echo "Impure directory missing impure xattr"
+impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impure' \
+			$upperdir/test_dir/impure_dir)
+[[ $impure == "y" ]] || echo "Impure directory missing impure xattr"
 
 # After $impure_dir becomes impure
 parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino)
@@ -133,9 +133,9 @@ rm -rf $impure_dir/test_file
 $here/src/t_dir_type $impure_dir $test_file_st_ino
 [[ $? != 0 ]] || echo "Directory's readdir cache has stale entries"
 
-$GETFATTR_PROG --absolute-names -n 'trusted.overlay.impure' \
-	       $upperdir/test_dir/impure_dir >>$seqres.full 2>&1
-[[ $? != 0 ]] || echo "Pure directory has impure xattr"
+impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impure' \
+			$upperdir/test_dir/impure_dir 2>/dev/null)
+[[ -z $impure ]] || echo "Pure directory has impure xattr"
 
 # Verify d_ino values corresponding to "." and ".." entries of a
 # pure lower dir.
-- 
2.7.4


             reply	other threads:[~2017-09-15 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 10:47 Amir Goldstein [this message]
2017-09-16  5:09 ` [PATCH] overlay/038: fix impure xattr test Chandan Rajendra

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=1505472448-588-1-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=agruenba@redhat.com \
    --cc=chandan@linux.vnet.ibm.com \
    --cc=eguan@redhat.com \
    --cc=fstests@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