Commit 2efabaa9 authored by Philip Carns's avatar Philip Carns

basic test scripts for make check

- ported from Kevin's triton test scripts
parent 052da3fb
Pipeline #160 skipped
......@@ -39,5 +39,5 @@ pkgconfig_DATA = maint/bake-bulk.pc
include Make.rules
include $(top_srcdir)/src/Makefile.subdir
# include $(top_srcdir)/examples/Makefile.subdir
include $(top_srcdir)/tests/Makefile.subdir
TESTS += \
tests/basic.sh
EXTRA_DIST += \
tests/basic.sh
#!/bin/bash -x
if [ -z $srcdir ]; then
echo srcdir variable not set.
exit 1
fi
source $srcdir/tests/test-util.sh
# start 1 server with 2 second wait, 20s timeout
test_start_servers 1 2 20
# actual test case
#####################
# run_to 10 src/SOME_EXAMPLE_PROGRAM $svr1
# if [ $? -ne 0 ]; then
# run_to 10 src/bb-shutdown $svr1 &> /dev/null
# wait
# exit 1
# fi
sleep 1
#####################
# tear down
run_to 10 src/bb-shutdown $svr1 &> /dev/null
if [ $? -ne 0 ]; then
wait
exit 1
fi
wait
echo cleaning up $TMPBASE
rm -rf $TMPBASE
exit 0
#
# General test script utilities
#
TMPDIR=/dev/shm
export TMPDIR
mkdir -p $TMPDIR
TMPBASE=$(mktemp --tmpdir -d test-XXXXXX)
echo "tmpbase: $TMPBASE"
if [ ! -d $TMPBASE ];
then
echo "Temp directory doesn't exist: $TMPBASE"
exit 3
fi
function run_to ()
{
maxtime=${1}s
shift
timeout --signal=9 $maxtime "$@"
}
function test_start_servers ()
{
nservers=${1:-4}
startwait=${2:-15}
maxtime=${3:-120}s
repfactor=${4:-0}
pid=$$
startport=3344
endport=`expr 3344 + $nservers - 1`
# start daemons
for i in `seq $startport $endport`
do
truncate -s 100M $TMPBASE/foo-$i.dat
if [ $? -ne 0 ]; then
exit 1
fi
pmempool create obj $TMPBASE/foo-$i.dat
if [ $? -ne 0 ]; then
exit 1
fi
timeout --signal=9 ${maxtime} src/bake-bulk-server tcp://localhost:$i $TMPBASE/foo-$i.dat &
if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
# return codes of the actual client side tests to tell if
# everything started properly
exit 1
fi
done
# wait for servers to start
sleep ${startwait}
svr1="tcp://localhost:$startport"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment