1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/bin/sh
. ../../dttools/test/test_runner_common.sh
export PATH=../src:$PATH
export CORES=4
export TASKS=20
export VALGRIND="valgrind --error-exitcode=1 --leak-check=full"
check_needed()
{
if ! ${VALGRIND} --version > /dev/null 2>&1
then
exit 1
fi
}
prepare()
{
echo "nothing to do"
}
run()
{
cat > manager.script << EOF
submit 1 0 1 $TASKS
wait
quit
EOF
echo "starting manager"
(${VALGRIND} --log-file=manager.valgrind -- work_queue_test -d all -o manager.log -Z manager.port < manager.script; echo $? > manager.exitcode ) &
echo "waiting for manager to get ready"
wait_for_file_creation manager.port 15
port=$(cat manager.port)
echo "starting worker"
(${VALGRIND} --log-file=worker.valgrind -- work_queue_worker -d all -o worker.log localhost $port -b 1 --timeout 20 --cores $CORES --memory-threshold 10 --memory 50 --single-shot; echo $? > worker.exitcode)
wait_for_file_creation manager.exitcode 15
wait_for_file_creation worker.exitcode 5
echo "checking for valgrind errors"
manager=$(cat manager.exitcode)
worker=$(cat worker.exitcode)
overall=0
if [ "$manager" != 0 ]
then
echo "valgrind found errors with the manager."
[ -f manager.valgrind ] && cat manager.valgrind && overall=1
fi
if [ "$worker" != 0 ]
then
echo "valgrind found errors with the worker"
[ -f worker.valgrind ] && cat worker.valgrind && overall=1
fi
return ${overall}
}
clean()
{
rm -f manager.script manager.log manager.port manager.exitcode manager.valgrind worker.log worker.exitcode worker.valgrind output.* input.*
}
dispatch "$@"
# vim: set noexpandtab tabstop=4:
|