meson: work around meson not passing on the threads dependency when link_with is...
[glib.git] / tests / run-assert-msg-test.sh
blobd4a5111547669c6ab3c5ba44fa9b6819693239fd
1 #! /bin/sh
3 fail ()
5 echo "Test failed: $*"
6 exit 1
9 echo_v ()
11 if [ "$verbose" = "1" ]; then
12 echo "$*"
16 error_out=/dev/null
17 if [ "$1" = "-v" ]; then
18 verbose=1
19 error_out=/dev/stderr
20 fi
22 if [ -z "$LIBTOOL" ]; then
23 if [ -f ../libtool ]; then
24 LIBTOOL=../libtool
25 else
26 LIBTOOL=libtool
30 echo_v "Running assert-msg-test"
31 OUT=$(./assert-msg-test 2>&1) && fail "assert-msg-test should abort"
32 echo "$OUT" | grep -q '^GLib:ERROR:.*assert-msg-test.c:.*:.*main.*: assertion failed: (42 < 0)' || \
33 fail "does not print assertion message"
35 if ! type gdb >/dev/null 2>&1; then
36 echo_v "Skipped (no gdb installed)"
37 exit 0
40 echo_v "Running gdb on assert-msg-test"
41 OUT=$($LIBTOOL --mode=execute gdb --batch -x ${srcdir:-.}/assert-msg-test.gdb ./assert-msg-test 2> $error_out) || fail "failed to run gdb"
43 echo_v "Checking if assert message is in __glib_assert_msg"
44 if ! echo "$OUT" | grep -q '^$1.*"GLib:ERROR:.*assert-msg-test.c:.*:.*main.*: assertion failed: (42 < 0)"'; then
45 fail "__glib_assert_msg does not have assertion message"
48 echo_v "All tests passed."