2006-07-24 14:24:06 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# @P@/test.sh
|
|
|
|
#
|
2006-07-24 22:04:40 +01:00
|
|
|
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
|
2006-07-24 14:24:06 +01:00
|
|
|
# COPYING for more information / terms of license.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Running this script on its own will display a summary of all the
|
|
|
|
# available tests; running it with arguments runs the relevant test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This runs a test, setting the correct library path.
|
|
|
|
run_test() {
|
|
|
|
EXE=obj/tests/$1
|
|
|
|
shift
|
|
|
|
if [ ! -x ${EXE} ]
|
|
|
|
then
|
|
|
|
echo "No such test '${EXE}'"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
LD_LIBRARY_PATH="obj" ${EXE} "$@" || return 1
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This prints summary output from each test app.
|
|
|
|
print_tests() {
|
|
|
|
echo "Available tests"
|
|
|
|
echo "---------------------------------------------------------------------"
|
|
|
|
for EXE in obj/tests/*
|
|
|
|
do
|
|
|
|
[ -x ${EXE} ] || continue
|
|
|
|
NAME=$(echo ${EXE} | sed 's,obj/tests/,,')
|
|
|
|
echo -ne "${NAME}\t"
|
|
|
|
LD_LIBRARY_PATH="obj" ${EXE} --print-summary
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Main script
|
|
|
|
if [ $# -eq 0 ]
|
|
|
|
then
|
|
|
|
print_tests
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
run_test $*
|