mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: introduce a common directory
Introduce a top level common directory and move all the common.* files into it. Because there is now a directory named common, the prefix can be dropped from all the files. Convert all the tests to use this new directory for including common files. for f in common.*; do \ git mv `echo -n "$f " ; echo $f | sed -e 's;n\.;n/;'` \ done Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Phil White <pwhite@sgi.com> [rjohnston@sgi.com reworked for TOT changes] Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
committed by
Rich Johnston
parent
401680a11c
commit
8c4905a42e
@@ -0,0 +1,71 @@
|
||||
##/bin/bash
|
||||
#
|
||||
# Copyright (c) 2009 Eric Sandeen
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# Functions useful for defragmentation tests
|
||||
#
|
||||
|
||||
_require_defrag()
|
||||
{
|
||||
case "$FSTYP" in
|
||||
xfs)
|
||||
DEFRAG_PROG="$XFS_FSR_PROG"
|
||||
;;
|
||||
ext4|ext4dev)
|
||||
DEFRAG_PROG="$E4DEFRAG_PROG"
|
||||
;;
|
||||
btrfs)
|
||||
DEFRAG_PROG="$BTRFS_UTIL_PROG filesystem defragment"
|
||||
;;
|
||||
*)
|
||||
_notrun "defragmentation not supported for fstype \"$FSTYP\""
|
||||
;;
|
||||
esac
|
||||
|
||||
_require_command $DEFRAG_PROG
|
||||
_require_command $FILEFRAG_PROG
|
||||
}
|
||||
|
||||
_extent_count()
|
||||
{
|
||||
$FILEFRAG_PROG $1 | awk '{print $2}'
|
||||
$FILEFRAG_PROG -v $1 >> $RESULT_DIR/$seq.full 2>&1
|
||||
}
|
||||
|
||||
# Defrag file, check it, and remove it.
|
||||
_defrag()
|
||||
{
|
||||
echo -n "Before: "
|
||||
_extent_count $1
|
||||
CSUM_BEFORE=`md5sum $1`
|
||||
STAT_BEFORE=`stat -c "a: %x m: %y c: %z" $1`
|
||||
$DEFRAG_PROG -v $1 >> $RESULT_DIR/$seq.full 2>&1
|
||||
_scratch_remount
|
||||
STAT_AFTER=`stat -c "a: %x m: %y c: %z" $1`
|
||||
CSUM_AFTER=`md5sum $1`
|
||||
echo -n "After: "
|
||||
_extent_count $1
|
||||
if [ "$CSUM_BEFORE" != "$CSUM_AFTER" ]; then
|
||||
_fail "file checksum changed post-defrag ($CSUM_BEFORE/$CSUM_AFTER)"
|
||||
fi
|
||||
if [ "$STAT_BEFORE" != "$STAT_AFTER" ]; then
|
||||
_fail "file timestamps changed post-defrag:\n$STAT_BEFORE\n$STAT_AFTER"
|
||||
fi
|
||||
rm -f $1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user