Skip to content

Commit

Permalink
xfstests: Introduce a results directory
Browse files Browse the repository at this point in the history
Currently each test gets it's sequence number from it's name. It
separates this from the path via basename, and uses it for
outputting full, notrun and other status/log files. Hence these end
up in the top level directory.

All these output files need to go somewhere other than the top level
directory. Right now the check script is looking for them in the new
test directories (e.g. for the notrun files), but it would be good
to be able to separate the test source form the test output.

Hence create an output directory which has a similar heirarchy to
the test source directory. Create it on demand when we build the
list of tests to run if it doesn't already exist.

Change the high level check script to set up this variable
appropriately for each test that is being run, and to use this new
output directory for it's result files as well. The next commit will
change all the tests themselves to use the new output directory.

This is the first (small) step in being able to store test results
in an external location for archival/data mining purposes.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
[rjohnston@sgi.com rm whitespace and fix typos in commit message]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
  • Loading branch information
Dave Chinner authored and Rich Johnston committed Mar 27, 2013
1 parent 1f39e59 commit 1686f9a
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 138 deletions.
38 changes: 26 additions & 12 deletions check
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ here=`pwd`
FSTYP=xfs

SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
SRC_DIR="tests"
SRC_GROUPS="generic shared"
export SRC_DIR="tests"
export RESULT_BASE=${RESULT_BASE:="results"}

# generic initialization
iam=check
Expand Down Expand Up @@ -374,6 +375,12 @@ if [ ! -z "$SCRATCH_DEV" ]; then
fi
fi

mkdir -p $RESULT_BASE
if [ ! -d $RESULT_BASE ]; then
echo "failed to create results directory $RESULTS_BASE"
exit 1;
fi

seq="check"
_check_test_fs

Expand All @@ -385,6 +392,13 @@ do
# we don't include the tests/ directory in the name output.
seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`

# Similarly, the result directory needs to replace the tests/
# part of the test location.
group=`dirname $seq`
export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
mkdir -p $RESULT_DIR
seqres="$RESULT_BASE/$seqnum"

echo -n "$seqnum"

if $showme
Expand All @@ -397,7 +411,7 @@ do
else
# really going to try and run this one
#
rm -f $seq.out.bad
rm -f $seqres.out.bad

# slashes now in names, sed barfs on them so use grep
lasttime=`grep -w ^$seq check.time | awk '// {print $2}'`
Expand All @@ -406,7 +420,7 @@ do
else
echo -n " " # prettier output with timestamps.
fi
rm -f core $seq.notrun
rm -f core $seqres.notrun

start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]"
Expand All @@ -423,15 +437,15 @@ do
if [ -f core ]
then
echo -n " [dumped core]"
mv core $seq.core
mv core $RESULT_BASE/$seqnum.core
err=true
fi

if [ -f $seq.notrun ]
if [ -f $seqres.notrun ]
then
$timestamp || echo -n " [not run] "
$timestamp && echo " [not run]" && echo -n " $seqnum -- "
cat $seq.notrun
cat $seqres.notrun
notrun="$notrun $seqnum"
else
if [ $sts -ne 0 ]
Expand All @@ -455,17 +469,17 @@ do
fi
echo ""
else
echo " - output mismatch (see $seq.out.bad)"
mv $tmp.out $seq.out.bad
$diff $seq.out $seq.out.bad | {
echo " - output mismatch (see $seqres.out.bad)"
mv $tmp.out $seqres.out.bad
$diff $seq.out $seqres.out.bad | {
if test "$DIFF_LENGTH" -le 0; then
cat
else
head -n "$DIFF_LENGTH"
fi; } | \
sed -e 's/^\(.\)/ \1/'
echo " ..."
echo " (Run '$diff $seq.out $seq.out.bad' to see the" \
echo " (Run '$diff $seq.out $seqres.out.bad' to see the" \
"entire diff)"
err=true
fi
Expand All @@ -482,13 +496,13 @@ do
n_bad=`expr $n_bad + 1`
quick=false
fi
if [ ! -f $seq.notrun ]
if [ ! -f $seqres.notrun ]
then
try="$try $seqnum"
n_try=`expr $n_try + 1`
_check_test_fs
fi

seq="after_$seqnum"
done

Expand Down
4 changes: 2 additions & 2 deletions common.attr
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ _require_acls()
#
touch $TEST_DIR/syscalltest
chacl -l $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
cat $TEST_DIR/syscalltest.out >> $here/$seq.full
cat $TEST_DIR/syscalltest.out >> $RESULT_DIR/$seq.full

if grep -q 'Function not implemented' $TEST_DIR/syscalltest.out; then
_notrun "kernel does not support ACLs"
Expand Down Expand Up @@ -164,7 +164,7 @@ _require_attrs()
#
touch $TEST_DIR/syscalltest
attr -s "user.xfstests" -V "attr" $TEST_DIR > $TEST_DIR/syscalltest.out 2>&1
cat $TEST_DIR/syscalltest.out >> $here/$seq.full
cat $TEST_DIR/syscalltest.out >> $RESULT_DIR/$seq.full

if grep -q 'Function not implemented' $TEST_DIR/syscalltest.out; then
_notrun "kernel does not support attrs"
Expand Down
4 changes: 2 additions & 2 deletions common.defrag
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _require_defrag()
_extent_count()
{
$FILEFRAG_PROG $1 | awk '{print $2}'
$FILEFRAG_PROG -v $1 >> $seq.full 2>&1
$FILEFRAG_PROG -v $1 >> $RESULT_DIR/$seq.full 2>&1
}

# Defrag file, check it, and remove it.
Expand All @@ -54,7 +54,7 @@ _defrag()
_extent_count $1
CSUM_BEFORE=`md5sum $1`
STAT_BEFORE=`stat -c "a: %x m: %y c: %z" $1`
$DEFRAG_PROG -v $1 >> $seq.full 2>&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`
Expand Down
Loading

0 comments on commit 1686f9a

Please sign in to comment.