[Spice-devel] [PATCH spice-server v2 2/3] tests: Move some specific GLib compatibility to compatibility file

Frediano Ziglio fziglio at redhat.com
Fri Mar 3 14:21:22 UTC 2017


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/test-codecs-parsing.c |  6 +-----
 server/tests/test-glib-compat.h    |  8 ++++++++
 server/tests/test-leaks.c          |  7 +------
 server/tests/test-options.c        |  7 +------
 server/tests/test-stat-file.c      | 10 +---------
 5 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/server/tests/test-codecs-parsing.c b/server/tests/test-codecs-parsing.c
index 5af2e5d..a2e1b9a 100644
--- a/server/tests/test-codecs-parsing.c
+++ b/server/tests/test-codecs-parsing.c
@@ -16,13 +16,9 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include <config.h>
-#include <glib.h>
 #include <spice.h>
 
-/* GLIB_CHECK_VERSION(2, 40, 0) */
-#ifndef g_assert_nonnull
-#define g_assert_nonnull g_assert
-#endif
+#include "test-glib-compat.h"
 
 static void codecs_good(void)
 {
diff --git a/server/tests/test-glib-compat.h b/server/tests/test-glib-compat.h
index 23e094d..e50d093 100644
--- a/server/tests/test-glib-compat.h
+++ b/server/tests/test-glib-compat.h
@@ -31,4 +31,12 @@ void g_test_expect_message(const gchar *log_domain, GLogLevelFlags log_level,
                            const gchar *pattern);
 #endif
 
+/* GLIB_CHECK_VERSION(2, 40, 0) */
+#ifndef g_assert_nonnull
+#define g_assert_nonnull g_assert
+#endif
+#ifndef g_assert_null
+#define g_assert_null(ptr) g_assert((ptr) == NULL)
+#endif
+
 #endif // TEST_GLIB_COMPAT_H_
diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
index b8521f4..e07e3c6 100644
--- a/server/tests/test-leaks.c
+++ b/server/tests/test-leaks.c
@@ -16,16 +16,11 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include <config.h>
-#include <glib.h>
 #include <spice.h>
 
+#include "test-glib-compat.h"
 #include "basic-event-loop.h"
 
-/* GLIB_CHECK_VERSION(2, 40, 0) */
-#ifndef g_assert_nonnull
-#define g_assert_nonnull g_assert
-#endif
-
 static void leaks(void)
 {
     int result;
diff --git a/server/tests/test-options.c b/server/tests/test-options.c
index 0cfd4b3..4d77bff 100644
--- a/server/tests/test-options.c
+++ b/server/tests/test-options.c
@@ -16,16 +16,11 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include <config.h>
-#include <glib.h>
 #include <spice.h>
 
+#include "test-glib-compat.h"
 #include "basic-event-loop.h"
 
-/* GLIB_CHECK_VERSION(2, 40, 0) */
-#ifndef g_assert_nonnull
-#define g_assert_nonnull g_assert
-#endif
-
 static void agent_options(void)
 {
     SpiceCoreInterface *core ;
diff --git a/server/tests/test-stat-file.c b/server/tests/test-stat-file.c
index 40cf37d..63a2a2b 100644
--- a/server/tests/test-stat-file.c
+++ b/server/tests/test-stat-file.c
@@ -19,19 +19,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <glib.h>
 #include <spice.h>
 
+#include "test-glib-compat.h"
 #include "stat-file.h"
 
-/* GLIB_CHECK_VERSION(2, 40, 0) */
-#ifndef g_assert_nonnull
-#define g_assert_nonnull g_assert
-#endif
-#ifndef g_assert_null
-#define g_assert_null(ptr) g_assert((ptr) == NULL)
-#endif
-
 static void stat_file(void)
 {
     RedStatFile *stat_file;
-- 
2.9.3



More information about the Spice-devel mailing list