summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2021-03-26 13:52:38 +0000
committerSimon McVittie <smcv@collabora.com>2021-03-26 14:00:19 +0000
commita9cfc4ce439aed41cac84d342d088cef3ec83ae4 (patch)
treebf589227d3738ae8cbb53776873c09056ed19467
parent0383264db07b2bc4519719b34111bd6f939f0fe2 (diff)
downloaddbus-glib-a9cfc4ce439aed41cac84d342d088cef3ec83ae4.tar.gz
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 <smcv@collabora.com>
-rw-r--r--configure.ac3
-rw-r--r--test/core/error-mapping.c1
-rw-r--r--test/core/manual/invalid-usage.c1
-rw-r--r--test/core/my-object-subclass.c2
-rw-r--r--test/core/my-object.c2
-rw-r--r--test/core/peer-client.c1
-rw-r--r--test/core/peer-on-bus.c1
-rw-r--r--test/core/peer-server.c1
-rw-r--r--test/core/proxy-noc.c1
-rw-r--r--test/core/proxy-peer.c1
-rw-r--r--test/core/registrations.c1
-rw-r--r--test/core/shared-bus.c1
-rw-r--r--test/core/test-dbus-glib.c1
-rw-r--r--test/core/test-gvariant.c1
-rw-r--r--test/core/test-service-glib.c1
-rw-r--r--test/core/test-types.c1
-rw-r--r--test/core/test-variant-recursion.c1
-rw-r--r--test/core/unsupported-type.c1
-rw-r--r--test/errors.c1
-rw-r--r--test/interfaces/test-client.c1
-rw-r--r--test/interfaces/test-dup-prop.c1
-rw-r--r--test/interfaces/test-interfaces.c1
-rw-r--r--test/interfaces/test-objects.c1
-rw-r--r--test/interfaces/test-server.c1
-rw-r--r--test/specialized-types.c1
-rw-r--r--test/test-service.c1
26 files changed, 27 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 83f9454..b9292b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/test/core/error-mapping.c b/test/core/error-mapping.c
index 58306b4..9d0c0b1 100644
--- a/test/core/error-mapping.c
+++ b/test/core/error-mapping.c
@@ -26,6 +26,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <glib.h>
#include <gio/gio.h>
diff --git a/test/core/manual/invalid-usage.c b/test/core/manual/invalid-usage.c
index e87007d..383c1f5 100644
--- a/test/core/manual/invalid-usage.c
+++ b/test/core/manual/invalid-usage.c
@@ -28,6 +28,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <glib.h>
diff --git a/test/core/my-object-subclass.c b/test/core/my-object-subclass.c
index a5e4035..bb23484 100644
--- a/test/core/my-object-subclass.c
+++ b/test/core/my-object-subclass.c
@@ -1,6 +1,8 @@
/* 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>
diff --git a/test/core/my-object.c b/test/core/my-object.c
index 02839cb..1414093 100644
--- a/test/core/my-object.c
+++ b/test/core/my-object.c
@@ -1,6 +1,8 @@
/* 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>
diff --git a/test/core/peer-client.c b/test/core/peer-client.c
index ba95616..73b4383 100644
--- a/test/core/peer-client.c
+++ b/test/core/peer-client.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/core/peer-on-bus.c b/test/core/peer-on-bus.c
index 87ff2d8..c40fc4c 100644
--- a/test/core/peer-on-bus.c
+++ b/test/core/peer-on-bus.c
@@ -38,6 +38,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
diff --git a/test/core/peer-server.c b/test/core/peer-server.c
index 7b69c8b..e59a347 100644
--- a/test/core/peer-server.c
+++ b/test/core/peer-server.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/core/proxy-noc.c b/test/core/proxy-noc.c
index 843f1c3..320a24e 100644
--- a/test/core/proxy-noc.c
+++ b/test/core/proxy-noc.c
@@ -34,6 +34,7 @@
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
+#undef G_DISABLE_ASSERT
#endif
#include <glib.h>
diff --git a/test/core/proxy-peer.c b/test/core/proxy-peer.c
index 87d8d0a..2f4e538 100644
--- a/test/core/proxy-peer.c
+++ b/test/core/proxy-peer.c
@@ -27,6 +27,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <glib.h>
diff --git a/test/core/registrations.c b/test/core/registrations.c
index 621f9d1..35b09fa 100644
--- a/test/core/registrations.c
+++ b/test/core/registrations.c
@@ -38,6 +38,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
diff --git a/test/core/shared-bus.c b/test/core/shared-bus.c
index df998ed..802f0a3 100644
--- a/test/core/shared-bus.c
+++ b/test/core/shared-bus.c
@@ -26,6 +26,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <glib.h>
diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c
index 1a544d5..629830d 100644
--- a/test/core/test-dbus-glib.c
+++ b/test/core/test-dbus-glib.c
@@ -27,6 +27,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
/* -*- mode: C; c-file-style: "gnu" -*- */
#include <dbus/dbus-glib.h>
diff --git a/test/core/test-gvariant.c b/test/core/test-gvariant.c
index 8a6bced..0437675 100644
--- a/test/core/test-gvariant.c
+++ b/test/core/test-gvariant.c
@@ -28,6 +28,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <dbus/dbus-glib.h>
#include <gio/gio.h>
diff --git a/test/core/test-service-glib.c b/test/core/test-service-glib.c
index 1b328f7..5e05ded 100644
--- a/test/core/test-service-glib.c
+++ b/test/core/test-service-glib.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/core/test-types.c b/test/core/test-types.c
index 00b522c..11348f3 100644
--- a/test/core/test-types.c
+++ b/test/core/test-types.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/core/test-variant-recursion.c b/test/core/test-variant-recursion.c
index bc6df8e..464f7e5 100644
--- a/test/core/test-variant-recursion.c
+++ b/test/core/test-variant-recursion.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/core/unsupported-type.c b/test/core/unsupported-type.c
index ac4d7df..2134a99 100644
--- a/test/core/unsupported-type.c
+++ b/test/core/unsupported-type.c
@@ -37,6 +37,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <glib.h>
#include <glib/gstdio.h>
diff --git a/test/errors.c b/test/errors.c
index cf2110e..812e031 100644
--- a/test/errors.c
+++ b/test/errors.c
@@ -24,6 +24,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <string.h>
diff --git a/test/interfaces/test-client.c b/test/interfaces/test-client.c
index 8fc60a0..9f7b58e 100644
--- a/test/interfaces/test-client.c
+++ b/test/interfaces/test-client.c
@@ -1,6 +1,7 @@
/* 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>
diff --git a/test/interfaces/test-dup-prop.c b/test/interfaces/test-dup-prop.c
index 8c27fb7..0400a73 100644
--- a/test/interfaces/test-dup-prop.c
+++ b/test/interfaces/test-dup-prop.c
@@ -2,6 +2,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
+# undef G_DISABLE_ASSERT
#endif
#include "test-dup-prop.h"
diff --git a/test/interfaces/test-interfaces.c b/test/interfaces/test-interfaces.c
index de56669..d0274ef 100644
--- a/test/interfaces/test-interfaces.c
+++ b/test/interfaces/test-interfaces.c
@@ -2,6 +2,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
+# undef G_DISABLE_ASSERT
#endif
#include "test-interfaces.h"
diff --git a/test/interfaces/test-objects.c b/test/interfaces/test-objects.c
index 3533453..c11cbdc 100644
--- a/test/interfaces/test-objects.c
+++ b/test/interfaces/test-objects.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
+#undef G_DISABLE_ASSERT
#include "test-objects.h"
#include "test-interfaces.h"
diff --git a/test/interfaces/test-server.c b/test/interfaces/test-server.c
index 7d55723..4d32707 100644
--- a/test/interfaces/test-server.c
+++ b/test/interfaces/test-server.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later */
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <stdlib.h>
#include "dbus/dbus-glib.h"
diff --git a/test/specialized-types.c b/test/specialized-types.c
index ce5d82d..2290082 100644
--- a/test/specialized-types.c
+++ b/test/specialized-types.c
@@ -24,6 +24,7 @@
*/
#include <config.h>
+#undef G_DISABLE_ASSERT
#include <string.h>
diff --git a/test/test-service.c b/test/test-service.c
index 1a61058..eae6234 100644
--- a/test/test-service.c
+++ b/test/test-service.c
@@ -1,6 +1,7 @@
/* 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>