[Spice-commits] server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Dec 21 03:46:24 PST 2015


 server/tests/Makefile.am         |    1 -
 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(+), 44 deletions(-)

New commits:
commit 3364af70a39b1ff9d8ac73f09d5d9067865ca16a
Author: Marc-Andre Lureau <marcandre.lureau at gmail.com>
Date:   Wed Dec 16 00:49:20 2015 +0100

    tests: remove test_util.h
    
    Replace ASSERT() with spice_assert().
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index d0bd5a0..94a4103 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -29,7 +29,6 @@ LDADD =								\
 COMMON_BASE =					\
 	basic_event_loop.c			\
 	basic_event_loop.h			\
-	test_util.h				\
 	$(NULL)
 
 noinst_PROGRAMS =				\
diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index bb41f2d..84652a4 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__


More information about the Spice-commits mailing list