mutter/cogl/tests/test-launcher.sh
Ting-Wei Lan 319500e4f3 tests: Fix warnings reported by shellcheck
This commit includes following fixes for a few shell scripts:

1. Follow the best practice of quoting variables everywhere unless they
   are used in places where word-splitting and globbing can never happen.

2. Replace `command` with $(command) because the latter is easier to use
   and read.

3. Don't use "$@" in places expecting a string because it is an array
   of strings instead of a single string.
2018-12-01 13:07:29 +00:00

40 lines
843 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"