Commit Graph

31 Commits

Author SHA1 Message Date
Frediano Ziglio
1b4e8855ea Remove core_public and core_interface_adapter globals usage
Avoid not constant globals.

We started encapsulating all global state into RedsState however
there are still some global variable. This patch remove the
core_public global variable.

To implement this a new SpiceCoreInterface *public_interface
field is added to SpiceCoreInterfaceInternal and the
SpiceCoreInterfaceInternal* argument is passed to callbacks to
understand which external interface to use.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-15 16:49:09 +00:00
Frediano Ziglio
c70b2067a9 Constify event_loop_core
Was used as write variable only for testing.
Avoid usage of not constant globals.
Making globals constants avoid future race condition
usages.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-29 08:08:54 +01:00
Frediano Ziglio
1e4800507b use #include<> style for spice-common header inclusions.
The include directory is specified with the -I which is the directory
used directly by #include<>.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-05-09 12:45:27 +01:00
Christophe Fergeau
6e407a81df event-loop: Remove template
Since SpiceCoreInterfaceInternal is a private data structure, we can
extend it as we see fit without breaking ABI. In particular, adding a
GMainContext member to it allows us to remove the need for
the event loop template which is currently included in the
basic_event_loop.c test file.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21 14:19:24 +00:00
Christophe Fergeau
4b923347b7 test-loop: Improve basic_event_loop base_{timer, watch}_add
They call the functions provided by event_loop_core, but with a NULL
SpiceCoreInterfaceInternal parameter. It makes more sense to pass
event_loop_core rather than NULL.
This will allow to pass the GMainContext to be used through
SpiceCoreInterfaceInternal rather than through a template parameter.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21 14:19:12 +00:00
Frediano Ziglio
323dc46794 tests: add a test for event loop
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-19 23:56:59 +00:00
Frediano Ziglio
f3a7befafe tests: extract code for event loop
This code will be reused for main loop

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-19 23:56:33 +00:00
Frediano Ziglio
3686132923 tests: do not use default loop context
Make sure we don't handle event reserved to other loop contexts.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-19 23:56:28 +00:00
Marc-Andre Lureau
3364af70a3 tests: remove test_util.h
Replace ASSERT() with spice_assert().

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-21 11:44:34 +00:00
Frediano Ziglio
f5f103b8d7 tests: remove unused macro
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-21 10:39:56 +00:00
Frediano Ziglio
276d9f08cd tests: allocate memory in a coherent fashion
Do not free memory allocated with C functions (like calloc) using g_free;
although this is possible with default Glib allocator this is not safe.
Also use consistent allocation functions. All other spice-server code
does not use Glib allocations so for coherence do not use them for
watches.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2015-12-15 17:39:38 +00:00
Christophe Fergeau
e5e3e9eefe Add missing license headers 2015-10-19 14:25:36 +02:00
Frediano Ziglio
e5063799ab replay: do not define same type twice
Avoid to use typedef twice for the same type as some compiler
complaints about it.
SpiceTimer and SpiceWatch are defined in server/spice-core.h
as an abstract type which should be defined by some code (as
server/tests/basic_event_loop.c does).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-09-01 17:16:50 +01:00
Marc-André Lureau
f3179ef791 tests: use glib main loop 2015-08-20 17:47:24 +01:00
Fabiano Fidêncio
63180f6ce3 Fix -Wformat 2014-09-12 18:00:30 +02:00
Alon Levy
9e1d165fc0 server/tests: agent mock, client_monitors_config 2012-09-13 14:47:32 +03:00
Alon Levy
7e3fb815cc server/tests/basic_event_loop: print something on channel_event 2012-02-15 15:09:13 +02:00
Dan McGee
3f303d6014 Remove all usages of bzero()
As recommended by modern C practice, we should just be using memset().

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-14 18:19:43 +02:00
Daniel P. Berrange
7427b23d84 Add missing includes of config.h
Not all files were including config.h
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
d46bc77278 Remove bogus include of strings.h
The tests include strings.h but don't need any of its functions
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
02d56750bd Remove trailing blank lines
Remove any blank lines at the end of all source files
2012-01-13 18:11:59 +02:00
Christophe Fergeau
011266555a server: fix function prototypes
Several functions in server/ were not specifying an argument list,
ie they were declared as void foo(); When compiling with
-Wstrict-prototypes, this leads to:
test_playback.c:93:5: erreur: function declaration isn’t a prototype
[-Werror=strict-prototypes]
2011-09-05 07:52:20 +02:00
Alon Levy
b88f233633 server/tests/basic_event_loop: multiple fixes
reuse common/ring.h
ignore SIGPIPE
fix handling of removed watches
2011-08-23 17:01:14 +03:00
Alon Levy
86f7b490a9 server/tests/basic_event_loop: strange assert failure; fix 2011-07-05 14:08:30 +02:00
Christophe Fergeau
4031681638 server/tests remove useless assignment
This was detected by clang-static-analyzer.
2011-04-08 12:14:20 +02:00
Christophe Fergeau
3ba093a57e tests: fix compilation with -Wall -Werror
When compiling spice with make CFLAGS="-g3 -ggdb3 -O0 -Wall -Werror",
the build broken because of a few unused variables/missing returns.
This patch fixes these warnings.
2011-04-08 12:14:19 +02:00
Alon Levy
0f4a0aa07e server/tests/basic_event_loop: fix bzero warning 2011-02-11 19:13:03 +02:00
Alon Levy
2124818788 server/tests: fix timer reset to allow setting next call during callback 2011-01-10 14:11:37 +02:00
Alon Levy
0707feca43 server/tests: basic_event_loop: reset timer after firing it 2011-01-10 14:11:37 +02:00
Alon Levy
9002d3f005 server/tests: add test_display_no_ssl
updates taken from spice vga mode updates, i.e. non cacheable, glz compressed
(depends on whatever settings you apply to the server) opaque draw operations.
 + completed the SpiceCoreInterface implementation (timers)

v1->v2:
 removed test_util.c (Hans)
 replaced mallocz with calloc (Hans)
2010-11-30 21:03:14 +02:00
Alon Levy
0ede43e893 server: tests: add basic tests with working do nothing server 2010-11-08 16:04:27 +02:00