2009-04-06 15:13:06 +01:00
|
|
|
#!/bin/bash
|
2006-07-24 14:24:06 +01:00
|
|
|
# @P@/test.sh
|
|
|
|
#
|
2010-04-25 16:42:56 +01:00
|
|
|
# (c)2010, @AUTHOR@, <@EMAIL@>.
|
2007-10-14 11:31:40 +01:00
|
|
|
# Released under the GNU GPLv3. See file COPYING or
|
2006-07-25 18:50:00 +01:00
|
|
|
# http://www.gnu.org/copyleft/gpl.html for details.
|
2006-07-24 14:24:06 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2008-10-30 00:38:30 +00:00
|
|
|
LD_LIBRARY_PATH="obj" "${EXE}" "$@" || return 1
|
2006-07-24 14:24:06 +01:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This prints summary output from each test app.
|
|
|
|
print_tests() {
|
|
|
|
echo "Available tests"
|
|
|
|
echo "---------------------------------------------------------------------"
|
|
|
|
for EXE in obj/tests/*
|
|
|
|
do
|
2009-04-06 15:13:06 +01:00
|
|
|
[ -x "${EXE}" ] || continue
|
|
|
|
NAME="$(echo "${EXE}" | sed 's,obj/tests/,,')"
|
2006-07-24 14:24:06 +01:00
|
|
|
echo -ne "${NAME}\t"
|
2009-04-06 15:13:06 +01:00
|
|
|
LD_LIBRARY_PATH="obj" "${EXE}" --print-summary
|
2006-07-24 14:24:06 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Main script
|
|
|
|
if [ $# -eq 0 ]
|
|
|
|
then
|
|
|
|
print_tests
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
run_test $*
|
2006-07-25 18:50:00 +01:00
|
|
|
|
2006-07-25 19:19:59 +01:00
|
|
|
# kate: @KATE_MODELINE@
|
|
|
|
# vim: @VIM_MODELINE@
|