summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2019-05-02 15:51:42 +0100
committerSimon McVittie <smcv@collabora.com>2019-11-11 18:32:06 +0000
commit3063c69515dcda9129ebea989d4c95341f0c1e9f (patch)
tree4d7382c78af93e0114214c4a04206692c46ead86
parentc8216c90ed8eedae574b01ac63449f6c9b3f7dda (diff)
downloadlibglnx-3063c69515dcda9129ebea989d4c95341f0c1e9f.tar.gz
Make tests cope with older GLib
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--glnx-backports.h12
-rw-r--r--tests/test-libglnx-xattrs.c4
2 files changed, 16 insertions, 0 deletions
diff --git a/glnx-backports.h b/glnx-backports.h
index b6d93c0..6c39cf2 100644
--- a/glnx-backports.h
+++ b/glnx-backports.h
@@ -63,4 +63,16 @@ gboolean glnx_set_object (GObject **object_ptr,
#endif /* !GLIB_CHECK_VERSION(2, 44, 0) */
+#ifndef g_assert_nonnull
+#define g_assert_nonnull(x) g_assert (x != NULL)
+#endif
+
+#ifndef g_assert_null
+#define g_assert_null(x) g_assert (x == NULL)
+#endif
+
+#if !GLIB_CHECK_VERSION (2, 38, 0)
+#define g_test_skip(s) g_test_message ("SKIP: %s", s)
+#endif
+
G_END_DECLS
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c
index 63e1231..82def4a 100644
--- a/tests/test-libglnx-xattrs.c
+++ b/tests/test-libglnx-xattrs.c
@@ -218,7 +218,11 @@ test_xattr_races (void)
/* FIXME - this deadlocks for me on 4.9.4-201.fc25.x86_64, whether
* using overlayfs or xfs as source/dest.
*/
+#if GLIB_CHECK_VERSION (2, 36, 0)
const guint nprocs = MAX (4, g_get_num_processors ());
+#else
+ const guint nprocs = 4;
+#endif
struct XattrWorker wdata[nprocs];
GThread *threads[nprocs];
g_autoptr(GError) local_error = NULL;