From: tmarek@redhat.com
To: xfs@oss.sgi.com
Cc: Tom Marek <tmarek@redhat.com>, lczerner@redhat.com, dchinner@redhat.com
Subject: [PATCH 1/5] xfstests 062: fix support for ext4 and SELinux
Date: Fri, 13 Apr 2012 11:49:42 +0200 [thread overview]
Message-ID: <1334310586-2281-1-git-send-email-tmarek@redhat.com> (raw)
From: Tom Marek <tmarek@redhat.com>
Tests number 062 was supposed to work with ext4 fs but there were some
problems in it - Tests haven't considered existence of lost+found directory in
ext4. Also when scratch was mounted with SELinux context test failed because
fgetattr returns SELinux extended attributes. And when fgetattr is run with
recursive flag it's output might change between file systems due to different
file ordering. Fix this by sorting the output manually. Also all lines
containing SELinux and lost+found were removed from output.
Signed-off-by: Tom Marek <tmarek@redhat.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
---
062 | 50 ++++++++++++++++++++++++++---------
062.out | 90 +++++++++++++++++++++++++++++++-------------------------------
2 files changed, 82 insertions(+), 58 deletions(-)
diff --git a/062 b/062
index f666e1b..116296b 100755
--- a/062
+++ b/062
@@ -46,6 +46,30 @@ _cleanup()
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+# remove "security.selinux=..." because it is not installed on all systems
+# and it not relevant to this test
+_remove_selinux(){
+ egrep -v '^(selinux|security\.selinux)'
+}
+
+# sort getfattr output and remove entries containing only selinux attributes
+_sort_getfattr(){
+ awk '
+ BEGIN{
+ RS=""
+ }
+ {
+ a[FNR]=$0
+ }
+ END{
+ n = asort(a);
+ for(i = 1; i <= n; ++i){
+ if (a[i] ~ /# file: SCRATCH_MNT[^\n]*\nsecurity.selinux[^\n]*\n/)
+ print a[i] "\n"
+ }
+ }'
+}
+
getfattr()
{
$GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +91,7 @@ _create_test_bed()
mknod $SCRATCH_MNT/dev/c c 0 0
mknod $SCRATCH_MNT/dev/p p
# sanity check
- find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+ find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
}
# real QA test starts here
@@ -102,7 +126,7 @@ for nsp in $ATTR_MODES; do
echo "*** set/get one initially empty attribute"
setfattr -h -n $nsp.name $SCRATCH_MNT/$inode
- getfattr -m $nsp $SCRATCH_MNT/$inode
+ getfattr -m $nsp $SCRATCH_MNT/$inode | _remove_selinux
echo "*** overwrite empty, set several new attributes"
setfattr -h -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +134,33 @@ for nsp in $ATTR_MODES; do
setfattr -h -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
echo "*** fetch several attribute names and values (hex)"
- getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
echo "*** fetch several attribute names and values (base64)"
- getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode | _remove_selinux
echo "*** shrink value of an existing attribute"
setfattr -h -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
echo "*** grow value of existing attribute"
setfattr -h -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
echo "*** set an empty value for second attribute"
setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
- getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+ getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
echo "*** overwrite empty value"
setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+ getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
echo "*** remove attribute"
setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+ getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
echo "*** final list (strings, type=$inode, nsp=$nsp)"
- getfattr -m '.' -e hex $SCRATCH_MNT/$inode
+ getfattr -m '.' -e hex $SCRATCH_MNT/$inode | _sort_getfattr | _remove_selinux
done
done
@@ -160,18 +184,18 @@ _extend_test_bed()
# whack a symlink in the middle, just to be difficult
ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
# dump out our new starting point
- find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+ find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
}
_extend_test_bed
echo
echo "*** directory descent with us following symlinks"
-getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
echo
echo "*** directory descent without following symlinks"
-getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
#
diff --git a/062.out b/062.out
index 699254a..8cc3c65 100644
--- a/062.out
+++ b/062.out
@@ -508,21 +508,21 @@ SCRATCH_MNT/lnk
SCRATCH_MNT/reg
*** directory descent with us following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend
+user.1=0x3233
+user.x=0x797a
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend/and/ascend
+trusted.9=0x3837
+trusted.a=0x6263
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
+# file: SCRATCH_MNT/descend/down
+user.1=0x3233
+user.x=0x797a
+
+# file: SCRATCH_MNT/descend/down/here
+user.1=0x3233
+user.x=0x797a
# file: SCRATCH_MNT/dev/b
trusted.name=0xbabe
@@ -536,6 +536,12 @@ trusted.name3=0xdeface
trusted.name=0xbabe
trusted.name3=0xdeface
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
# file: SCRATCH_MNT/here
trusted.9=0x3837
trusted.a=0x6263
@@ -548,6 +554,18 @@ trusted.a=0x6263
trusted.9=0x3837
trusted.a=0x6263
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
+
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
+
+*** directory descent without following symlinks
# file: SCRATCH_MNT/descend
user.1=0x3233
user.x=0x797a
@@ -560,28 +578,6 @@ user.x=0x797a
user.1=0x3233
user.x=0x797a
-# file: SCRATCH_MNT/descend/and/ascend
-trusted.9=0x3837
-trusted.a=0x6263
-
-
-*** directory descent without following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
-
# file: SCRATCH_MNT/dev/b
trusted.name=0xbabe
trusted.name3=0xdeface
@@ -594,6 +590,12 @@ trusted.name3=0xdeface
trusted.name=0xbabe
trusted.name3=0xdeface
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
# file: SCRATCH_MNT/here
trusted.9=0x3837
trusted.a=0x6263
@@ -606,17 +608,15 @@ trusted.a=0x6263
trusted.9=0x3837
trusted.a=0x6263
-# file: SCRATCH_MNT/descend
-user.1=0x3233
-user.x=0x797a
-
-# file: SCRATCH_MNT/descend/down
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
-# file: SCRATCH_MNT/descend/down/here
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
--
1.7.7.6
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2012-04-13 9:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 9:49 tmarek [this message]
2012-04-13 9:49 ` [PATCH 2/5] xfstests 233: fix user fsgqa access to fsstress tmarek
2012-04-13 9:49 ` [PATCH 3/5] xfstests 198, 240: added check for aiodio-sparse2 tmarek
2012-04-13 11:49 ` Dave Chinner
2012-04-13 9:49 ` [PATCH 4/5] xfstests: sync before umount to avoid device busy problems tmarek
2012-04-13 10:26 ` Stefan Behrens
2012-04-13 10:57 ` Lukas Czerner
2012-04-13 11:58 ` Dave Chinner
2012-04-16 6:57 ` Lukas Czerner
2012-04-13 11:15 ` Tom Marek
2012-04-13 9:49 ` [PATCH 5/5] xfstests 273: fix of reading scratch size and removing lost+found tmarek
2012-04-16 2:46 ` [PATCH 1/5] xfstests 062: fix support for ext4 and SELinux Eric Sandeen
2012-04-16 2:56 ` Eric Sandeen
2012-04-16 7:03 ` Lukas Czerner
2012-04-16 14:06 ` Eric Sandeen
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=1334310586-2281-1-git-send-email-tmarek@redhat.com \
--to=tmarek@redhat.com \
--cc=dchinner@redhat.com \
--cc=lczerner@redhat.com \
--cc=xfs@oss.sgi.com \
/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