Commit Graph

3409 Commits

Author SHA1 Message Date
Frediano Ziglio
186b8439ae reds-stream: Small syscall optimisation
Handle single chunk writev as normal write.
From some test more than 60% of the times writev is called with 1 as
counter. We can easily and very cheaply turn this call to a simpler
write avoiding the need to pass the array to the kernel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-23 12:04:35 +00:00
Christophe Fergeau
7b5e294a36 tests/pki: Use CA/certificate valid until 2048
As pointed out by danpb, tests/pki/server-cert.pem is only valid until
Fri Nov 29 15:51:44 UTC 2019

This changes tests/pki/server-cert.pem and tests/pki/ca-cert.pem to be
valid until 2048. These certificates were generated using the
instructions on https://www.spice-space.org/page/SSLConnection
The -subj args were omitted, and the defaults suggested by openssl used.
The -days parameter was changed to -days 10950.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-23 12:02:47 +01:00
Christophe Fergeau
759fdfc6d1 build-sys: Add tests/pki to EXTRA_DIST
This fixes make distcheck

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-23 12:02:47 +01:00
Pavel Grunt
7ac9949925 ci: Add valgrind check
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-22 16:23:01 +00:00
Frediano Ziglio
9bad8c306c Fix GStreamer encoding if stride is not 4 bytes aligned
This is required by GStreamer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-22 15:52:15 +00:00
Christophe Fergeau
68bc284b52 build-sys: Update to latest ax_valgrind_check.m4
This allows to remove a small hack in server/Makefile.am where we were
using make check-valgrind-memcheck rather than make check-valgrind to
make sure we get a non-0 exit code on failures.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-22 09:34:40 +00:00
Christophe Fergeau
844544f8be build-sys: Add make check-valgrind target
This allows to run automatically our test-suite with valgrind to test
for memory leaks.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-21 16:34:56 +01:00
Christophe Fergeau
02d42d4f00 tests: Port test-qxl-parsing to GTest
test-qxl-parsing is really a series of several tests. Porting it to
GTest makes this more obvious. This also has the side-effect of making
it more friendly to 'make check-valgrind' (which would fail on SIGALRM,
and on unexpected g_warning()).

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-21 16:34:56 +01:00
Christophe Fergeau
8be1120904 reds-stream: Don't use sendmsg with uninitialized memory
On my 64 bit Fedora 25, CMSG_SPACE() adds 4 bytes of padding after the
file descriptor in the control data. This causes warnings when ran under
valgrind as we set msg_controllen to CMSG_SPACE().

This commit fills the control data to 0 to avoid these warnings.

==30301== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
==30301==    at 0x8127367: sendmsg (sendmsg.c:28)
==30301==    by 0x41880B: reds_stream_send_msgfd (reds-stream.c:295)
==30301==    by 0x40953F: main (test-stream.c:121)
==30301==  Address 0xffefff1b4 is on thread 1's stack
==30301==  in frame #1, created by reds_stream_send_msgfd (reds-stream.c:263)

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-21 16:34:56 +01:00
Frediano Ziglio
a0c32918a2 build: Fix some indentation issue on Makefile.am
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-17 10:53:08 +00:00
Frediano Ziglio
e3e2cbcb3a Revert "gstreamer: Avoid memory copy if strides are different"
This reverts commit c3d237075b.

When you call gst_buffer_add_video_meta_full GStreamer assumes that
buffer is contiguous. Specifically GStreamer assumes that the first
chunk is big enough to hold a whole frame. This results usually in
some pixel shifts in the video. The pixel shifts you can see are
artifacts due to how the guest sends the frames.

Assuming you allocate the 2 chunks with 2 malloc:

   p1 = malloc(size);
   ...
   p2 = malloc(size);

Usually the memory allocator tend to allocate linearly if there are
space adding a prefix to describe next block leading to a memory
arrangement as:

   +-------------------+
   | p1 prefix         |
   +-------------------+
   | p1 buffer         |
   +-------------------+
   | p2 prefix         |
   +-------------------+
   | p2 buffer         |
   +-------------------+

now if you take p1 pointer and you assume it points to a 2 * size
buffer you will get p2 prefix in the middle, this prefix is the pixel
shifts.

Problems happens specifically in gst_video_frame_map_id.
This bug is reported in https://bugzilla.gnome.org/show_bug.cgi?id=779524.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-16 13:19:01 +00:00
Christophe Fergeau
4b1c95beee Add missing chainups to parent class
A few dispose/finalize implementations were not chaining up to their
parent classes, causing memory leaks.

This fixes leaks like the following:

==16240== Memcheck, a memory error detector
==16240== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==16240== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==16240== Command: ./test-leaks
==16240==
==16240==
==16240== HEAP SUMMARY:
==16240==     in use at exit: 245,490 bytes in 3,638 blocks
==16240==   total heap usage: 5,418 allocs, 1,780 frees, 17,676,968 bytes allocated
==16240==
==16240== 16 bytes in 1 blocks are definitely lost in loss record 203 of 771
==16240==    at 0x4C2DADE: malloc (vg_replace_malloc.c:298)
==16240==    by 0x4C2FC91: realloc (vg_replace_malloc.c:785)
==16240==    by 0x52864E: dispatcher_register_handler (dispatcher.c:374)
==16240==    by 0x5293E0: main_dispatcher_constructed (main-dispatcher.c:315)
==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
==16240==    by 0x4095B1: server_leaks (test-leaks.c:45)
==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
==16240==    by 0x409A0B: main (test-leaks.c:126)
==16240==
==16240== 16 bytes in 1 blocks are definitely lost in loss record 204 of 771
==16240==    at 0x4C2DADE: malloc (vg_replace_malloc.c:298)
==16240==    by 0x4C2FC91: realloc (vg_replace_malloc.c:785)
==16240==    by 0x52864E: dispatcher_register_handler (dispatcher.c:374)
==16240==    by 0x5293E0: main_dispatcher_constructed (main-dispatcher.c:315)
==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
==16240==    by 0x40BFD4: test_new (test-display-base.c:902)
==16240==    by 0x40979D: vmc_leaks (test-leaks.c:92)
==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
==16240==    by 0x409A0B: main (test-leaks.c:126)
==16240==
==16240== 96 bytes in 1 blocks are definitely lost in loss record 638 of 771
==16240==    at 0x4C2FA50: calloc (vg_replace_malloc.c:711)
==16240==    by 0x8427D3C: g_malloc0 (gmem.c:124)
==16240==    by 0x842801F: g_malloc0_n (gmem.c:355)
==16240==    by 0x527B44: dispatcher_constructed (dispatcher.c:141)
==16240==    by 0x529321: main_dispatcher_constructed (main-dispatcher.c:307)
==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
==16240==    by 0x4095B1: server_leaks (test-leaks.c:45)
==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
==16240==    by 0x409A0B: main (test-leaks.c:126)
==16240==
==16240== 96 bytes in 1 blocks are definitely lost in loss record 639 of 771
==16240==    at 0x4C2FA50: calloc (vg_replace_malloc.c:711)
==16240==    by 0x8427D3C: g_malloc0 (gmem.c:124)
==16240==    by 0x842801F: g_malloc0_n (gmem.c:355)
==16240==    by 0x527B44: dispatcher_constructed (dispatcher.c:141)
==16240==    by 0x529321: main_dispatcher_constructed (main-dispatcher.c:307)
==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
==16240==    by 0x40BFD4: test_new (test-display-base.c:902)
==16240==    by 0x40979D: vmc_leaks (test-leaks.c:92)
==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
==16240==    by 0x409A0B: main (test-leaks.c:126)
==16240==
==16240== LEAK SUMMARY:
==16240==    definitely lost: 224 bytes in 4 blocks
==16240==    indirectly lost: 0 bytes in 0 blocks
==16240==      possibly lost: 0 bytes in 0 blocks
==16240==    still reachable: 207,718 bytes in 3,312 blocks
==16240==                       of which reachable via heuristic:
==16240==                         newarray           : 1,536 bytes in 16 blocks
==16240==         suppressed: 34,548 bytes in 302 blocks
==16240== Reachable blocks (those to which a pointer was found) are not shown.
==16240== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==16240==
==16240== For counts of detected and suppressed errors, rerun with: -v
==16240== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 20 from 20)
FAIL test-leaks (exit status: 1)

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-14 09:19:49 +00:00
Christophe Fergeau
efbc6b2fe2 smartcard: Remove unneeded 'dispose' implementation
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-14 09:19:30 +00:00
Frediano Ziglio
deeb367b1e tests: Enable address sanitizer on GitLab CI
Add required library and options so tests will use the
sanitizer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-13 09:01:22 +00:00
Jonathon Jongsma
b3c96d6ab3 DisplayChannel: start documenting drawable tree
The code that manages pending QXL Drawable operations is fairly complex
and difficult to understand. This is an attempt to start documenting
that code to save time when we have to work on this code in the future.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-09 12:01:35 -06:00
Christophe Fergeau
07b7a1e355 reds-stream: Use true/false instead of TRUE/FALSE
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-09 18:39:57 +01:00
Christophe Fergeau
6377b72d44 Use bool rather than int return values when appropriate
This commit changes all functions returning TRUE/FALSE from having an
'int' return value to 'bool'.
This way it's obvious that such a function is not going to return
anything else than TRUE or FALSE.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-09 18:39:29 +01:00
Christophe Fergeau
972cbdcfd9 Remove stdbool.h include from .c files
It's already included in red-common.h

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-09 18:39:13 +01:00
Frediano Ziglio
4f7fbb3113 red-channel: Move config_socket vfunc to RedChannelClient
config_socket is configuring the client stream socket.
As is responsibility of RedChannelClient to handle the stream
it make more sense to have the function in this object.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-08 16:55:43 +00:00
Frediano Ziglio
312c0aadf0 test-leaks: Checks some leaks using TLS
Verify stuff are freed correctly (like TLS context).
The different PKI file required are generated with
base values (localhost and rsa 1024).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-08 12:21:15 +00:00
Frediano Ziglio
df48918dd0 test-leaks: Test that creating and destroying spicevmc does not leak
Add and remove some vmc device to check for leaking.
These combination assure that currently implemented type
of devices (webdav, usb and generic) are checked.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-08 12:21:09 +00:00
Frediano Ziglio
9bcfba3c68 reds: Change if style
The nested if statements could be confusing, no needs for them.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-03-08 10:49:28 +00:00
Frediano Ziglio
fa36ab45b3 reds: Send link replies with less chunks
Send header and reply together.
This potentially save up to 160 bytes on the network which
is a considerable amount considering that the message is
about 50 bytes.
This as sending multiple chunks you can have different framing,
specifically:
- if you use TLS every chunk get encrypted separately
  (reds-stream, currently usually 29 bytes for every chunks);
- tcp settings and no delay on socket. More likely with fast
  connections or better network cards. The tcp framing is
  usually about 80 bytes;
- additional tcp acknowledge (usually 64 bytes).
So 80 + 29 + 64 = 173 bytes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-07 15:08:34 +00:00
Frediano Ziglio
541d54af42 reds: Do not leak SSL context
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-06 17:01:08 +00:00
Victor Toso
b7d7c66acd syntax-check: Fix missing AUTHORS
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-06 14:26:13 +00:00
Frediano Ziglio
9af182b67a red-channel: Move alloc_recv_buf and release_recv_buf to RedChannelClient
These vfuncs are more appropriate in RedChannelClient.
The buffer they allocated are related to the client stream
which is managed directly by RedChannelClient.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-04 14:58:15 +00:00
Frediano Ziglio
68c3e1f51d Introduce CommonGraphicsChannelClient
This prepare for the next patch.
The network recieve buffer should be per-client rather than per-channel.
The following patch will make this change, but this common base class
will allow the cursor client and the display client to share a common
implementation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-04 14:58:05 +00:00
Frediano Ziglio
62f961624a sound: Remove header dependency
Sound code is not using Qxl interface.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-04 01:06:35 +00:00
Frediano Ziglio
5c0c9c6975 red-channel: Move byte statistic to RedChannelClient
As the counters are shared there is no reason why not
handling the byte count from RedChannelClient directly.
This remove a dependency and avoid some function calls.
The only visible difference at user level is that the
counters are created when a client connects.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-04 01:04:44 +00:00
Frediano Ziglio
256479c53c red-channel-client: Add message counters to statistics
Show messages sent to clients.
This is useful to understand the message number as an high
message number can affects performance and is not easy to
understand the message count from the byte count (which is
available).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-04 01:04:30 +00:00
Frediano Ziglio
a22a76371e tests: Reuse GLib compatibility code
Instead of disabling the code use the compatibility functions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-03 16:49:43 +00:00
Frediano Ziglio
73f8a65d06 tests: Move some specific GLib compatibility to compatibility file
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-03 16:49:41 +00:00
Frediano Ziglio
b7a7ed3900 tests: Move some glib compatibility code to a separate file
Allow to reuse this code in other tests.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-03 16:49:36 +00:00
Frediano Ziglio
cf3a9183a4 Use variable values instead of computing again
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-03 15:32:38 +00:00
Victor Toso
5ba0bc6663 dcc: handle preferred video codec message
[0] SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE

This message provides a list of video codecs based on client's order
of preference.

We duplicate the video codecs array from reds.c and sort it using the
order of codecs as reference.

This message will not change an ongoing streaming but it could change
newly created streams depending the rank value of each video codec
that can be set by spice_server_set_video_codecs()

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-02 17:48:17 +00:00
Frediano Ziglio
0bbfe733b8 record: Allocate recording file globally from reds.c
Allows to use recording function for multiple purposes.
This will allow to register multiple screen VM or recording
additional stuff like sound.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-02 16:14:10 +00:00
Frediano Ziglio
ab6ace6b66 record: Use reference counting for recording
Allows to share the recording object.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-02 15:37:40 +00:00
Frediano Ziglio
e0a5e4f0d0 record: Synchronize write to record file
The synchronization code is required to avoid mixing writing
from multiple threads.
Following patches will add this feature.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-02 15:37:40 +00:00
Frediano Ziglio
afc4171c98 red-channel: Use RedChannelCapabilities directly to pass capabilities
For each channel there are two set of capabilities, one
for the common ones and one for the specific ones.
A single set were almost always passed using 2 arguments,
a number of elements and an array but then before using
these were converted to a GArray.
Use a single structure (already available) to pass all
channel capabilites using a single argument.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-02 15:34:58 +00:00
Frediano Ziglio
89a722ce03 red-channel: Separate RedChannelCapabilities
Add function to initialize and destroy this type.
Add GType type for boxing it.
These changes a in preparation for next patch.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-02 15:32:16 +00:00
Frediano Ziglio
5b3f79f8a7 red-channel-client: Make capabilities property write only
These properties are not read and code is broken (the content of
the array would be uninitialized).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-02 11:55:02 +00:00
Frediano Ziglio
b2d1a38d13 red-channel: Remove unused type definition
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-02 11:51:35 +00:00
Frediano Ziglio
cdd1e69b28 main-dispatcher: Remove watch leak
Watch was added but never removed.
The added basic_event_loop_destroy() addition allows to see that
this leak is gone).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-02 11:15:28 +00:00
Christophe Fergeau
be4ceb4e24 test-vdagent: Make test case more useful
This switches the test to using the GTest API, and add several tests
related to https://bugzilla.redhat.com/show_bug.cgi?id=1411194

This uses some API not available in glib 2.28, so this checks we have a
new enough glib before building this test, and disables warnings when
using too new glib API when building it.

The "multiple-vmc-devices" is based off code written by Frediano Ziglio.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-01 18:02:37 +01:00
Christophe Fergeau
4633ea6d87 Use spice_debug rather than spice_info in library code
Using spice_info() gets in the way of tests using
g_test_expect_message() as all the messages emitted using
a non-debug log level must be listed as expected, otherwise we get a
critical about an expected message not having been logged.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-01 18:01:25 +01:00
Christophe Fergeau
2650867f30 reds: Close sockets when using spice_server_destroy()
Currently, the network sockets opened by reds_init_net() are not closed
on destruction, in other words they are leaked.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-01 18:00:27 +01:00
Christophe Fergeau
c8f8ea2224 test: Add test_destroy()
This allows to chain several test cases by using
test_new()/test_destroy().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-01 18:00:27 +01:00
Frediano Ziglio
f66b7bffc7 tests: Add basic spice_server_init()/spice_server_destroy()
This can be used for very basic leak checks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-01 16:06:57 +00:00
Frediano Ziglio
a6f7aeb5d8 reds: Free remaining configuration
Free security, migration, sasl and name stuff.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-01 16:06:51 +00:00
Frediano Ziglio
67b1513f87 display-channel: Clean more stuff on finalize
Release surfaces, cache and monitor configurations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-02-28 23:10:31 +00:00