From ed868a388b40333ce63e9c56720f283ea655d31d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 22 Apr 2014 17:05:41 +0200 Subject: [PATCH] core: add compatibility wrapper for g_test_skip() to nm-glib-compat.h Signed-off-by: Thomas Haller --- include/nm-glib-compat.h | 14 ++++++++++++++ include/nm-test-utils.h | 1 + libnm-util/tests/test-general.c | 1 - .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 1 - src/settings/plugins/keyfile/tests/test-keyfile.c | 2 -- .../tests/test-supplicant-config.c | 2 -- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index 2141b91958..cfaddb7d31 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -96,4 +96,18 @@ g_type_ensure (GType type) #define g_test_initialized() (g_test_config_vars->test_initialized) #endif +/* g_test_skip() is only available since glib 2.38. Add a compatibility wrapper. */ +inline static void +__nmtst_g_test_skip (const gchar *msg) +{ +#if GLIB_CHECK_VERSION (2, 38, 0) + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + g_test_skip (msg); + G_GNUC_END_IGNORE_DEPRECATIONS +#else + g_debug ("%s", msg); +#endif +} +#define g_test_skip __nmtst_g_test_skip + #endif /* NM_GLIB_COMPAT_H */ diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index a4b2491533..97937a90bc 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -33,6 +33,7 @@ #include #include "nm-utils.h" +#include "nm-glib-compat.h" struct __nmtst_internal diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 5922f1fb87..bc63251754 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -43,7 +43,6 @@ #include "nm-utils.h" #include "nm-util-private.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-test-utils.h" diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 98706725e5..5d91b2add3 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -49,7 +49,6 @@ #include #include "NetworkManagerUtils.h" -#include "nm-glib-compat.h" #include "common.h" #include "reader.h" diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index 5084a45bda..335167ba6c 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -41,8 +41,6 @@ #include #include -#include "nm-glib-compat.h" - #include "reader.h" #include "writer.h" diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c index 9b1038b618..2b917625a6 100644 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ b/src/supplicant-manager/tests/test-supplicant-config.c @@ -39,8 +39,6 @@ #include #include -#include "nm-glib-compat.h" - #include "nm-supplicant-config.h" #include "nm-supplicant-settings-verify.h"