From e7b3af81597db1a6b55f2c15d030d703c6b2c6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 4 May 2018 15:34:46 +0100 Subject: glib: bump min required glib library version to 2.40 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per supported platforms doc[1], the various min glib on relevant distros is: RHEL-7: 2.50.3 Debian (Stretch): 2.50.3 Debian (Jessie): 2.42.1 OpenBSD (Ports): 2.54.3 FreeBSD (Ports): 2.50.3 OpenSUSE Leap 15: 2.54.3 SLE12-SP2: 2.48.2 Ubuntu (Xenial): 2.48.0 macOS (Homebrew): 2.56.0 This suggests that a minimum glib of 2.42 is a reasonable target. The GLibC compile farm, however, uses Ubuntu 14.04 (Trusty) which only has glib 2.40.0, and this is needed for testing during merge. Thus an exception is made to the documented platform support policy to allow for all three current LTS releases to be supported. Docker jobs that not longer satisfy this new min version are removed. [1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrangé --- tests/docker/dockerfiles/centos6.docker | 30 ------------------------------ tests/docker/dockerfiles/min-glib.docker | 8 -------- tests/ivshmem-test.c | 6 ------ tests/test-qmp-event.c | 8 +------- tests/tpm-emu.h | 4 ++-- tests/vhost-user-test.c | 26 ++------------------------ 6 files changed, 5 insertions(+), 77 deletions(-) delete mode 100644 tests/docker/dockerfiles/centos6.docker delete mode 100644 tests/docker/dockerfiles/min-glib.docker (limited to 'tests') diff --git a/tests/docker/dockerfiles/centos6.docker b/tests/docker/dockerfiles/centos6.docker deleted file mode 100644 index ad24319582..0000000000 --- a/tests/docker/dockerfiles/centos6.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM centos:6 -RUN yum install -y epel-release centos-release-xen -ENV PACKAGES \ - bison \ - bzip2-devel \ - ccache \ - csnappy-devel \ - flex \ - g++ \ - gcc \ - gettext \ - git \ - glib2-devel \ - libepoxy-devel \ - libfdt-devel \ - librdmacm-devel \ - lzo-devel \ - make \ - mesa-libEGL-devel \ - mesa-libgbm-devel \ - pixman-devel \ - SDL-devel \ - spice-glib-devel \ - spice-server-devel \ - tar \ - vte-devel \ - xen-devel \ - zlib-devel -RUN yum install -y $PACKAGES -RUN rpm -q $PACKAGES | sort > /packages.txt diff --git a/tests/docker/dockerfiles/min-glib.docker b/tests/docker/dockerfiles/min-glib.docker deleted file mode 100644 index f2eed97d35..0000000000 --- a/tests/docker/dockerfiles/min-glib.docker +++ /dev/null @@ -1,8 +0,0 @@ -FROM centos:6 -RUN yum install -y \ - tar gettext git make gcc g++ \ - zlib-devel SDL-devel pixman-devel \ - epel-release -RUN yum install -y libfdt-devel ccache -RUN yum downgrade -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-2.22.5-5.el6.x86_64.rpm -RUN yum install -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-devel-2.22.5-5.el6.x86_64.rpm diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 8af16ee79a..9b407a3e42 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -504,12 +504,6 @@ int main(int argc, char **argv) const char *arch = qtest_get_arch(); gchar dir[] = "/tmp/ivshmem-test.XXXXXX"; -#if !GLIB_CHECK_VERSION(2, 31, 0) - if (!g_thread_supported()) { - g_thread_init(NULL); - } -#endif - g_test_init(&argc, &argv, NULL); qtest_add_abrt_handler(abrt_handler, NULL); diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 3a7c227a1d..8677094ad1 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -32,7 +32,7 @@ typedef struct QDictCmpData { } QDictCmpData; TestEventData *test_event_data; -static CompatGMutex test_event_lock; +static GMutex test_event_lock; /* Only compares bool, int, string */ static @@ -242,12 +242,6 @@ static void test_event_d(TestEventData *data, int main(int argc, char **argv) { -#if !GLIB_CHECK_VERSION(2, 31, 0) - if (!g_thread_supported()) { - g_thread_init(NULL); - } -#endif - qmp_event_set_func_emit(event_test_emit); g_test_init(&argc, &argv, NULL); diff --git a/tests/tpm-emu.h b/tests/tpm-emu.h index ef4bfa8800..08f902485e 100644 --- a/tests/tpm-emu.h +++ b/tests/tpm-emu.h @@ -24,8 +24,8 @@ struct tpm_hdr { } QEMU_PACKED; typedef struct TestState { - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; SocketAddress *addr; QIOChannel *tpm_ioc; GThread *emu_tpm_thread; diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index bbc8091286..8ff2106d32 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -32,14 +32,6 @@ #include #include -/* GLIB version compatibility flags */ -#if !GLIB_CHECK_VERSION(2, 26, 0) -#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT(1000000)) -#endif - -#if GLIB_CHECK_VERSION(2, 28, 0) -#define HAVE_MONOTONIC_TIME -#endif #define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM," \ "mem-path=%s,share=on -numa node,memdev=mem" @@ -150,8 +142,8 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; int log_fd; uint64_t rings; bool test_fail; @@ -642,21 +634,7 @@ test_migrate_source_check(GSource *source) return FALSE; } -#if !GLIB_CHECK_VERSION(2,36,0) -/* this callback is unnecessary with glib >2.36, the default - * prepare for the source does the same */ -static gboolean -test_migrate_source_prepare(GSource *source, gint *timeout) -{ - *timeout = -1; - return FALSE; -} -#endif - GSourceFuncs test_migrate_source_funcs = { -#if !GLIB_CHECK_VERSION(2,36,0) - .prepare = test_migrate_source_prepare, -#endif .check = test_migrate_source_check, }; -- cgit v1.2.3 From e71e8cc035558eabd6b3e19f6d3254c754c027ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 4 May 2018 16:25:00 +0100 Subject: glib: enforce the minimum required version and warn about old APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two useful macros that can be defined before including glib.h that are related to the min required glib version - GLIB_VERSION_MIN_REQUIRED When this is defined, if code uses an API that was deprecated in this version, or older, a compiler warning will be emitted. This alerts maintainers to update their code to whatever new replacement API is now recommended best practice. - GLIB_VERSION_MAX_ALLOWED When this is defined, if code uses an API that was introduced in a version that is newer than the declared version, a compiler warning will be emitted. This alerts maintainers if new code accidentally uses functionality that won't be available on some supported platforms. The GLIB_VERSION_MAX_ALLOWED constant makes it a bit harder to opt in to using specific new APIs with a GLIB_CHECK_VERSION conditional. To workaround this Pragmas can be used to temporarily turn off the -Wdeprecated-declarations compiler warning, while a static inline compat function is implemented. This workaround is illustrated with the implementation of the g_strv_contains method to satisfy the test suite. Signed-off-by: Daniel P. Berrangé --- tests/test-qga.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests') diff --git a/tests/test-qga.c b/tests/test-qga.c index 18e63cb533..30c9643257 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -744,12 +744,10 @@ static void test_qga_config(gconstpointer data) strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error); g_assert_cmpint(n, ==, 2); -#if GLIB_CHECK_VERSION(2, 44, 0) g_assert_true(g_strv_contains((const char * const *)strv, "guest-ping")); g_assert_true(g_strv_contains((const char * const *)strv, "guest-get-time")); -#endif g_assert_no_error(error); g_strfreev(strv); -- cgit v1.2.3