Skip to content

Commit

Permalink
xfstests: convert tests to use new results directory
Browse files Browse the repository at this point in the history
Essentially the change is simply this. Converting:

... >> $seq.????

to:

.... >> $RESULT_DIR/$seq.????

so that output files are directed to the defined output directory.

sed to the rescue:

$ sed -i -e '/^seq=.*$/a seqres=$RESULT_DIR/$seq' -e 's/seq.full/seqres.full/' tests/*/*

will do most of the work automatically.

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>
  • Loading branch information
Dave Chinner authored and Rich Johnston committed Mar 27, 2013
1 parent 1686f9a commit 1d5d46d
Show file tree
Hide file tree
Showing 308 changed files with 1,641 additions and 717 deletions.
3 changes: 2 additions & 1 deletion new
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ cat <<End-of-File >$id
#
# creator
seq=\`basename \$0\`
seqres=$RESULT_DIR/$seq
echo "QA output created by \$seq"
here=\`pwd\`
Expand Down Expand Up @@ -134,7 +135,7 @@ exit
# 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 "If failure, check \$seqres.full (this) and \$seqres.full.ok (reference)"
# success, all done
status=0
Expand Down
4 changes: 4 additions & 0 deletions tests/btrfs/254
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down
4 changes: 4 additions & 0 deletions tests/btrfs/264
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down
4 changes: 4 additions & 0 deletions tests/btrfs/265
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down
38 changes: 21 additions & 17 deletions tests/btrfs/276
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand All @@ -36,7 +40,7 @@ noise_pid=0
_cleanup()
{
if [ $noise_pid -ne 0 ]; then
echo "background noise kill $noise_pid" >>$seq.full
echo "background noise kill $noise_pid" >>$seqres.full
kill $noise_pid
noise_pid=0
wait
Expand All @@ -60,7 +64,7 @@ _require_no_large_scratch_dev
_require_btrfs inspect-internal
_require_command "/usr/sbin/filefrag"

rm -f $seq.full
rm -f $seqres.full

FILEFRAG_FILTER='if (/, blocksize (\d+)/) {$blocksize = $1; next} ($ext, '\
'$logical, $physical, $expected, $length, $flags) = (/^\s*(\d+)\s+(\d+)'\
Expand All @@ -74,18 +78,18 @@ FILEFRAG_FILTER='if (/, blocksize (\d+)/) {$blocksize = $1; next} ($ext, '\
# sample output: "1234#10#5678" -> physical 1234, length 10, logical 5678
_filter_extents()
{
tee -a $seq.full | $PERL_PROG -ne "$FILEFRAG_FILTER"
tee -a $seqres.full | $PERL_PROG -ne "$FILEFRAG_FILTER"
}

_check_file_extents()
{
cmd="filefrag -v $1"
echo "# $cmd" >> $seq.full
echo "# $cmd" >> $seqres.full
out=`$cmd | _filter_extents`
if [ -z "$out" ]; then
return 1
fi
echo "after filter: $out" >> $seq.full
echo "after filter: $out" >> $seqres.full
echo $out
return 0
}
Expand All @@ -101,9 +105,9 @@ _btrfs_inspect_addr()
expect_inum=$4
file=$5
cmd="$BTRFS_UTIL_PROG inspect-internal logical-resolve -P $addr $mp"
echo "# $cmd" >> $seq.full
echo "# $cmd" >> $seqres.full
out=`$cmd`
echo "$out" >> $seq.full
echo "$out" >> $seqres.full
grep_expr="inode $expect_inum offset $expect_addr root"
echo "$out" | grep "^$grep_expr 5$" >/dev/null
ret=$?
Expand Down Expand Up @@ -134,9 +138,9 @@ _btrfs_inspect_inum()
snap_name=$3
mp="$SCRATCH_MNT/$snap_name"
cmd="$BTRFS_UTIL_PROG inspect-internal inode-resolve $inum $mp"
echo "# $cmd" >> $seq.full
echo "# $cmd" >> $seqres.full
out=`$cmd`
echo "$out" >> $seq.full
echo "$out" >> $seqres.full
grep_expr="^$file$"
cnt=`echo "$out" | grep "$grep_expr" | wc -l`
if [ $cnt -ge "1" ]; then
Expand All @@ -157,9 +161,9 @@ _btrfs_inspect_check()
logical=$4
snap_name=$5
cmd="stat -c %i $file"
echo "# $cmd" >> $seq.full
echo "# $cmd" >> $seqres.full
inum=`$cmd`
echo "$inum" >> $seq.full
echo "$inum" >> $seqres.full
_btrfs_inspect_addr $SCRATCH_MNT $physical $logical $inum $file
ret=$?
if [ $ret -eq 0 ]; then
Expand All @@ -178,9 +182,9 @@ workout()
do_bg_noise=$5

umount $SCRATCH_DEV >/dev/null 2>&1
echo "*** mkfs -dsize=$fsz" >>$seq.full
echo "" >>$seq.full
_scratch_mkfs_sized $fsz >>$seq.full 2>&1 \
echo "*** mkfs -dsize=$fsz" >>$seqres.full
echo "" >>$seqres.full
_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
|| _fail "size=$fsz mkfs failed"
run_check _scratch_mount
# -w ensures that the only ops are ones which cause write I/O
Expand Down Expand Up @@ -210,13 +214,13 @@ workout()
if [ $do_bg_noise -ne 0 ]; then
# make background noise while backrefs are being walked
while /bin/true; do
echo background fsstress >>$seq.full
echo background fsstress >>$seqres.full
run_check $FSSTRESS_PROG -d $SCRATCH_MNT/bgnoise -n 999
echo background rm >>$seq.full
echo background rm >>$seqres.full
rm -rf $SCRATCH_MNT/bgnoise/
done &
noise_pid=`jobs -p %1`
echo "background noise by $noise_pid" >>$seq.full
echo "background noise by $noise_pid" >>$seqres.full
fi

cnt=0
Expand Down
4 changes: 4 additions & 0 deletions tests/btrfs/284
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here="`pwd`"
tmp=/tmp/$$
Expand Down
12 changes: 8 additions & 4 deletions tests/btrfs/307
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "== QA output created by $seq"

here=`pwd`
Expand All @@ -48,16 +52,16 @@ _supported_os Linux
_require_scratch
_require_scratch_dev_pool

rm -f $seq.full
rm -f $seqres.full

FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'`
TOTAL_DEVS=`echo $SCRATCH_DEV $SCRATCH_DEV_POOL | wc -w`
LABEL=TestLabel.$seq

echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seq.full
echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seqres.full

_scratch_mkfs $SCRATCH_DEV_POOL >> $seq.full 2>&1 || _fail "mkfs failed"
_scratch_mkfs $SCRATCH_DEV_POOL >> $seqres.full 2>&1 || _fail "mkfs failed"

# These have to be done unmounted...?
echo "== Set filesystem label to $LABEL"
Expand All @@ -72,7 +76,7 @@ echo "== Show filesystem by label"
$BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS
UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'`

echo "UUID $UUID" >> $seq.full
echo "UUID $UUID" >> $seqres.full

echo "== Show filesystem by UUID"
$BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
Expand Down
5 changes: 4 additions & 1 deletion tests/ext4/271
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand All @@ -40,7 +43,7 @@ _supported_os Linux
_need_to_be_root
_require_scratch

_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seq.full 2>&1
_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1

# -onoload and EXT4_SYNC_FL on file is important becase result in
# metadata sync writes inside ext4_handle_dirty_metadata()
Expand Down
7 changes: 5 additions & 2 deletions tests/ext4/301
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down Expand Up @@ -101,13 +104,13 @@ _workout()
echo ""
echo " Start defragment activity"
echo ""
cat $tmp-$seq.fio >> $seq.full
cat $tmp-$seq.fio >> $seqres.full
run_check $FIO_PROG $tmp-$seq.fio
}

_require_fio $tmp-$seq.fio

_scratch_mkfs >> $seq.full 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

if ! _workout; then
Expand Down
7 changes: 5 additions & 2 deletions tests/ext4/302
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down Expand Up @@ -117,13 +120,13 @@ _workout()
echo ""
echo " Start defragment activity"
echo ""
cat $tmp-$seq.fio >> $seq.full
cat $tmp-$seq.fio >> $seqres.full
run_check $FIO_PROG $tmp-$seq.fio
}

_require_fio $tmp-$seq.fio

_scratch_mkfs >> $seq.full 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

if ! _workout; then
Expand Down
7 changes: 5 additions & 2 deletions tests/ext4/303
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down Expand Up @@ -127,13 +130,13 @@ _workout()
echo ""
echo " Start defragment activity"
echo ""
cat $tmp-$seq.fio >> $seq.full
cat $tmp-$seq.fio >> $seqres.full
run_check $FIO_PROG $tmp-$seq.fio
}

_require_fio $tmp-$seq.fio

_scratch_mkfs >> $seq.full 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

if ! _workout; then
Expand Down
7 changes: 5 additions & 2 deletions tests/ext4/304
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

here=`pwd`
Expand Down Expand Up @@ -104,13 +107,13 @@ _workout()
echo ""
echo " Start defragment activity"
echo ""
cat $tmp-$seq.fio >> $seq.full
cat $tmp-$seq.fio >> $seqres.full
run_check $FIO_PROG $tmp-$seq.fio
}

_require_fio $tmp-$seq.fio

_scratch_mkfs >> $seq.full 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

if ! _workout; then
Expand Down
11 changes: 7 additions & 4 deletions tests/generic/001
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

# get standard environment, filters and checks
Expand Down Expand Up @@ -189,7 +192,7 @@ _mark_iteration()
#
_chain()
{
$AWK_PROG -v full_file=$here/$seq.full -v verify=$verify <$tmp.config '
$AWK_PROG -v full_file=$here/$seqres.full -v verify=$verify <$tmp.config '
BEGIN { nfile = 0 }
/^\#/ { next }
{ file[nfile] = $1
Expand Down Expand Up @@ -237,7 +240,7 @@ END { srand('$iter')
}
}
}' \
| tee -a $here/$seq.full | sh
| tee -a $here/$seqres.full | sh
}

_check()
Expand Down Expand Up @@ -291,7 +294,7 @@ _cleanup()
fi
}

rm -f $here/$seq.full
rm -f $here/$seqres.full
status=0
_cleanup
status=1
Expand All @@ -305,7 +308,7 @@ _setup
for iter in 1 2 3 4 5
do
echo -n "iter $iter chain ... "
echo "iter $iter" >> $here/$seq.full
echo "iter $iter" >> $here/$seqres.full
_chain
_check
if [ -f $tmp.bad ]
Expand Down
3 changes: 3 additions & 0 deletions tests/generic/002
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#

seq=`basename $0`
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"

# get standard environment, filters and checks
Expand Down
Loading

0 comments on commit 1d5d46d

Please sign in to comment.