From 6912082bc228b6f5d784c9b3d8538501a7bbe83f Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Fri, 19 Feb 2016 10:47:55 +1100 Subject: [PATCH] generic/079,277: require chattr, not xattrs Add a new helper, _require_chattr, which allows the test to explicitly check to see if the file system supports a specific chattr flag, as not all file systems support chattr +A or chattr +i, and the presence of extended attribute support is has nothing to do with a specific chattr flag being supported. Signed-off-by: Hugh Dickins Signed-off-by: Theodore Ts'o Reviewed-by: Christoph Hellwig Signed-off-by: Dave Chinner --- common/rc | 16 ++++++++++++++++ tests/generic/079 | 2 +- tests/generic/277 | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index c0ec905e..7a51f4f3 100644 --- a/common/rc +++ b/common/rc @@ -3128,6 +3128,22 @@ _xfs_bmapx_find() { "$XFS_IO_PROG" -c "bmap -${param}lpv" "$file" | grep -c "$@" } +_require_chattr() +{ + attribute=$1 + + touch $TEST_DIR/syscalltest + chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 + status=$? + chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 + if [ "$status" -ne 0 ]; then + _notrun "file system doesn't support chattr +$attribute" + fi + cat $TEST_DIR/syscalltest.out >> $seqres.full + + rm -f $TEST_DIR/syscalltest.out +} + _get_total_inode() { if [ -z "$1" ]; then diff --git a/tests/generic/079 b/tests/generic/079 index 041d9c0e..5cceeba0 100755 --- a/tests/generic/079 +++ b/tests/generic/079 @@ -48,7 +48,7 @@ _cleanup() _supported_fs generic _supported_os Linux -_require_attrs +_require_chattr i _require_scratch [ -x $timmutable ] || _notrun "t_immutable was not built for this platform" diff --git a/tests/generic/277 b/tests/generic/277 index f92235bc..8e2a32fb 100755 --- a/tests/generic/277 +++ b/tests/generic/277 @@ -44,7 +44,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux _require_scratch -_require_attrs +_require_chattr A _scratch_mkfs > /dev/null 2>&1 _scratch_mount -- 2.39.5