summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-10-21 21:11:48 +0200
committerChristoph Hellwig <hch@lst.de>2010-10-21 21:11:48 +0200
commit5411ceb991a363d023c41f86dbb49f202c210365 (patch)
treed7866c18230233c9eaa43398aa6afc3a36d09b30
parentf1436346b45d7ecb9d4d0be0fd4c1b456a2bf357 (diff)
xfstests: add _require_attrs
Add a new helper to check if extended attributes are supported. It errors out if any of the attr tools are not found, or if a filesystem does not support setting attributes. Remove the opencoded checks for the attr tools from various tests now that we do them in common code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com>
-rwxr-xr-x0204
-rwxr-xr-x0215
-rwxr-xr-x0623
-rwxr-xr-x0633
-rwxr-xr-x0671
-rwxr-xr-x0703
-rwxr-xr-x0772
-rwxr-xr-x0793
-rwxr-xr-x0932
-rwxr-xr-x1142
-rwxr-xr-x1152
-rwxr-xr-x1172
-rwxr-xr-x1363
-rwxr-xr-x1864
-rwxr-xr-x1876
-rw-r--r--common.attr28
16 files changed, 66 insertions, 7 deletions
diff --git a/020 b/020
index 7f4fb5ac..56b9c3c3 100755
--- a/020
+++ b/020
@@ -35,6 +35,7 @@ trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_cleanup()
{
@@ -82,8 +83,7 @@ _attr_list()
_supported_fs xfs udf
_supported_os Linux
-[ -n $ATTR_PROG ] || _notrun "attr is not installed"
-[ -n $GETFATTR_PROG ] || _notrun "getfattr is not installed"
+_require_attrs
_setup_testdir
diff --git a/021 b/021
index 10c46114..3dac4515 100755
--- a/021
+++ b/021
@@ -33,6 +33,7 @@ status=0 # success is the default!
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_cleanup()
{
@@ -76,10 +77,8 @@ _getfattr()
_supported_fs xfs
_supported_os Linux
-[ -n $ATTR_PROG ] || _notrun "attr is not installed"
-[ -n $GETFATTR_PROG ] || _notrun "getfattr is not installed"
-
_require_scratch
+_require_attrs
rm -f $seq.full
umount $SCRATCH_DEV >/dev/null 2>&1
diff --git a/062 b/062
index 2bae6a3d..b29512b0 100755
--- a/062
+++ b/062
@@ -35,6 +35,7 @@ status=1 # failure is the default!
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_cleanup()
{
@@ -120,6 +121,8 @@ _supported_fs xfs udf nfs
_supported_os Linux
_require_scratch
+_require_attrs
+
rm -f $tmp.backup1 $tmp.backup2 $seq.full
# real QA test starts here
diff --git a/063 b/063
index d2b8a9fc..42a323a9 100755
--- a/063
+++ b/063
@@ -36,11 +36,14 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
. ./common.rc
. ./common.filter
. ./common.dump
+. ./common.attr
# real QA test starts here
_supported_fs xfs
_supported_os Linux
+_require_attrs
+
# create files with EAs
_create_dumpdir_fill_ea
diff --git a/067 b/067
index 2669f15a..8c67a5aa 100755
--- a/067
+++ b/067
@@ -42,6 +42,7 @@ _supported_fs xfs
_supported_os Linux
_need_to_be_root
+_require_attrs
_require_acls
_require_scratch
diff --git a/070 b/070
index 5dca4767..44580118 100755
--- a/070
+++ b/070
@@ -42,11 +42,14 @@ _cleanup()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
# real QA test starts here
_supported_fs generic
_supported_os IRIX Linux
+_require_attrs
+
_setup_testdir
$FSSTRESS_PROG \
diff --git a/077 b/077
index 4e12163c..3fb3e817 100755
--- a/077
+++ b/077
@@ -52,7 +52,7 @@ _supported_os Linux
[ ! -d $filler ] && _notrun "No directory to source files from"
-_require_scratch
+_require_attrs
_require_acls
_require_user
diff --git a/079 b/079
index 151835c8..6c43fe7e 100755
--- a/079
+++ b/079
@@ -44,11 +44,14 @@ _cleanup()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_supported_fs xfs
_supported_os Linux
+_require_attrs
_require_scratch
+
[ -x $timmutable ] || _notrun "t_immutable was not built for this platform"
# real QA test starts here
diff --git a/093 b/093
index 4f14d86a..4682c885 100755
--- a/093
+++ b/093
@@ -60,6 +60,8 @@ _filefilter()
_supported_fs generic
_supported_os IRIX
+_require_attrs
+
[ -x $runas ] || _notrun "$runas executable not found"
rm -f $seq.full
diff --git a/114 b/114
index 8787937b..76792229 100755
--- a/114
+++ b/114
@@ -308,11 +308,13 @@ _test_dirstress()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_supported_fs xfs
_supported_os IRIX
_require_scratch
+_require_attrs
_need_to_be_root
rm -f $here/$seq.full
diff --git a/115 b/115
index 8ef0e4cc..26895f7d 100755
--- a/115
+++ b/115
@@ -95,11 +95,13 @@ _filter()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
_supported_fs xfs
_supported_os IRIX
_require_scratch
+_require_attrs
rm -f $here/$seq.full
diff --git a/117 b/117
index 915520fa..dd880cbb 100755
--- a/117
+++ b/117
@@ -48,6 +48,7 @@ _cleanup()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
# real QA test starts here
_supported_fs xfs
@@ -55,6 +56,7 @@ _supported_os IRIX Linux
_setup_testdir
_require_scratch
+_require_attrs
rm -f $seq.full
umount $SCRATCH_DEV >/dev/null 2>&1
diff --git a/136 b/136
index abc23e96..109180ac 100755
--- a/136
+++ b/136
@@ -43,6 +43,7 @@ _cleanup()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
# real QA test starts here
@@ -51,7 +52,9 @@ _cleanup()
# Modify as appropriate.
_supported_fs xfs
_supported_os IRIX Linux
+
_require_scratch
+_require_attrs
export MKFS_OPTIONS="-i size=512,attr=2"
_scratch_mkfs_xfs > /dev/null 2>&1
diff --git a/186 b/186
index 80c406df..a2d7e144 100755
--- a/186
+++ b/186
@@ -139,13 +139,17 @@ _changeto_attr1()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
# real QA test starts here
# Modify as appropriate.
_supported_fs xfs
_supported_os Linux
+
_require_scratch
+_require_attrs
+
rm -f $seq.full
_scratch_mkfs -i attr=2,size=512 -l lazy-count=1 >/dev/null 2>&1
diff --git a/187 b/187
index ad280515..8086c8e3 100755
--- a/187
+++ b/187
@@ -51,11 +51,15 @@ _filter_version()
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
+. ./common.attr
# real QA test starts here
-_require_scratch
_supported_fs xfs
_supported_os Linux
+
+_require_scratch
+_require_attrs
+
rm -f $seq.full
# lazysb and attr2 are in features2 and will require morebitsbit on
diff --git a/common.attr b/common.attr
index 3dde5532..343edfca 100644
--- a/common.attr
+++ b/common.attr
@@ -148,5 +148,33 @@ _list_acl()
ls -dD $file | _acl_filter_id
}
+_require_attrs()
+{
+ [ -n $ATTR_PROG ] || _notrun "attr command not found"
+ [ -n $GETFATTR_PROG ] || _notrun "getfattr command not found"
+ [ -n $SETFATTR_PROG ] || _notrun "setfattr command not found"
+
+ #
+ # Test if chacl is able to write an attribute on the target filesystems.
+ # On really old kernels the system calls might not be implemented at all,
+ # but the more common case is that the tested filesystem simply doesn't
+ # support attributes. Note that we can't simply list attributes as
+ # various security modules generate synthetic attributes not actually
+ # stored on disk.
+ #
+ touch $TEST_DIR/syscalltest
+ attr -s "user.xfstests" -V "attr" /mnt/test/ > $TEST_DIR/syscalltest.out 2>&1
+ cat $TEST_DIR/syscalltest.out >> $here/$seq.full
+
+ if grep -q 'Function not implemented' $TEST_DIR/syscalltest.out; then
+ _notrun "kernel does not support attrs"
+ fi
+ if grep -q 'Operation not supported' $TEST_DIR/syscalltest.out; then
+ _notrun "attrs not supported by this filesystem type: $FSTYP"
+ fi
+
+ rm -f $TEST_DIR/syscalltest.out
+}
+
# make sure this script returns success
/bin/true