X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=blobdiff_plain;f=tests%2Fgeneric%2F062;h=ba7448854996fb8675cda6f6406c31aadda5a21d;hp=3826c179fb7d3f87b03a5178d1d58e14d61ece57;hb=2b0162607d68d62eff46f22e4fd376a6bb8ce138;hpb=8c4905a42e10650a75c0e3966ecc044e1a9616d0 diff --git a/tests/generic/062 b/tests/generic/062 index 3826c179..ba744885 100755 --- a/tests/generic/062 +++ b/tests/generic/062 @@ -1,32 +1,14 @@ #! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. +# # FS QA Test No. 062 # # Exercises the getfattr/setfattr tools # Derived from tests originally written by Andreas Gruenbacher for ext2 # -#----------------------------------------------------------------------- -# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it would be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -#----------------------------------------------------------------------- -# - seq=`basename $0` seqres=$RESULT_DIR/$seq -seqres=$RESULT_DIR/$seq -seqres=$RESULT_DIR/$seq echo "QA output created by $seq" here=`pwd` @@ -42,14 +24,14 @@ _cleanup() { cd / echo; echo "*** unmount" - umount $SCRATCH_MNT 2>/dev/null + _scratch_unmount 2>/dev/null rm -f $tmp.* } trap "_cleanup; exit \$status" 0 1 2 3 15 getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + _getfattr --absolute-names -dh $@ 2>&1 | _filter_scratch } setfattr() @@ -65,7 +47,7 @@ _create_test_bed() ln -s $SCRATCH_MNT/dir $SCRATCH_MNT/lnk mkdir $SCRATCH_MNT/dev mknod $SCRATCH_MNT/dev/b b 0 0 - mknod $SCRATCH_MNT/dev/c c 0 0 + mknod $SCRATCH_MNT/dev/c c 1 3 mknod $SCRATCH_MNT/dev/p p # sanity check find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found" @@ -77,12 +59,13 @@ _supported_os Linux _require_scratch _require_attrs +_require_symlinks rm -f $tmp.backup1 $tmp.backup2 $seqres.full # real QA test starts here _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" -_scratch_mount || _fail "mount failed" +_scratch_mount _create_test_bed # In kernels before 3.0, getxattr() fails with EPERM for an attribute which @@ -142,7 +125,6 @@ for nsp in $ATTR_MODES; do done done - # # Test the directory descent code # @@ -174,7 +156,6 @@ echo echo "*** directory descent without following symlinks" getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr_output - # # Test the backup/restore code # @@ -182,8 +163,11 @@ echo; echo _backup() { - # NB: no filtering of scratch here... (need to restore too) - $GETFATTR_PROG --absolute-names -dh -R -m '.' $SCRATCH_MNT >$1 + # Note: we don't filter scratch here since we need to restore too. But + # we *do* sort the output by path, since it otherwise would depend on + # readdir order, which on some filesystems may change after re-creating + # the files. + _getfattr --absolute-names -dh -R -m '.' $SCRATCH_MNT | _sort_getfattr_output >$1 echo BACKUP $1 >>$seqres.full cat $1 >> $seqres.full [ ! -s $1 ] && echo "warning: $1 (backup file) is empty" @@ -193,7 +177,7 @@ echo "*** backup everything" _backup $tmp.backup1 echo "*** clear out the scratch device" -rm -fr $SCRATCH_MNT/* +rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found") echo "AFTER REMOVE" >>$seqres.full getfattr -L -R -m '.' $SCRATCH_MNT >>$seqres.full