1
0
Fork 0
mutter-performance-source/tests/test-launcher.sh
Robert Bragg eb7fafe700 tests: Adds our first white-box unit test
This adds a white-box unit test that verifies that GL_BLEND is disabled
when drawing an opaque rectangle, enabled when drawing a transparent
rectangle and then disabled again when drawing a transparent rectangle
but with a blend string that effectively disables blending.

This shares the test utilities and launcher infrastructure we are using
for conformance tests so we get consistent reporting and so unit tests
will be run against a range of different drivers.

This adds a --enable-unit-tests configure option which is enabled by
default but if disabled will make all UNIT_TESTS() into static inline
functions that we should expect the compiler to discard since they won't
be referenced by anything.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9047cce06bbf9051ec77e622be2fdbb96ed767a8)
2013-06-06 21:27:16 +01:00

39 lines
827 B
Bash
Executable file

#!/bin/sh
TEST_BINARY=$1
shift
SYMBOL_PREFIX=$1
shift
UNIT_TEST=$1
shift
test -z ${UNIT_TEST} && {
echo "Usage: $0 UNIT_TEST"
exit 1
}
BINARY_NAME=`basename $TEST_BINARY`
UNIT_TEST=`echo $UNIT_TEST|sed 's/-/_/g'`
echo "Running: ./$BINARY_NAME ${UNIT_TEST} $@"
echo ""
COGL_TEST_VERBOSE=1 $TEST_BINARY ${UNIT_TEST} "$@"
exit_val=$?
if test $exit_val -eq 0; then
echo "OK"
fi
echo ""
echo "NOTE: For debugging purposes, you can run this single test as follows:"
echo "$ libtool --mode=execute \\"
echo " gdb --eval-command=\"start\" --eval-command=\"b ${UNIT_TEST#${SYMBOL_PREFIX}}\" \\"
echo " --args ./$BINARY_NAME ${UNIT_TEST}"
echo "or:"
echo "$ env G_SLICE=always-malloc \\"
echo " libtool --mode=execute \\"
echo " valgrind ./$BINARY_NAME ${UNIT_TEST}"
exit $exit_val