[Spice-devel] [PATCH spice 06/18] tests: remote test_util.h
Frediano Ziglio
fziglio at redhat.com
Wed Dec 16 00:58:51 PST 2015
>
> Replace ASSERT() with spice_assert().
>
Typo on comment "remove" not "remote".
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
> server/tests/Makefile.am | 2 --
> server/tests/basic_event_loop.c | 1 -
> server/tests/test_display_base.c | 23 +++++++++++------------
> server/tests/test_playback.c | 1 -
> server/tests/test_util.h | 29 -----------------------------
> 5 files changed, 11 insertions(+), 45 deletions(-)
> delete mode 100644 server/tests/test_util.h
>
> diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
> index 52cdf87..e23e356 100644
> --- a/server/tests/Makefile.am
> +++ b/server/tests/Makefile.am
> @@ -23,7 +23,6 @@ noinst_LTLIBRARIES = libtest.la
> libtest_la_SOURCES = \
> basic_event_loop.c \
> basic_event_loop.h \
> - test_util.h \
> $(NULL)
>
> LDADD = \
> @@ -118,7 +117,6 @@ test_display_width_stride_SOURCES = \
> spice_server_replay_SOURCES = \
> replay.c \
> test_display_base.h \
> - test_util.h \
> $(NULL)
>
> stat_test_SOURCES = stat-main.c
> diff --git a/server/tests/basic_event_loop.c
> b/server/tests/basic_event_loop.c
> index c9c2637..72405a4 100644
> --- a/server/tests/basic_event_loop.c
> +++ b/server/tests/basic_event_loop.c
> @@ -26,7 +26,6 @@
> #include "spice/macros.h"
> #include "common/ring.h"
> #include "common/mem.h"
> -#include "test_util.h"
> #include "basic_event_loop.h"
>
> int debug = 0;
> diff --git a/server/tests/test_display_base.c
> b/server/tests/test_display_base.c
> index b574756..8e577c9 100644
> --- a/server/tests/test_display_base.c
> +++ b/server/tests/test_display_base.c
> @@ -32,7 +32,6 @@
>
> #include "test_display_base.h"
> #include "red-channel.h"
> -#include "test_util.h"
>
> #ifndef PATH_MAX
> #define PATH_MAX 4096
> @@ -382,10 +381,10 @@ static void create_primary_surface(Test *test, uint32_t
> width,
> {
> QXLDevSurfaceCreate surface = { 0, };
>
> - ASSERT(height <= MAX_HEIGHT);
> - ASSERT(width <= MAX_WIDTH);
> - ASSERT(height > 0);
> - ASSERT(width > 0);
> + spice_assert(height <= MAX_HEIGHT);
> + spice_assert(width <= MAX_WIDTH);
> + spice_assert(height > 0);
> + spice_assert(width > 0);
>
> surface.format = SPICE_SURFACE_FMT_32_xRGB;
> surface.width = test->primary_width = width;
> @@ -472,7 +471,7 @@ struct QXLCommandExt* commands[1024];
>
> static void push_command(QXLCommandExt *ext)
> {
> - ASSERT(commands_end - commands_start < (int) COMMANDS_SIZE);
> + spice_assert(commands_end - commands_start < (int) COMMANDS_SIZE);
> commands[commands_end % COMMANDS_SIZE] = ext;
> commands_end++;
> }
> @@ -480,7 +479,7 @@ static void push_command(QXLCommandExt *ext)
> static struct QXLCommandExt *get_simple_command(void)
> {
> struct QXLCommandExt *ret = commands[commands_start % COMMANDS_SIZE];
> - ASSERT(commands_start < commands_end);
> + spice_assert(commands_start < commands_end);
> commands_start++;
> return ret;
> }
> @@ -506,7 +505,7 @@ static void produce_command(Test *test)
> Command *command;
> QXLWorker *qxl_worker = test->qxl_worker;
>
> - ASSERT(qxl_worker);
> + spice_assert(qxl_worker);
>
> if (test->has_secondary)
> test->target_surface = 1;
> @@ -583,9 +582,9 @@ static void produce_command(Test *test)
> case SIMPLE_CREATE_SURFACE: {
> SimpleSurfaceCmd *update;
> if (command->create_surface.data) {
> - ASSERT(command->create_surface.surface_id > 0);
> - ASSERT(command->create_surface.surface_id <
> MAX_SURFACE_NUM);
> - ASSERT(command->create_surface.surface_id == 1);
> + spice_assert(command->create_surface.surface_id > 0);
> + spice_assert(command->create_surface.surface_id <
> MAX_SURFACE_NUM);
> + spice_assert(command->create_surface.surface_id == 1);
> update = create_surface(command->create_surface.surface_id,
> command->create_surface.format,
> command->create_surface.width,
> @@ -649,7 +648,7 @@ static void release_resource(SPICE_GNUC_UNUSED
> QXLInstance *qin,
> {
> QXLCommandExt *ext = (QXLCommandExt*)(unsigned
> long)release_info.info->id;
> //printf("%s\n", __func__);
> - ASSERT(release_info.group_id == MEM_SLOT_GROUP_ID);
> + spice_assert(release_info.group_id == MEM_SLOT_GROUP_ID);
> switch (ext->cmd.type) {
> case QXL_CMD_DRAW:
> test_spice_destroy_update((void*)ext);
> diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
> index ed87f64..cf31155 100644
> --- a/server/tests/test_playback.c
> +++ b/server/tests/test_playback.c
> @@ -23,7 +23,6 @@
>
> #include <spice.h>
> #include "reds.h"
> -#include "test_util.h"
> #include "basic_event_loop.h"
>
> /* test the audio playback interface. Really basic no frils test - create
> diff --git a/server/tests/test_util.h b/server/tests/test_util.h
> deleted file mode 100644
> index b12de7e..0000000
> --- a/server/tests/test_util.h
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> -/*
> - Copyright (C) 2009-2015 Red Hat, Inc.
> -
> - This library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - This library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with this library; if not, see
> <http://www.gnu.org/licenses/>.
> -*/
> -#ifndef __TEST_UTIL_H__
> -#define __TEST_UTIL_H__
> -
> -#ifdef ASSERT
> -#undef ASSERT
> -#endif
> -#define ASSERT(x) if (!(x)) { \
> - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
> - abort(); \
> -}
> -
> -#endif // __TEST_UTIL_H__
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list