2010-11-08 15:18:07 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
# libiir/test.sh
|
|
|
|
|
#
|
2011-04-15 20:12:04 +01:00
|
|
|
|
# Copyright: ©2010–2011, Laurence Withers.
|
2010-11-08 15:18:07 +00:00
|
|
|
|
# Author: Laurence Withers <l@lwithers.me.uk>
|
|
|
|
|
# License: GPLv3
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# 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:${LD_LIBRARY_PATH}" "${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:${LD_LIBRARY_PATH}" "${EXE}" --print-summary
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Main script
|
|
|
|
|
if [ $# -eq 0 ]
|
|
|
|
|
then
|
|
|
|
|
print_tests
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2011-04-15 20:03:35 +01:00
|
|
|
|
run_test "$@"
|
2010-11-08 15:18:07 +00:00
|
|
|
|
|
|
|
|
|
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
|
|
|
|
# vim: expandtab:ts=4:sw=4
|