Commit a9cfc4ce authored by Simon McVittie's avatar Simon McVittie
Browse files

test: Explicitly enable assertion macros

To allow dbus-glib to be built with G_DISABLE_ASSERT defined but tests
enabled (--disable-asserts --enable-tests), we need to explicitly
undefine it when building the tests, otherwise g_test_init() turns
into an abort since GLib 2.58.

We no longer actually use g_assert() for test-only code, so we can
remove the warning about tests' failing results not being reported.

test-profile.c still leaves assertions disabled: it does not use
g_test_init(), and it is intended to be used for profiling, where the
overhead of assertions is potentially significant.

Resolves: #16

Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 0383264d
Pipeline #290665 passed with stage
in 2 minutes and 32 seconds
......@@ -344,9 +344,6 @@ echo "
if test x$enable_tests = xyes; then
echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
fi
if test x$enable_tests = xyes -a x$enable_asserts = xno; then
echo "NOTE: building with unit tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)"
fi
if test x$enable_gcov = xyes; then
echo "NOTE: building with coverage profiling is definitely for developers only."
fi
......
......@@ -26,6 +26,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <glib.h>
#include <gio/gio.h>
......
......@@ -28,6 +28,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <glib.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <string.h>
#include <glib/gi18n.h>
#include <glib-object.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <string.h>
#include <glib/gi18n.h>
#include <glib-object.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <stdio.h>
#include <stdlib.h>
......
......@@ -38,6 +38,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <stdio.h>
#include <stdlib.h>
......
......@@ -34,6 +34,7 @@
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#undef G_DISABLE_ASSERT
#endif
#include <glib.h>
......
......@@ -27,6 +27,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <glib.h>
......
......@@ -38,6 +38,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
......
......@@ -26,6 +26,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <glib.h>
......
......@@ -27,6 +27,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
/* -*- mode: C; c-file-style: "gnu" -*- */
#include <dbus/dbus-glib.h>
......
......@@ -28,6 +28,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <gio/gio.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
/* -*- mode: C; c-file-style: "gnu" -*- */
#include <dbus/dbus-glib.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <stdio.h>
#include <stdlib.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
/* -*- mode: C; c-file-style: "gnu" -*- */
#include <stdio.h>
......
......@@ -37,6 +37,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <glib.h>
#include <glib/gstdio.h>
......
......@@ -24,6 +24,7 @@
*/
#include <config.h>
#undef G_DISABLE_ASSERT
#include <string.h>
......
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
#undef G_DISABLE_ASSERT
#include <stdlib.h>
#include <string.h>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment