mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
tests: Apply same warning level as main server code
Allow to catch minor issue with test code. Although test usually are coded with less care than production code the current changes required are not so extensive and can catch different issues. Most of the patch is making functions static to avoid warnings for undeclared functions. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
f934fdc3fd
commit
030ae7bbdc
@ -11,6 +11,7 @@ AM_CPPFLAGS = \
|
||||
$(SMARTCARD_CFLAGS) \
|
||||
$(SPICE_NONPKGCONFIG_CFLAGS) \
|
||||
$(SPICE_PROTOCOL_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
if HAVE_AUTOMATED_TESTS
|
||||
|
||||
@ -40,6 +40,9 @@
|
||||
#error TEST_NAME must be defined!
|
||||
#endif
|
||||
|
||||
// avoid warning, the function is called by stat-main.c
|
||||
void TEST_NAME(void);
|
||||
|
||||
void TEST_NAME(void)
|
||||
{
|
||||
stat_info_t info;
|
||||
|
||||
@ -165,11 +165,12 @@ static void draw_pos(Test *test, int t, int *x, int *y)
|
||||
}
|
||||
|
||||
/* bitmap and rects are freed, so they must be allocated with malloc */
|
||||
SimpleSpiceUpdate *test_spice_create_update_from_bitmap(uint32_t surface_id,
|
||||
QXLRect bbox,
|
||||
uint8_t *bitmap,
|
||||
uint32_t num_clip_rects,
|
||||
QXLRect *clip_rects)
|
||||
static SimpleSpiceUpdate *
|
||||
test_spice_create_update_from_bitmap(uint32_t surface_id,
|
||||
QXLRect bbox,
|
||||
uint8_t *bitmap,
|
||||
uint32_t num_clip_rects,
|
||||
QXLRect *clip_rects)
|
||||
{
|
||||
SimpleSpiceUpdate *update;
|
||||
QXLDrawable *drawable;
|
||||
@ -677,7 +678,7 @@ static struct {
|
||||
uint8_t data[CURSOR_WIDTH * CURSOR_HEIGHT * 4]; // 32bit per pixel
|
||||
} cursor;
|
||||
|
||||
static void cursor_init()
|
||||
static void cursor_init(void)
|
||||
{
|
||||
cursor.cursor.header.unique = 0;
|
||||
cursor.cursor.header.type = SPICE_CURSOR_TYPE_COLOR32;
|
||||
@ -878,7 +879,7 @@ Test *test_new(SpiceCoreInterface *core)
|
||||
return test;
|
||||
}
|
||||
|
||||
void init_automated()
|
||||
static void init_automated(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
@ -887,7 +888,7 @@ void init_automated()
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
}
|
||||
|
||||
__attribute__((noreturn))
|
||||
static __attribute__((noreturn))
|
||||
void usage(const char *argv0, const int exitcode)
|
||||
{
|
||||
#ifdef AUTOMATED_TESTS
|
||||
|
||||
@ -34,7 +34,7 @@ void show_channels(SpiceServer *server);
|
||||
|
||||
int ping_ms = 100;
|
||||
|
||||
void pinger(SPICE_GNUC_UNUSED void *opaque)
|
||||
static void pinger(SPICE_GNUC_UNUSED void *opaque)
|
||||
{
|
||||
// show_channels is not thread safe - fails if disconnections / connections occur
|
||||
//show_channels(server);
|
||||
|
||||
@ -30,7 +30,7 @@ void show_channels(SpiceServer *server);
|
||||
|
||||
int ping_ms = 100;
|
||||
|
||||
void pinger(void *opaque)
|
||||
static void pinger(void *opaque)
|
||||
{
|
||||
Test *test = opaque;
|
||||
// show_channels is not thread safe - fails if disconnections / connections occur
|
||||
@ -39,8 +39,8 @@ void pinger(void *opaque)
|
||||
test->core->timer_start(ping_timer, ping_ms);
|
||||
}
|
||||
|
||||
void set_primary_params(SPICE_GNUC_UNUSED Test *test,
|
||||
Command *command)
|
||||
static void
|
||||
set_primary_params(SPICE_GNUC_UNUSED Test *test, Command *command)
|
||||
{
|
||||
#if 0
|
||||
static int toggle = 0;
|
||||
|
||||
@ -168,7 +168,7 @@ static void create_frame1(Test *test, Command *command)
|
||||
create_clipped_frame(test, command, 0);
|
||||
}
|
||||
|
||||
void create_frame2(Test *test, Command *command)
|
||||
static void create_frame2(Test *test, Command *command)
|
||||
{
|
||||
create_clipped_frame(test, command, 200);
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ void show_channels(SpiceServer *server);
|
||||
|
||||
int ping_ms = 100;
|
||||
|
||||
void pinger(void *opaque)
|
||||
static void pinger(void *opaque)
|
||||
{
|
||||
Test *test = opaque;
|
||||
// show_channels is not thread safe - fails if disconnections / connections occur
|
||||
@ -42,8 +42,8 @@ void pinger(void *opaque)
|
||||
static int g_surface_id = 1;
|
||||
static uint8_t *g_surface_data;
|
||||
|
||||
void set_draw_parameters(SPICE_GNUC_UNUSED Test *test,
|
||||
Command *command)
|
||||
static void
|
||||
set_draw_parameters(SPICE_GNUC_UNUSED Test *test, Command *command)
|
||||
{
|
||||
static int count = 17;
|
||||
CommandDrawSolid *solid = &command->solid;
|
||||
@ -56,8 +56,8 @@ void set_draw_parameters(SPICE_GNUC_UNUSED Test *test,
|
||||
count++;
|
||||
}
|
||||
|
||||
void set_surface_params(SPICE_GNUC_UNUSED Test *test,
|
||||
Command *command)
|
||||
static void
|
||||
set_surface_params(SPICE_GNUC_UNUSED Test *test, Command *command)
|
||||
{
|
||||
CommandCreateSurface *create = &command->create_surface;
|
||||
|
||||
@ -73,8 +73,8 @@ void set_surface_params(SPICE_GNUC_UNUSED Test *test,
|
||||
create->data = g_surface_data;
|
||||
}
|
||||
|
||||
void set_destroy_parameters(SPICE_GNUC_UNUSED Test *test,
|
||||
SPICE_GNUC_UNUSED Command *command)
|
||||
static void
|
||||
set_destroy_parameters(SPICE_GNUC_UNUSED Test *test, SPICE_GNUC_UNUSED Command *command)
|
||||
{
|
||||
if (g_surface_data) {
|
||||
free(g_surface_data);
|
||||
@ -96,7 +96,7 @@ static Command commands[] = {
|
||||
{SIMPLE_DESTROY_SURFACE, set_destroy_parameters, .cb_opaque = NULL},
|
||||
};
|
||||
|
||||
void on_client_connected(Test *test)
|
||||
static void on_client_connected(Test *test)
|
||||
{
|
||||
test_set_command_list(test, commands, COUNT(commands));
|
||||
}
|
||||
|
||||
@ -25,46 +25,54 @@ struct SpiceTimer {
|
||||
int a,b;
|
||||
};
|
||||
|
||||
SpiceTimer* timer_add(SPICE_GNUC_UNUSED SpiceTimerFunc func,
|
||||
SPICE_GNUC_UNUSED void *opaque)
|
||||
static SpiceTimer*
|
||||
timer_add(SPICE_GNUC_UNUSED SpiceTimerFunc func,
|
||||
SPICE_GNUC_UNUSED void *opaque)
|
||||
{
|
||||
static struct SpiceTimer t = {0,};
|
||||
|
||||
return &t;
|
||||
}
|
||||
|
||||
void timer_start(SPICE_GNUC_UNUSED SpiceTimer *timer,
|
||||
SPICE_GNUC_UNUSED uint32_t ms)
|
||||
static void
|
||||
timer_start(SPICE_GNUC_UNUSED SpiceTimer *timer,
|
||||
SPICE_GNUC_UNUSED uint32_t ms)
|
||||
{
|
||||
}
|
||||
|
||||
void timer_cancel(SPICE_GNUC_UNUSED SpiceTimer *timer)
|
||||
static void
|
||||
timer_cancel(SPICE_GNUC_UNUSED SpiceTimer *timer)
|
||||
{
|
||||
}
|
||||
|
||||
void timer_remove(SPICE_GNUC_UNUSED SpiceTimer *timer)
|
||||
static void
|
||||
timer_remove(SPICE_GNUC_UNUSED SpiceTimer *timer)
|
||||
{
|
||||
}
|
||||
|
||||
SpiceWatch *watch_add(SPICE_GNUC_UNUSED int fd,
|
||||
SPICE_GNUC_UNUSED int event_mask,
|
||||
SPICE_GNUC_UNUSED SpiceWatchFunc func,
|
||||
SPICE_GNUC_UNUSED void *opaque)
|
||||
static SpiceWatch *
|
||||
watch_add(SPICE_GNUC_UNUSED int fd,
|
||||
SPICE_GNUC_UNUSED int event_mask,
|
||||
SPICE_GNUC_UNUSED SpiceWatchFunc func,
|
||||
SPICE_GNUC_UNUSED void *opaque)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void watch_update_mask(SPICE_GNUC_UNUSED SpiceWatch *watch,
|
||||
SPICE_GNUC_UNUSED int event_mask)
|
||||
static void
|
||||
watch_update_mask(SPICE_GNUC_UNUSED SpiceWatch *watch,
|
||||
SPICE_GNUC_UNUSED int event_mask)
|
||||
{
|
||||
}
|
||||
|
||||
void watch_remove(SPICE_GNUC_UNUSED SpiceWatch *watch)
|
||||
static void
|
||||
watch_remove(SPICE_GNUC_UNUSED SpiceWatch *watch)
|
||||
{
|
||||
}
|
||||
|
||||
void channel_event(SPICE_GNUC_UNUSED int event,
|
||||
SPICE_GNUC_UNUSED SpiceChannelEventInfo *info)
|
||||
static void
|
||||
channel_event(SPICE_GNUC_UNUSED int event,
|
||||
SPICE_GNUC_UNUSED SpiceChannelEventInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ static void get_frame(void)
|
||||
: 100;
|
||||
}
|
||||
|
||||
void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque)
|
||||
static void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque)
|
||||
{
|
||||
static int t = 0;
|
||||
static uint64_t last_sent_usec = 0;
|
||||
|
||||
@ -37,7 +37,7 @@ int ping_ms = 100;
|
||||
#define MIN(a, b) ((a) > (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
void pinger(SPICE_GNUC_UNUSED void *opaque)
|
||||
static void pinger(SPICE_GNUC_UNUSED void *opaque)
|
||||
{
|
||||
// show_channels is not thread safe - fails if disconnections / connections occur
|
||||
//show_channels(server);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user