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

Christophe Fergeau cfergeau at redhat.com
Thu Mar 2 14:22:58 UTC 2017


On Thu, Mar 02, 2017 at 01:50:02PM +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/glib-compat.h               |  8 ++++++++
>  server/tests/test-codecs-parsing.c |  6 +-----
>  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(-)

I'd also move these to a tests/test-glib-compat.h  file

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

> 
> diff --git a/server/glib-compat.h b/server/glib-compat.h
> index 9d75701..557e13e 100644
> --- a/server/glib-compat.h
> +++ b/server/glib-compat.h
> @@ -72,4 +72,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 /* GLIB_COMPAT_H_ */
> diff --git a/server/tests/test-codecs-parsing.c b/server/tests/test-codecs-parsing.c
> index 5af2e5d..571d8ab 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 "glib-compat.h"
>  
>  static void codecs_good(void)
>  {
> diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
> index b8521f4..21ffd5c 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 "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..2c612c3 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 "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..502aadd 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 "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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170302/206704ce/attachment.sig>


More information about the Spice-devel mailing list