QA updates for testing xfs_copy

This commit is contained in:
fsgqa
2003-07-22 02:38:08 +00:00
parent 74e3d56bf2
commit 9a1f202608
4 changed files with 208 additions and 51 deletions
+121 -8
View File
@@ -1,6 +1,5 @@
#! /bin/sh
# XFS QA Test No. 073
# $Id: 073,v 1.1 2003/07/14 05:12:23 fsgqa Exp $
#
# Test xfs_copy
#
@@ -37,7 +36,7 @@
#-----------------------------------------------------------------------
#
# creator
owner=harshula@melbourne.sgi.com
owner=nathans@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
@@ -45,20 +44,134 @@ echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_cleanup()
{
umount $SCRATCH_MNT 2>/dev/null
umount $tmp.loop 2>/dev/null
[ -d $tmp.loop ] && rmdir $tmp.loop
[ -d $tmp.source_dir ] && rmdir $tmp.source_dir
rm -f $tmp.* /var/tmp/xfs_copy.log.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter_copy()
{
sed -e "s,$1,<FSIMAGE1>,g" -e "s,$2,<FSIMAGE2>,g"
}
_populate_scratch()
{
POSIXLY_CORRECT=yes \
dd if=/dev/zero of=$SCRATCH_MNT/big+attr count=1000 bs=4096
[ "$FAST_POPULATE" = true ] && return
echo $SCRATCH_MNT/big+attr | $here/src/fill2attr
$here/src/fill2fs --bytes=1048576 --filesize=4096 --stddev=0 --force \
--dir=$SCRATCH_MNT/fill --list=- > $tmp.manifest
}
_verify_copy()
{
target=$1
target_dir=$tmp.loop
source=$2
source_dir=$3
[ $source = $SCRATCH_DEV ] && _scratch_mount
echo checking new image
_check_filesystem $target
echo mounting new image on loopback
rmdir $target_dir 2>/dev/null
mkdir $target_dir
mount -t xfs -o loop $target $target_dir 2>/dev/null
if [ $? -ne 0 ]; then
echo retrying mount with nouuid option
mount -t xfs -o loop -o nouuid $target $target_dir
if [ $? -ne 0 ]; then
echo mount failed - evil!
return
fi
fi
echo comparing new image files to old
diff -Naur $source_dir $target_dir
echo comparing new image directories to old
find $source_dir \
| _filter_copy $source_dir '#' \
| LC_COLLATE=POSIX sort \
> $tmp.manifest1
find $target_dir \
| _filter_copy $target_dir '#' \
| LC_COLLATE=POSIX sort \
> $tmp.manifest2
[ -s $tmp.manifest1 ] || echo no directory output
diff -u $tmp.manifest1 $tmp.manifest2
echo comparing new image geometry to old
xfs_info $source_dir \
| _filter_copy $source_dir '#' \
| tr -s ' ' \
> $tmp.geometry1
xfs_info $target_dir \
| _filter_copy $target_dir '#' \
| tr -s ' ' \
> $tmp.geometry2
[ -s $tmp.geometry1 ] || echo no geometry output
diff -u $tmp.geometry1 $tmp.geometry2
echo unmounting and removing new image
umount $source $target
rm -f $target
}
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
[ -x /usr/sbin/xfs_copy ] || _notrun "xfs_copy binary not yet installed"
# real QA test starts here
_require_scratch
_require_loop
# if error
exit
_scratch_mkfs_xfs -dsize=41m | _filter_mkfs 2>/dev/null
_scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
# optional stuff if your test has verbose output to help resolve problems
#echo
#echo "If failure, check $seq.full (this) and $seq.full.ok (reference)"
echo
echo === populating scratch device
_populate_scratch
umount $SCRATCH_MNT 2>/dev/null
echo
echo === copying scratch device to single target
xfs_copy $SCRATCH_DEV $tmp.image | _filter_copy $tmp.image
_verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
echo
echo === copying scratch device to single target, duplicate UUID
xfs_copy -d $SCRATCH_DEV $tmp.image | _filter_copy $tmp.image
_verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
echo
echo === copying scratch device to single target, large ro device
/sbin/mkfs.xfs -dfile,name=$tmp.source,size=1t | _filter_mkfs 2>/dev/null
rmdir $tmp.source_dir 2>/dev/null
mkdir $tmp.source_dir
mount -t xfs -o loop $tmp.source $tmp.source_dir
cp -a $here $tmp.source_dir
mount -t xfs -o remount,ro $tmp.source $tmp.source_dir
xfs_copy $tmp.source $tmp.image | _filter_copy $tmp.image
_verify_copy $tmp.image $tmp.source $tmp.source_dir
echo
echo === copying scratch device to multiple targets
xfs_copy -L$tmp.log -b $SCRATCH_DEV $tmp.image1 $tmp.image2 \
| _filter_copy $tmp.image1 $tmp.image2
_verify_copy $tmp.image1 $SCRATCH_DEV $SCRATCH_MNT
_verify_copy $tmp.image2 $SCRATCH_DEV $SCRATCH_MNT
# success, all done
status=0
+73
View File
@@ -0,0 +1,73 @@
QA output created by 073
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
naming =VERN bsize=XXX
log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
=== populating scratch device
1000+0 records in
1000+0 records out
=== copying scratch device to single target
Creating file <FSIMAGE1>
0% ... 10% ... 20% ... 30% ... 40% ... 50% ... 60% ... 70% ... 80% ... 90% ... 100%
All copies completed.
checking new image
mounting new image on loopback
comparing new image files to old
comparing new image directories to old
comparing new image geometry to old
unmounting and removing new image
=== copying scratch device to single target, duplicate UUID
Creating file <FSIMAGE1>
0% ... 10% ... 20% ... 30% ... 40% ... 50% ... 60% ... 70% ... 80% ... 90% ... 100%
All copies completed.
checking new image
mounting new image on loopback
retrying mount with nouuid option
comparing new image files to old
comparing new image directories to old
comparing new image geometry to old
unmounting and removing new image
=== copying scratch device to single target, large ro device
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
naming =VERN bsize=XXX
log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
Creating file <FSIMAGE1>
0% ... 10% ... 20% ... 30% ... 40% ... 50% ... 60% ... 70% ... 80% ... 90% ... 100%
All copies completed.
checking new image
mounting new image on loopback
comparing new image files to old
comparing new image directories to old
comparing new image geometry to old
unmounting and removing new image
=== copying scratch device to multiple targets
Creating file <FSIMAGE1>
Creating file <FSIMAGE2>
0% ... 10% ... 20% ... 30% ... 40% ... 50% ... 60% ... 70% ... 80% ... 90% ... 100%
All copies completed.
checking new image
mounting new image on loopback
comparing new image files to old
comparing new image directories to old
comparing new image geometry to old
unmounting and removing new image
checking new image
mounting new image on loopback
comparing new image files to old
comparing new image directories to old
comparing new image geometry to old
unmounting and removing new image
+1 -1
View File
@@ -130,4 +130,4 @@ ioctl nathans@sgi.com
070 attr auto
071 rw
072 rw
#073 copy
073 copy auto
+13 -42
View File
@@ -34,21 +34,15 @@
#
#
#
# fill2attr:
#
# $Id$
#
use strict;
use File::Basename;
# returns numbers with a normal distribution
sub normal {
my($mean) = $_[0];
my($stddev) = $_[1];
$x = -6.0;
my $x = -6.0;
for (my $i = 0; $i < 12; $i++) {
$x += rand;
}
@@ -57,44 +51,21 @@ sub normal {
return $x;
}
#
# determine script location and find fill2
#
chomp($cwd = `pwd`);
chomp($_ = `which fill2 2>&1 | head -1`);
if (-x $_) {
# look in the path
$fill2 = fill2;
}
else {
# in the same directory - get absolute path
chomp($dirname = dirname $0);
if ($dirname =~ m!^/.*!) {
$fill2 = $dirname . "/fill2";
}
else {
# relative
$fill2 = $cwd . "/" . $dirname . "/fill2";
}
if (! -x $fill2) {
die("Error: $0: can't find fill2, tried \"$fill2\"\n");
}
}
# location of fill2
my $fill2="./src/fill2";
# for each file attach a random number of attributes
# each filled with a random amount of data
# attribute name is the checksum of the data stored within
# the attribute
$status = 0; # return status
my $status = 0; # return status
my $file;
while (<>) {
chomp($file = $_);
die("Error: $0: $file not found\n")
if ( ! -e $file);
die("Error: $0: $file not found\n") if ( ! -e $file);
if ($0 =~ /fill2attr$/) {
@@ -114,23 +85,23 @@ while (<>) {
}
chomp($_ = `sum -r $tmp`);
($sum) = split(/\s+/);
if (system("cat $tmp | attr -s $sum $file > /dev/null 2>&1") != 0) {
die("Error $0: could not attach attribute:\n" . `cat $tmp` . "\n");
}
my ($sum) = split(/\s+/);
system("cat $tmp | attr -s $sum $file > /dev/null");
system("rm $tmp");
}
}
elsif ($0 =~ /fill2attr_check/) {
# get the attributes for this file
$cmd = "attr -q -l $file |";
my $cmd = "attr -q -l $file |";
open LIST, $cmd;
@labels = <LIST>;
my @labels = <LIST>;
close LIST or die("Error listing attributes: $!");
chomp(@labels);
# check attribute contents
foreach my $label (@labels) {
my $sum;
($sum) = split(/\s+/, `attr -q -g $label $file | sum -r`);
if ($sum ne $label) {
warn("Attribute \"$label\" does not match " .