mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 15:33:39 +02:00
always use our own internal assertion message symbol
Re-using glibc's __abort_msg symbol causes linking problems, since the symbol is declared private. Always use our own__glib_abort_msg symbol to store assertion messages, to avoid compatibility and linking problems. Also fix the test case to work with out of tree builds (such as "make distcheck"), and re-enable it. https://bugzilla.gnome.org/show_bug.cgi?id=594872
This commit is contained in:
@@ -21,7 +21,7 @@ fi
|
||||
|
||||
echo_v "Running assert-msg-test"
|
||||
OUT=$(./assert-msg-test 2>&1) && fail "assert-msg-test should abort"
|
||||
echo "$OUT" | grep -q '^ERROR:assert-msg-test.c:.*:main: assertion failed: (42 < 0)' || \
|
||||
echo "$OUT" | grep -q '^ERROR:.*assert-msg-test.c:.*:main: assertion failed: (42 < 0)' || \
|
||||
fail "does not print assertion message"
|
||||
|
||||
if ! type gdb >/dev/null 2>&1; then
|
||||
@@ -29,20 +29,13 @@ if ! type gdb >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# do we use libc's or our own variable?
|
||||
if grep -q '^#define HAVE_LIBC_ABORT_MSG' $(dirname $0)/../config.h; then
|
||||
VAR=__abort_msg
|
||||
else
|
||||
VAR=__glib_assert_msg
|
||||
fi
|
||||
|
||||
echo_v "Running gdb on assert-msg-test"
|
||||
OUT=$(gdb --batch --ex run --ex "print (char*) $VAR" .libs/lt-assert-msg-test 2> $error_out) || \
|
||||
OUT=$(gdb --batch --ex run --ex "print (char*) __glib_assert_msg" .libs/lt-assert-msg-test 2> $error_out) || \
|
||||
fail "failed to run gdb"
|
||||
|
||||
echo_v "Checking if assert message is in $VAR"
|
||||
if ! echo "$OUT" | grep -q '^$1.*"ERROR:assert-msg-test.c:.*:main: assertion failed: (42 < 0)"'; then
|
||||
fail "$VAR does not have assertion message"
|
||||
echo_v "Checking if assert message is in __glib_assert_msg"
|
||||
if ! echo "$OUT" | grep -q '^$1.*"ERROR:.*assert-msg-test.c:.*:main: assertion failed: (42 < 0)"'; then
|
||||
fail "__glib_assert_msg does not have assertion message"
|
||||
fi
|
||||
|
||||
echo_v "All tests passed."
|
||||
|
Reference in New Issue
Block a user