diff options
author | Christoph Hellwig <hch@lst.de> | 2010-10-21 21:11:48 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-10-21 21:11:48 +0200 |
commit | 5411ceb991a363d023c41f86dbb49f202c210365 (patch) | |
tree | d7866c18230233c9eaa43398aa6afc3a36d09b30 | |
parent | f1436346b45d7ecb9d4d0be0fd4c1b456a2bf357 (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-x | 020 | 4 | ||||
-rwxr-xr-x | 021 | 5 | ||||
-rwxr-xr-x | 062 | 3 | ||||
-rwxr-xr-x | 063 | 3 | ||||
-rwxr-xr-x | 067 | 1 | ||||
-rwxr-xr-x | 070 | 3 | ||||
-rwxr-xr-x | 077 | 2 | ||||
-rwxr-xr-x | 079 | 3 | ||||
-rwxr-xr-x | 093 | 2 | ||||
-rwxr-xr-x | 114 | 2 | ||||
-rwxr-xr-x | 115 | 2 | ||||
-rwxr-xr-x | 117 | 2 | ||||
-rwxr-xr-x | 136 | 3 | ||||
-rwxr-xr-x | 186 | 4 | ||||
-rwxr-xr-x | 187 | 6 | ||||
-rw-r--r-- | common.attr | 28 |
16 files changed, 66 insertions, 7 deletions
@@ -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 @@ -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 @@ -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 @@ -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 @@ -42,6 +42,7 @@ _supported_fs xfs _supported_os Linux _need_to_be_root +_require_attrs _require_acls _require_scratch @@ -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 \ @@ -52,7 +52,7 @@ _supported_os Linux [ ! -d $filler ] && _notrun "No directory to source files from" -_require_scratch +_require_attrs _require_acls _require_user @@ -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 @@ -60,6 +60,8 @@ _filefilter() _supported_fs generic _supported_os IRIX +_require_attrs + [ -x $runas ] || _notrun "$runas executable not found" rm -f $seq.full @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 |