scripts/xfstests.zsh

104 lines
2.4 KiB
Bash
Executable File

#!/bin/zsh -e
source common.zsh
VERSION=(3 4.0 4.1 4.2)
PROTO=(tcp)
GROUP=(-g quick)
zparseopts -D -K \
c:=CLIENT -client:=CLIENT \
g:=GROUP -group:=GROUP \
k:=SCRATCH -scratch:=SCRATCH \
-no-scratch=NO_SCRATCH \
-no-server-access=NO_SERVER_ACCESS \
o+:=MNTOPTS -options+:=MNTOPTS \
p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \
q:=SCRATCHMNT -scratchmnt:=SCRATCHMNT \
r:=RDMA -rdma:=RDMA \
s:=SERVER -server:=SERVER \
x:=EXPORT -export:=EXPORT \
v+:=VERSION -version+:=VERSION
COLOR=$COLORS/xfstests.py
OPTIONS="sec=sys$(echo $MNTOPTS | sed -E 's/ ?-o /,/g')"
RESULT_BASE=$HOME/.local/share/xfstests/
DATE=$(date +%Y-%m-%d-%H:%M:%S%z)
TODAY=$(date +%Y/%m/%d)
NOW=$(date +%H:%M:%S%z)
REMOTE_RESULTS=xfstests-dev/results/
RESULTS=$RESULT_BASE/date/$TODAY/${SERVER[-1]}/
TMP_RESULTS=/tmp/xfstests/${SERVER[-1]}/$NOW
TAG=$(kernel-tag.zsh ${CLIENT[-1]})
if [ ! -z $TAG ]; then
TAGRES=$RESULT_BASE/tags/$TAG/${SERVER[-1]}
fi
#
# Prepare to test
#
function setup_client_func()
{
client_setup xfstests.zsh ${SERVER[-1]} ${EXPORT[-1]} \
${MOUNTPOINT[-1]} ${SCRATCH[-1]} \
${SCRATCHMNT[-1]} $USER
}
prepare_to_test
if [ ${#NO_SCRATCH} -gt 0 ]; then
SCRATCH+=("NONE")
fi
testargs=()
for arg in $*; do
testargs+=($(printf '%q' "$arg"))
GROUP=()
done
run_xfs_tests() {
for proto in $PROTO; do
client_run xfstests.zsh --server ${SERVER[-1]} \
--export ${EXPORT[-1]} \
--mountpoint ${MOUNTPOINT[-1]} \
--scratch ${SCRATCH[-1]} \
--scratchmnt ${SCRATCHMNT[-1]} \
--proto $proto --version $1 \
--opts $OPTIONS \
--user $USER $GROUP $testargs | python $COLOR $proto $1
if [[ "$proto" == "rdma" ]]; then
xunit="$TMP_RESULTS/${RDMA[-1]}-$1.xml"
else
xunit="$TMP_RESULTS/$proto-$1.xml"
fi
scp -q ${CLIENT[-1]}:$REMOTE_RESULTS/$proto/$1/result.xml $xunit
xfstestsdb xunit read $RUNID $xunit | python $COLOR $proto $1
done
}
#
# Run tests
#
mkdir -p $TMP_RESULTS
RUNID=$(xfstestsdb new ${SERVER[-1]}:${EXPORT[-1]} | awk -F" | #" '{print $3}')
for vers in $VERSION; do
run_xfs_tests $vers &
done
wait
mkdir -p $RESULTS
tar -cJf $RESULTS/$NOW.tar.xz -C $(dirname $TMP_RESULTS) $NOW/
if [ ! -z "$TAG" ]; then
mkdir -p $TAGRES
ln $RESULTS/$NOW.tar.xz $TAGRES/$DATE.tar.xz
xfstestsdb tag $RUNID $TAG
fi
echo
xfstestsdb xunit list --results --runid $RUNID
echo
xfstestsdb show --failure $RUNID
echo
report-xfstests.py $RESULTS/$NOW.tar.xz & disown