Commit Graph

448 Commits

Author SHA1 Message Date
Frediano Ziglio
f4632931d5 test-codecs-parsing: Add test case
Check if encoder contains an invalid character.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-03 09:32:13 +01:00
Christophe Fergeau
0d38a122d6 test-agent-msg-filter: Adjust for recent logging changes
Now warnings are printed through g_warning which causes the test to
fail. We need to use g_test_expect_message() to prevent that failure.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-28 14:31:22 +01:00
Frediano Ziglio
27df2afe34 replay: Use GPid and G_PID_FORMAT for portability
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 11:14:19 +01:00
Frediano Ziglio
9663ae6785 Do not use bzero
Not defined in MingW.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-06-25 13:12:04 +01:00
Christophe Fergeau
47ca1f0da0 channel: Remove unused 3rd red_channel_register_client_cbs() arg
It was probably meant to be used as a "user_data" argument for the
various callbacks, but turns out not to be used.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-21 17:54:27 +01:00
Frediano Ziglio
87965d8dea ci: Add some needed Valgrind suppression rule
From Gitlab CI:

=17955== 16 bytes in 1 blocks are possibly lost in loss record 725 of 2,079
==17955==    at 0x4C2DBAB: malloc (vg_replace_malloc.c:299)
==17955==    by 0x4011D17: tls_get_addr_tail.isra.0 (in /usr/lib64/ld-2.27.so)
==17955==    by 0x4017997: __tls_get_addr (in /usr/lib64/ld-2.27.so)
==17955==    by 0xEE4534B: gnutls_rnd (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE1F254: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE1F947: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE231B5: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE24D67: gnutls_handshake (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEBD4FEA: ??? (in /usr/lib64/gio/modules/libgiognutls.so)
==17955==    by 0x7463936: g_task_thread_pool_thread (gtask.c:1331)
==17955==    by 0x7A3E932: g_thread_pool_thread_proxy (gthreadpool.c:307)
==17955==    by 0x7A3DF29: g_thread_proxy (gthread.c:784)
==17955==    by 0x8284563: start_thread (in /usr/lib64/libpthread-2.27.so)
==17955==    by 0x859631E: clone (in /usr/lib64/libc-2.27.so)
==17955==
==17955== 32 bytes in 1 blocks are possibly lost in loss record 1,234 of 2,079
==17955==    at 0x4C2DBAB: malloc (vg_replace_malloc.c:299)
==17955==    by 0x4011D17: tls_get_addr_tail.isra.0 (in /usr/lib64/ld-2.27.so)
==17955==    by 0x4017997: __tls_get_addr (in /usr/lib64/ld-2.27.so)
==17955==    by 0xCAA5173: __cxa_get_globals (in /usr/lib64/libstdc++.so.6.0.25)
==17955==    by 0xCAA6186: __cxa_throw (in /usr/lib64/libstdc++.so.6.0.25)
==17955==    by 0xC601457: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F6BB6: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F7089: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F7470: px_proxy_factory_get_proxies (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC3E64E3: ??? (in /usr/lib64/gio/modules/libgiolibproxy.so)
==17955==    by 0x7463936: g_task_thread_pool_thread (gtask.c:1331)
==17955==    by 0x7A3E932: g_thread_pool_thread_proxy (gthreadpool.c:307)
==17955==    by 0x7A3DF29: g_thread_proxy (gthread.c:784)
==17955==    by 0x8284563: start_thread (in /usr/lib64/libpthread-2.27.so)
==17955==    by 0x859631E: clone (in /usr/lib64/libc-2.27.so)

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-05 15:25:13 +01:00
Frediano Ziglio
337dad1110 ci: Merge new Valgrind suppression rule from official glib.supp
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-05 15:25:07 +01:00
Victor Toso
12c2739b9e tests: add test-listen executable to gitignore
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-19 07:57:04 +01:00
Frediano Ziglio
2a3d562438 test-stream-device: Test we can read empty capabilities
Code can have problems reading empty messages, check we can
handle it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:34:27 +01:00
Frediano Ziglio
262af0a920 stream-device: Handle capabilities
Handle capabilities from guest device.
Send capability to the guest when device is opened.
Currently there's no capabilities set on the message sent.
On the tests we need to discard the capability message before
reading the error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:34:25 +01:00
Lukáš Hrázký
68b6211865 Rename the virtio port for streaming
The name 'com.redhat.stream.0' is too generic and in no way denotes it
belongs to SPICE. It is preferred to have the project's domain in the
name and Red Hat doesn't own the project. Rename it to
org.spice-space.stream.0.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-05 16:46:06 +02:00
Frediano Ziglio
f1b2d09b00 valgrind: Ignore some library leaks
Ignore getaddrinfo and libproxy leaks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-14 10:17:36 +00:00
Frediano Ziglio
f53f9725e1 test-listen: Increase failure timeout
The timeout is too short when the test run under Valgrind

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-14 10:17:34 +00:00
Frediano Ziglio
f91731541a test-listen: Fix some use after free
Do not dereference thread_data after has been freed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-03-13 14:02:59 +00:00
Christophe Fergeau
f4dd0f1aa7 test-listen: Add Unix socket test
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-13 11:41:00 +01:00
Christophe Fergeau
0308530d5e test-listen: Add TLS test
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-13 11:40:58 +01:00
Christophe Fergeau
d1d43223af test-listen: Add event loop helpers
These factor a bit of common code, and more importantly, help with
freeing all event loop related data at the end of each test.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-13 11:40:55 +01:00
Christophe Fergeau
a58d44cec3 test-listen: Add test case for port/address configuration
This test case will be testing the external spice-server API to
configure the address/port it's listening on. For now it sets up a
listening server, spawns a thread which is going to connect to that
port, and check it gets the REDQ magic upon connection. It will be
extended to test for Unix sockets, TLS sockets, ...

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-13 11:40:53 +01:00
Christophe Fergeau
1a230cdac0 tests: basic-event-loop: Silence debug message
There is currently a debug printf which is always shown when a mainloop
event is triggered. This is unlikely to be useful unless one is
debugging the event loop code.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-13 11:40:50 +01:00
Frediano Ziglio
e45e087617 test-stream-device: Check we don't read past data message
Test case for the issue fixed by previous commit.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-06 12:56:43 +00:00
Frediano Ziglio
19d2e2e8b5 stream-device: Implement properly device reset on open/close
Due to the way Qemu handle the device, when an error occurs we must consume
all pending data inside the callback which reads data from the device.
If we don't flush this data, the next time spice-server tries to read from
the device (after the guest closes/reopens it), we'll be getting stale
data. This can happen because we cannot prevent the guest from writing to
the device even after it got in an error state.
This needs to be done within this callback, as QEMU returns 0 if you call
SpiceCharDeviceInterface::read() outside of it. QEMU invokes this callback
through a call to spice_server_char_device_wakeup.
On the test now we must test that we receive an error from the device.
Previously we checked that last part of the data was not read. Now
potentially all data are read, so we need another way to check the device
detected the error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-06 11:21:39 +00:00
Frediano Ziglio
5327d0f559 test-stream-device: Test batched multiple messages
Test all batched (send together) messages are handled correctly
and device is not stuck.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-02-27 10:41:19 +00:00
Frediano Ziglio
c5ad710056 test-stream-device: Better Qemu emulation for data reading
Qemu does not trigger a new data read if we don't read all data in
the buffer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-02-27 10:40:20 +00:00
Frediano Ziglio
c4a0505f6e Avoid some alignment warnings using clang
clang reports may warnings like:

test-display-base.c:252:11: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
    dst = (uint32_t *)bitmap;
          ^~~~~~~~~~~~~~~~~~

Use SPICE_ALIGNED_CAST/SPICE_UNALIGNED_CAST macros in common/mem.h to
mark the cast safe or possibly unsafe.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-01-31 13:35:46 +00:00
Frediano Ziglio
4a0149bb1f tests: Avoid some possible not initialized warning from Clang
Not really possible but clang raise these warnings:

test-sasl.c:555:13: error: variable 'is_ok' is uninitialized when used here [-Werror,-Wuninitialized]
        if (is_ok) {
            ^~~~~
test-sasl.c:553:22: note: initialize the variable 'is_ok' to silence this warning
        uint8_t is_ok;
                     ^
                      = '\0'

test-gst.c:792:18: error: variable 'height' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
    spice_assert(gst_structure_get_int(s, "width", &width) &&
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../spice-common/common/log.h:91:17: note: expanded from macro 'spice_assert'
    if G_LIKELY(x) { } else {                           \
                ^
/usr/include/glib-2.0/glib/gmacros.h:376:60: note: expanded from macro 'G_LIKELY'
                                                           ^~~~
/usr/include/glib-2.0/glib/gmacros.h:370:8: note: expanded from macro '_G_BOOLEAN_EXPR'
   if (expr)                                    \
       ^~~~
test-gst.c:799:17: note: uninitialized use occurs here
    bitmap->y = height;
                ^~~~~~
test-gst.c:792:18: note: remove the '&&' if its condition is always true
    spice_assert(gst_structure_get_int(s, "width", &width) &&
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../spice-common/common/log.h:91:17: note: expanded from macro 'spice_assert'
    if G_LIKELY(x) { } else {                           \
                ^
/usr/include/glib-2.0/glib/gmacros.h:376:60: note: expanded from macro 'G_LIKELY'
                                                           ^
/usr/include/glib-2.0/glib/gmacros.h:370:8: note: expanded from macro '_G_BOOLEAN_EXPR'
   if (expr)                                    \
       ^
test-gst.c:791:23: note: initialize the variable 'height' to silence this warning
    gint width, height;
                      ^
                       = 0

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-01-31 13:31:40 +00:00
Frediano Ziglio
a5b26585a1 replay: Do not use obsolete set_mm_time callback
Marked as obsolete with clang and some options is detected as
error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-01-31 13:31:40 +00:00
Frediano Ziglio
8d79d8887d tests: Remove test-just-sockets-no-ssl
This call sequence is included in test-display-base used in different
tests, no reason to have this test.
Also this test is not actually used for automated tests.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-16 16:32:21 +00:00
Frediano Ziglio
3625f3cfd1 basic-event-loop: Document why code does not use default GLib context
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-16 12:40:35 +00:00
Frediano Ziglio
7a25e46c8b Minor compatibility with FreeBSD system
Some additional header are needed to avoid undefined types.
SOL_TCP and IPPROTO_TCP have the same value in Linux but SOL_TCP
is not defined in FreeBSD.
Provide pthread_setname_np using pthread_set_name_np (same parameters).

Patch is based on a patch from Oleg Ginzburg <olevole@olevole.ru>

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-15 16:52:57 +00:00
Frediano Ziglio
55e4211456 test-display-base: Do not use obsolete set_mm_time callback
Marked as obsolete with clang and some options is detected as
error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-01-10 15:50:24 +00:00
Frediano Ziglio
6543bef0cb test-sasl: Test how to server reports the failure
The server on failure can just disconnect the client or report the
error. The error report can be done using new protocol 2 or just
a number (like protocol 1).
Detect the failure report to make possible to check it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:06:02 +00:00
Frediano Ziglio
0e533dfec5 test-sasl: Add tests for different failures and cases
Use some flags to specify which behaviour to change and different test
cases to test them.
Some cases specify when client stop sending data at different steps of
the process.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:06:00 +00:00
Frediano Ziglio
9881702df2 test-sasl: Add tests for different mechanism names
Try different connections with different tricky names.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:05:58 +00:00
Frediano Ziglio
cbc082ba06 test-sasl: Base test, connect using SASL
Create a thread that emulates a client and starts SASL authentication

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:05:56 +00:00
Frediano Ziglio
9aa2605611 test-sasl: Add code to mocking functions to test state
Check some functions are called in a given sequence.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:05:54 +00:00
Frediano Ziglio
aeb8bbe5ac test-sasl: Initial SASL test
Not currently working, is defining SASL functions used by the code.
As the symbols defined in the objects have more priority than the ones
defined by the libraries these function take precedence compared to
system library.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 17:05:49 +00:00
Frediano Ziglio
e26cbdb175 tests: Avoid cast from integer of wrong size
These cast causes warnings if a 32 bit target is used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 16:50:32 +00:00
Frediano Ziglio
ddf3b836bb test-channel: Use correct endianness for ack message
Network fields should be encoded as little endian.
This was discovered using an emulated MIPS machine.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-09 16:50:32 +00:00
Victor Toso
07c7e236fc clang: remove double promotion
> test-display-resolution-changes.c:55:60: error: implicit conversion
> increases floating-point precision: 'float' to 'double'
>       command->create_primary.width = 800 + sin((float)count / 6) * 200;
>                                             ~~~ ~~~~~~~~~~~~~^~~
> test-display-resolution-changes.c:56:61: error: implicit conversion
> increases floating-point precision: 'float' to 'double'
>       command->create_primary.height = 600 + cos((float)count / 6) * 200;
>                                              ~~~ ~~~~~~~~~~~~~^~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-01-08 10:20:30 +00:00
Frediano Ziglio
fc1005718f build-sys: Ignore generated test-channel and test-stream-device files
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-12-17 17:33:07 +00:00
Frediano Ziglio
7cbc80ed04 build-sys: Remove useless definition
The default LDADD already include libserver.la.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-12 06:59:25 +00:00
Uri Lublin
ee87a36e95 test-stream: initialize msg.msg_flags
Coverity complains the field is not initialized.
That's true but man recvmsg specifies that this
field is set by recvmsg.

To make coverity happy, initialize this field.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-11 10:16:11 +00:00
Christophe Fergeau
1170282cec build: Use $(srcdir) when it makes sense
There are a few places which use $(top_srcdir) when $(srcdir) would be
equally valid.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 14:30:51 +01:00
Frediano Ziglio
7569ff3cc8 test-vdagent: Remove useless MIN definition
Already defined by GLib headers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Maybe this check should just be removed?
2017-12-05 10:54:09 +00:00
Frediano Ziglio
ddf7b366b1 Use verify instead of G_STATIC_ASSERT
verify guarantee that the condition is always a compile
time constant.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:49:46 +00:00
Frediano Ziglio
8e276278e5 tests: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:31:52 +00:00
Frediano Ziglio
137d9ec8e9 test-stream-device: Check incomplete reads of StreamMsgFormat
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-11-27 21:38:02 +00:00
Frediano Ziglio
d61fce91ee inputs-channels: Remove leak using tablet device
Current code does not free allocated tablet resources.
When a tablet is added some resources are allocated.
Resources should be released either removing the tablet or
freeing spice server object.
Added a test to check these conditions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-11-22 16:44:09 +00:00
Frediano Ziglio
d57b61a584 tests: Add a test for streaming devices
Currently create device, open it and pass some messages checking
they are handled.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-11-21 10:02:50 +00:00
Frediano Ziglio
de5b166b71 Remove common/mem.h includes
common/mem.h contains mainly memory allocation functions.
As we decided to move to Glib calls directly avoid to include
function declaration we should not use anymore.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-11-21 08:27:09 +00:00
Jonathon Jongsma
a5aa2a2261 Use standard "Red" namespace
The objects RedsStream and RedsSASL are currently using the namespace
"Reds" rather than the standard "Red" namespace used throughout the rest
of the project. Change these to be consistent. This also means changing
method names and some related enumeration types.

The files were also renamed to reflect the change:
  reds-stream.[ch] -> red-stream.[ch]

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-10-21 08:47:02 +01:00
Frediano Ziglio
e16d7788db tests: Check leaks registering migration interface
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-13 17:10:59 +01:00
Christophe Fergeau
67484cd98b tests: Automatically determine free port to use
Currently, the port used by most tests is hardcoded to 5912. However,
the test suite can be run in parallel, so if 2 tests run in parallel,
the 2nd one is not going to be able to bind to port 5912 and will fail.

After this commit, test_new() will try to find a free port between 5912
and 5922 and will abort if it can't find any.

The issue can be reproduced by adding a usleep(1000000) to the beginning
of test_destroy().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-21 17:32:23 +02:00
Frediano Ziglio
1de104acfe tests: Add a test to check tight loop during ack waiting
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-19 10:50:39 +01:00
Frediano Ziglio
328a4a9b28 tests: Rename stat-main.c to test-stat.c
All main test module have this test-XXXX.c naming, make
test-stat coherent.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18 13:50:26 +01:00
Frediano Ziglio
c64fe795c9 tests: Separate Makefile.am in sections
Put non-trivial programs in separate sections, which makes it easier to
understand the relationship between macros.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18 13:49:40 +01:00
Frediano Ziglio
ddec15dea9 tests: Ignore test output results
New automake test harness produce *.log and *.trs files for
each test.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18 13:15:57 +01:00
Frediano Ziglio
3dc6bc76f1 tests: Avoid to disable all deprecation warnings just for expect functions
In case GLib don't provide these functions we use replacements so
there's no need to have a warning if these functions are called.
This potentially capture other compatibility issues in the tests
that would be ignored having all deprecation warnings disabled.
Tested with GLib 2.28 and 2.52.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12 14:17:53 +01:00
Frediano Ziglio
14828bfdfc test-gst: Free pipelines
Pipelines are never freed.
These are detected as leaks by leak detector tools like address sanitizer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12 13:08:10 +01:00
Frediano Ziglio
9bb2388f75 test-gst: Remove options parsing leaks
Command line options are not freed at the end of the program.
These are detected as leaks by leak detector tools like address sanitizer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12 13:08:10 +01:00
Frediano Ziglio
f35843ee6f test-gst: Remove useless check
encoder_name is never NULL as already initialized with "mjpeg" value.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12 13:07:51 +01:00
Frediano Ziglio
8856d518ee tests: Check leaks in spice_server_add_ssl_client
Currently is possible to trigger a leak by passing an invalid
connection.
This can happen if the client opens a connection and then closes it
without writing or reading any data.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12 11:58:01 +01:00
Frediano Ziglio
e595b18282 tests: Make test-two-servers work
This test runs 2 spice server in one program.
Use two different tcp port to be able to connect to both servers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
8f872043b3 tests: Make test-empty-success automated
Add some check that something happened during creation/destruction.
Set as running on "make check".

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
0905a95d3a tests: Make test-fail-on-null-core-interface an automated test
Update to Glib style to catch warning.
Initialize properly the structure (invalid) provided.
Check results of spice_server_init.
Remove leaks.
Enable as check.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
544f5d7ed3 tests: Update README
Update tests names.
Remove tetris comments, never available and not planned.
Update some notes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
6517ea5cbb test-display-base: Always compile with AUTOMATED_TESTS enabled
There's no need to not compile this feature, it just enable
a parameters which must be passed in order to change test
behaviour.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
06380a737b tests: Allow to quit the message loop
This allows to end the loop to end some tests.
Currently different tests enter the loop but never exit from
them.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
eb70454de3 test-display-base: Do not assume LP64 architecture on 64 bit
In C the sizeof(long) can be different than sizeof(void*),
use proper type.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
6745d048c5 test-display-base: Use spice allocation helpers
Do not use calloc and malloc directly without checking
the result. Use instead spice functions to get a nice
error in case of allocation failures.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
416c58c348 test-display-base: Avoid cursor move command leaks
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
230dcf82c3 test-display-base: Avoid global buffer overflow
For some reasons (documented in cursor_init) the function
uses 128 extra bytes of data causing a reading buffer overflow.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
8bf7c7803d test-display-base: Protect the wake up timer start with a mutex
Timers in spice server are supposed to be used in a single thread
context. To avoid problems, protect the usage from multiple
thread with a mutex.
This sometimes caused a crash.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
6daf2d115b test-display-base: Avoid usage after free when the wakeup timer is freed
The wakeup timer is used by the worker thread and by the
main thread.
Destroying the object before destroying the worker thread
can lead to use after free.
Destroying the worker thread first makes sure we don't race.
This is detected easily when compiling the test with address sanitizer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:18 +01:00
Frediano Ziglio
574574e425 test-display-base: Protect command ring with a mutex
The ring is accessed by multiple thread.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 08:54:14 +01:00
Frediano Ziglio
f73fbdcae5 test-display-base: Use unsigned numbers for command ring indexes
As the indexes are used to compute the index inside an array
using modulo operation when a signed value overflows, the
modulo becames negative, causing a buffer underflow.
Unlikely to happens (take lot of time) but is safer that way.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-07 06:44:58 +01:00
Jonathon Jongsma
407ad2d63f tests: destroy test object
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-02 08:07:38 +01:00
Frediano Ziglio
de88e4d6b2 tests: Make variables static where possible
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-02 08:02:36 +01:00
Frediano Ziglio
55bb4f2395 tests: Remove unused declarations
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-02 08:02:36 +01:00
Frediano Ziglio
581b289825 tests: Avoid leaking list of commands
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-02 08:02:36 +01:00
Frediano Ziglio
69356fabcb tests: Pass command list as constant
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-02 08:02:36 +01:00
Frediano Ziglio
ea58b27aff tests: Reuse G_N_ELEMENTS instead of COUNT
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-02 08:02:36 +01:00
Michal Privoznik
7254169f7f tests: Initialize all members of SpiceBaseInterface struct
When compiling, -Werror=missing-field-initializers is enabled.
However, some gcc versions (like Gentoo 4.9.4 one) fail to see
that all the members of the SpiceBaseInterface struct are
initialized:

test-display-base.c:844:5: error: missing initializer for field
'description' of 'SpiceBaseInterface'
[-Werror=missing-field-initializers] .base.description   = "test
spice virtual channel char device",

The solution is to initialize .base member as a structure at once
instead of multiple times per each member.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-06-23 10:09:50 +01:00
Frediano Ziglio
ba9656757e red-parse-qxl: s/true/false
Reverse return values of the various bool methods so that 'true' means
success, and 'false' failure rather than the opposite.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-02 11:30:47 +02:00
Frediano Ziglio
dfe9fe9ebe test: Add vp9 support to GStreamer test
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-07 16:45:54 +01:00
Frediano Ziglio
5d046d9b2d red-channel: Initialize statistic node correctly
Doing a memset(0) on a SpiceStatNode does not create an empty/unattached
node, but instead creates a node '0'. This node could be non-existing,
or totally unrelated.
This patch creates a default '0' node as soon as the file is created.
This will make the behaviour of 0-filled nodes more in line with what
one would expect.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-31 11:02:02 +01:00
Frediano Ziglio
7d86223e21 Fix minor incompatibilities with RHEL6
Include missing pthread header.
Avoid undeclared functions in test-glib-compat.c including
proper/correct header.
Define missing g_assert_true and g_assert_false.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-30 10:50:09 +01:00
Frediano Ziglio
3c78882884 test-leaks: Document test program
This test needs some additional setup to do its job.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-24 11:58:16 +00:00
Frediano Ziglio
76b7f943e4 Some automatic check on video encoders
Stress a bit video encoders.
This check different combination of
- encoder type;
- image formats;
- image clipping (encoding partial frames);
- handling frames split into chunks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-03-23 12:52:58 +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
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
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
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
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
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
Christophe Fergeau
f5494cfa9b test-playback: Pass proper types to spice_server_add_interface
This is a revert of b76e561d.
For a SpicePlaybackInstance, the base interface must be a
SpicePlaybackInterface instance, not a SpiceBaseInterface instance, or
spice-server code will end up reading out of bounds.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-02-15 12:13:55 +01:00
Christophe Fergeau
1afa86c3ee test-display-base: Pass proper types to spice_server_add_interface
This is a revert of 93b4f4050^ and 93b4f4050.
For a SpiceCharDeviceInstance, the base interface must be a
SpiceCharDeviceInterface instance, not a SpiceBaseInterface instance, or
spice-server code will end up reading out of bounds.

vmc_state/vmc_write/vmc_read implementations also have to be provided.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-02-15 12:13:55 +01:00
Christophe Fergeau
14b2f053ab test-vdagent: Pass proper types to spice_server_add_interface
This is a revert of 93b4f4050^ and 93b4f4050.
For a SpiceCharDeviceInstance, the base interface must be a
SpiceCharDeviceInterface instance, not a SpiceBaseInterface instance, or
spice-server code will end up reading out of bounds.

vmc_state/vmc_write/vmc_read implementations also have to be provided.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-02-15 12:13:55 +01:00
Frediano Ziglio
a44a735cda replay: Support TLS in replay utility
Allows to test encrypted connections.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-02-06 10:06:09 +00:00
Snir Sheriber
1004748c46 autotools: compile gst-test only if gstreamer is available
Needed in order to avoid compilation error when gstreamer is
unavailable
2017-02-03 09:08:55 +01:00
Jeremy White
35177a6c41 Avoid a 'missing braces around initializer' warning.
Static variables don't need initializers to be 0.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-01-25 15:41:04 +00:00
Frediano Ziglio
19a900f396 tests: Make possible to have a report of the video encoding
This allows to do some possible statistics or graph.
Currently the report contains encoded sizes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-01-21 09:05:42 +00:00
Frediano Ziglio
345d7bde23 Compatibility for GStreamer 0.10 for test utility
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-01-21 09:04:50 +00:00
Frediano Ziglio
623e7d4a93 Add an helper to test VideoEncoder
Add an utility to make possible to check various features of
VideoEncoder.
2 GStreamer plugins are used in a chain like this:
  (1) input pipeline -> (2) video encoder -> (3) output pipeline
While converting output from (1) is compared with output of (3)
making sure the streaming is working correctly.
You can set various options:
- part of the input pipeline description to allow specifying different
  video from GStreamer test ones to a video file;
- the encoder to use;
- different image properties to use for (2) input:
  - different bit depth;
  - top/down or down/up;
- initial bitrate.

The idea is to use this helper in combination with a shell script
and some video sources to make able to test various settings.
Also can be used to extend the current encoder list.

As an example you can use a command like

$ ./test-gst -e gstreamer:vp8 -i \
  'filesrc location=bbb_sunflower_1080p_30fps_normal.mp4 \
  ! decodebin ! videoconvert'

to check vp8 encoding.

Currently it does not emulate bandwidth changes as stream reports
from the client are not coded.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-01-10 13:42:25 +00:00
Snir Sheriber
af390d53ca tests: Fix compilation error
Fix compilation error due to -Werror=maybe-uninitialized:

  CC       test-display-base.o
test-display-base.c: In function 'do_wakeup':
test-display-base.c:579:13: error: 'update' may be used uninitialized...
             push_command(&update->ext);

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-01-04 16:09:50 +00:00
Victor Toso
aebc51f91a reds: don't replace video_codecs on failure
We should replace the video_codecs GArray only after the parsing of
input is done, otherwise we might lose previous configuration.

Tests were updated to match this situation. Input that fails to
replace video_codecs are considered bad.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-12-15 11:13:36 +00:00
Victor Toso
8faf7a6f45 Fix gitignore
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-12-08 15:18:25 +01:00
Frediano Ziglio
030ae7bbdc 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>
2016-12-06 16:16:19 +00:00
Frediano Ziglio
97f631471b build: Remove not existing include directory
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-12-06 13:07:27 +00:00
Frediano Ziglio
4f301ea0e4 Free replay queues
There could be still some data pending.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-12-05 23:27:35 +00:00
Frediano Ziglio
0c8b059fac replay: Free spice server to detect leaks
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-12-05 23:27:35 +00:00
Pavel Grunt
b53c0d368b test: Ignore too new warnings
There is an explicit check for the version

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-12-05 12:32:28 +00:00
Frediano Ziglio
47f56a72e0 Free statistic file on spice_server_destroy
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-30 12:36:47 +00:00
Frediano Ziglio
f275733de3 Add a red_memslot_info_destroy function
Allows to free RedMemSlotInfo structure

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-25 14:36:40 +00:00
Frediano Ziglio
e05cf93a01 tests: Normalize test names
Use dash instead of underscores for file names. This is coherent
with rest of file names.
Rename all tests to test-XXX and remove the spice- prefix when
present. This is coherent with most of the tests.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-25 13:52:39 +00:00
Pavel Grunt
39b6b65421 Do not crash on NULL codecs
Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-17 11:13:04 +00:00
Pavel Grunt
5c311ea8a1 Add test for codecs parsing
With Glib2.34 test invalid codec strings

Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-17 11:12:21 +00:00
Frediano Ziglio
973cbb4df2 Revert "replay: Replicate wakeups properly"
This reverts commit c6881ad1a0.

This patch cause the replay utility run at full speed
to slow down a lot and in some cases getting stuck.
I don't understand the reason and when I tested was working
but as we are going to release would be a pity if this test utility
won't work as useful to get feedback and reports.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-17 11:03:51 +00:00
Frediano Ziglio
002c7c9eeb Make RedStatFile private inside stat-file.c
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:32 +00:00
Frediano Ziglio
5209d33977 Add a base test for statistic file
Create a file and add/remove some nodes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:24 +00:00
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
5902960d39 Make red-replay-qxl.h a public header
The functions declared in that header are all exported by the
library.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:37:15 +00:00
Frediano Ziglio
c6881ad1a0 replay: Replicate wakeups properly
Instead of waking up the command loop for every command queued,
handle saved wakeups and replicate these.
This better reproduces what happened in the server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:32:58 +00:00
Pavel Grunt
2051007e05 spice-options-test: Convert to gtest to catch criticals
Fail on glib warnings instead of ignoring them

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-07 17:18:45 +00:00
Christophe Fergeau
c7f492b75c syntax-check: Add missing license headers
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:48:26 +00:00
Christophe Fergeau
c979647a77 syntax-check: Remove unused header includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:48:20 +00:00
Christophe Fergeau
9c21b474c0 syntax-check: Add missing <config.h> includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:47:14 +00:00
Frediano Ziglio
b0d8ba9a6a Allows to use scripts for "make check"
Allow both compiled and non-compiled tests to be used with "make
check". Compiled tests should be added to check_PROGRAMS, and scripts
that do not need to be built should be added to TESTS.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:45:12 +01:00
Pavel Grunt
ddf028569e Test agent message filter processing
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:49:15 +01:00
Pavel Grunt
dee20d8b43 Add agent message filter test
Test filter initialization and configuration

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:48:54 +01:00
Frediano Ziglio
b74fe03f00 Capitalize option documentation
All other options are documented using initial capital case letter.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-09-22 09:37:18 +01:00
Pavel Grunt
1796160095 tests: Check setting of agent properties
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-07 14:18:50 +02: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
Pavel Grunt
ce6113d838 replay: Add an option to change video codec 2016-06-14 17:04:40 +02:00
Frediano Ziglio
2b58c60bb1 replay: Handle cursor commands
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-07 22:43:30 +01:00
Frediano Ziglio
1be06f188e make spice-server-replay use dynamic spice-server library
spice-server-replay is built with the same settings as tests.
Currently the tests links to a convenience spice-server library.
A convenience library is a static library build with object file
for a dynamic library.
This make all tests contain all spice-server library code and not
linking to the spice-server dynamic library (the .so).
It's not a problem for most tests however this make impossible for
spice-server-replay utility to be used with a dynamic spice-server
library (you have to recompile it including the library).
This is a pity as you could for instance compare your system
library behavior with the library you are developing.
Also if we decide to install in a future the utility for testing
we would have lot of code duplication.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-18 14:57:06 +01:00
Frediano Ziglio
fa0c32f120 remove a warning building a test
With my compile switches (which are mostly derived from RedHat spec
file) I'm getting this warning:

stream-test.c: In function 'sock_fd_read':
stream-test.c:66:43: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
             *fd = *((int *) CMSG_DATA(cmsg));
                                           ^

memcpy could decrease performance but as this is a test it's not
an issue.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-18 14:52:10 +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
Uri Lublin
2480eb6979 replay: skip the first N (slow) commands
Note that the commands are executed by spice-server.
The "skip" is only done on the "sleep" part of the
"slow" command-line option.

This is helpful to run quickly through uninsteresting commands
in a beginning of a recorded file and going slowly when
interesting parts appear

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:09:07 +00:00
Uri Lublin
07cb94d7ab replay: count commands
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:08:48 +00:00
Uri Lublin
d82b8b0789 replay: do not use argv after g_option_context_parse
Apparently, after using g_option_context_parse with G_OPTION_REMAINING
argv is modified and should not be used.
This patch uses "file" instead of "argv" and makes sure
file is freed later.
No free is called upon error - exit takes care of it.
2016-03-03 11:57:44 +00:00
Michal Privoznik
2306c364d2 Update .gitignore files
The first part updates the .gitignore file in the root directory
because the file is obviously generated by automake but poison
our working tree.
The second part updates the .gitignore under server/tests/
directory because since 0db1137d we have a noinst test library
libtest.a. However, like in previous case, git should never track
this file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-25 09:12:51 +00:00
Jonathon Jongsma
1438b7ccf2 Add GObject to build requirements
Preparation for GObject-ifying some internals

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16 11:22:04 +00:00
Jonathon Jongsma
de2572815b Add RedsState reference to RedsStream
Allows us to remove use of global 'reds' variable from reds-stream.c.
Requires changing the RedsStream constructor to accept a RedsState arg.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:45:46 +00:00
Frediano Ziglio
6e43433ec2 tests: add a new case for event loop timers
Check that cancelling a timer the timer callback is not called.

This can happen in latency code (red-channel.c).
In red_channel_client_cancel_ping_timer latency timer is cancelled and
state is set to PING_STATE_NONE however if timer was already active what
happens is that the red_channel_client_ping_timer is called and the line

  spice_assert(rcc->latency_monitor.state == PING_STATE_TIMER);

is triggered causing spice-server to abort.
This happens as GLib loop add all active sources to an array but if the
timer is deactivated before the event is dispatched the event will be
dispatched unless the source is destroyed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-02-12 17:44:47 +00:00
Marc-Andre Lureau
df7ba60503 tests: link test-qxl-parsing with libserver
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-03 17:33:15 +00:00
Frediano Ziglio
77adbb7574 replay: remove a message that could be caused by a race condition
The req_cmd_notification callback is called by spice-server when it
has processed all commands and wants to be notified (by a wakeup) that
new commands have been appended to the command queue.
Replay utility tries to fill the commands when it detects that
spice-server is trying to read commands but there are no more commands.
However, new commands are appended in a separate thread so if the main
red worker loop on spice-server is really tight this request can
happen.
Avoid printing any message on this condition, message will be appended
and loop woken up when replay code can do it.

Signed-by: Frediano Ziglio <figlio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-03 16:03:17 +00:00
Marc-Andre Lureau
15c908ef25 tests: make sure that the default rule builds all tests
The default rule being "all", it builds noinst_PROGRAMS but not
check_PROGRAMS. Let's build all the tests by default.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 11:36:10 +00:00
Frediano Ziglio
1ad571f576 replay: do not wake up loop too much
Send wakeups only when a command is available.
This emulate better what a guest driver should do (append the command
to the ring and then signal).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-26 12:46:32 +00:00
Jonathon Jongsma
77ae19c0c6 Replay: report error if we don't read the correct file header
The replay file should start with a header such as
  SPICE_REPLAY 1

Instead of soldiering on if we don't encounter this header, print a
warning and return NULL.  Also exit with a failure if spice_replay_new()
returns a NULL object in main.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-22 11:03:30 +00: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
a5a0d4a290 tests: test removed triggered timers are not called
This could happen for instance if a given timer remove all clients
which have associated timers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-19 23:57:01 +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
Frediano Ziglio
28c3585730 tests: remove leaks in test-qxl-parsing
This make happy address sanitizer during make check.
Otherwise memory leak detector can keep in and make tests fails.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-19 14:03:43 +00:00
Frediano Ziglio
e433a6634c replay: better documentation for -C and -S options
Document all possible values

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-15 15:42:19 +00:00
Frediano Ziglio
d80189b5ed replay: add streaming setting option
Add -S to allow to set a video streaming rule.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-15 15:04:52 +00:00
Marc-Andre Lureau
47df90a8ce stream-test: add batch test
Check that two consecutive msgfd are read back from two different reads.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-15 11:04:30 +00:00
Marc-Andre Lureau
0db1137dac build-sys: build a noinst libtest.a to link to
Group the test utility in a library, to avoid repeating the same
sources. In this case, automake already figues out what the source of
the programs to build is.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-15 09:58:54 +00:00
Frediano Ziglio
58c5713aa9 replay: remove command line memory leaks
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-15 08:58:12 +00:00
Marc-Andre Lureau
f438bd6ae9 tests: add fdpass stream test
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-14 11:04:49 +00:00
Frediano Ziglio
adc0751950 channel: add a new internal SpiceCoreInterface
Define an internal structure that matches 100% the ABI of the public one.
The structure will be changed by following patches.
See comments in "channel: add interface parameters to
SpiceCoreInterfaceInternal" patch.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-11 16:29:53 +00:00
Frediano Ziglio
d3b5d2c97e add some tests for cursors parsing
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-08 18:16:47 +00:00
Frediano Ziglio
6ea345b820 add test for QXL parsing functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-08 18:16:47 +00:00
Eduardo Lima (Etrunko)
8c6dcc5eaf server: Fix tests Makefile
As reported in https://bugs.freedesktop.org/show_bug.cgi?id=93520, the
build from git is failing in Archlinux systems with undefined
references to glib symbols.

This patch fixes the problem by simply reordering the order libraries
will be linked. Also, removes duplicate $(GLIB_LIBS) variable.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-08 12:23:54 +00:00
Pavel Grunt
952aaca3d7 syntax-check: Remove empty line at EOF
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-08 11:24:14 +00:00
Frediano Ziglio
cc5fa8fa9b replay: better help for -s option
-s accepts an option to delay command queueing.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <mlureau@redhat.com>
2015-12-22 16:45:48 +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
b953a4e35f tests: reuse Makefile macro
For coherency use COMMON_BASE macro instead of including single
files.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2015-12-15 17:39:49 +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
Frediano Ziglio
c4c716ab18 stat: add test for statistic functions
Make sure code compile with and without statistics enabled (beside
printing functions).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-09 17:02:54 +00:00
Francois Gouget
9b42aafe31 server: Rename SUPPORT_AUTOMATED_TESTS to HAVE_AUTOMATED_TESTS
This improves consistency with spice-deps.m4 which names its
AM_CONDITIONAL() variables HAVE_XXX.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-12-08 15:39:11 +01:00
Alon Levy
aef334e6e8 tests: test_display_base: use a faster wakeup time to easily test multiple client blocking
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-04 11:46:27 +00:00
Frediano Ziglio
525cd67be7 server: rename files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:54:32 +00:00
Christophe Fergeau
e5e3e9eefe Add missing license headers 2015-10-19 14:25:36 +02:00
Christophe Fergeau
c61a37603a syntax-check: Remove unused #include <strings.h> 2015-10-19 14:25:36 +02:00
Christophe Fergeau
c0b2b1fc49 syntax-check: Add missing #include <config.h> 2015-10-19 14:25:36 +02:00
Jeremy White
df0eab862c Update the .gitignore files for the new manual,
for a few newly generated tests, and for the spice-server.h.
2015-10-16 15:48:23 -05:00
Christophe Fergeau
5eaf659aa3 tests: Fix -Werror=format-zero-length build failure
replay.c: In function 'replay_channel_event':
replay.c:226:16: error: zero-length gnu_printf format string
[-Werror=format-zero-length]
     g_printerr("");
2015-09-29 18:59:54 +01:00
Frediano Ziglio
2a09a5fa36 replay: compatibility with former version
GMutex usage in replay.c was not working so replace with plain pthread.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-09-01 17:17:21 +01: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
Christophe Fergeau
09394e857f build-sys: Remove test_spice_version.h
This script was used at make distcheck time to verify consistency of the
version number defined in configure.ac and in spice-server headers.
Since commit ab12cf414c, these 2 version numbers can no longer be out of
sync, so we can drop this script.
2015-08-26 11:01:09 +02:00
Alon Levy
622cb433a8 server/tests/spice-server-replay: introduce
usage: spice-server-replay -p <port> -c <client command line> <cmdfile>

will run the commands from cmdfile ignoring timestamps, right after a
connection is established from the client, and will SIGINT the client
on end of cmdfile, and exit itself after waiting for the client.

spicy-stats from spice-gtk is useful for testing, it prints the summary
of the traffic on each channel.

You can also run with no client by doing:
spice-server-replay <cmdfile>

For example, the 300 MB file (compressed to 4 MB with xz -9) available
at [1] produces the following output:

spicy-stats total bytes read:
total bytes read:
inputs: 214
display: 1968983
cursor: 390
main: 256373

You could run it directly like so:
curl http://annarchy.freedesktop.org/~alon/win7_boot_shutdown.cmd.xz | \
  xzcat | server/tests/spice-server-replay -p 12345 -c `which spicy-stats` -

Known Problems:
* Implementation is wrong. Should do a single device->host conversion
 (i.e. get_virt), and then marshall/demarshall that (i.e. RedDrawable).
* segfault on file read done resulting in the above spicy-stats not
 being reproducable (well, up to 1% yes).

[1] http://annarchy.freedesktop.org/~alon/win7_boot_shutdown.cmd.xz

Now based on glib including using an asyncqueue for reading the playback
file, and proper freeing of the allocated commands, with --slow,
--compression and a progress timer, and doesn't use more then nsurfaces.

Signed-off-by: Alon Levy <alon@pobox.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2015-08-22 12:36:37 +01:00
Marc-André Lureau
f3179ef791 tests: use glib main loop 2015-08-20 17:47:24 +01:00
Christophe Fergeau
5acc017638 build-sys: Remove spice-protocol submodule
It's seeing regular releases and is API stable, so we don't need to
bundle it with spice-server
2015-08-20 12:30:55 +01:00
Christophe Fergeau
de66161c6e Adjust to new SpiceImageCompress name
This has been renamed to SpiceImageCompression in order to avoid clashes
with older spice-server in the SPICE_IMAGE_COMPRESS_ namespace. This
commit is a straight rename of SpiceImageCompress to
SpiceImageCompression and SPICE_IMAGE_COMPRESS_ to
SPICE_IMAGE_COMPRESSION_
2015-07-29 17:40:48 +02:00
Jeremy White
04d9d79013 Add libraries such as -lm and -lpthread to the tests build line.
This prevents a compile error on Debian Jessie, from git, such as this:
/usr/bin/ld: test_playback.o: undefined reference to symbol 'sin@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line

This is fairly subtle, and Debian specific.  It only happens when you use
autoreconf to generate a new libtool script.  Debian patches that script
to require an explicit setting to link with all dependent libraries.

It should be harmless on other distros, and it does save us Debian guys some
hassle.
2015-07-28 10:12:46 -05:00
Fabiano Fidêncio
423fbe9fcd tests: Fix build on Hurd
As PATH_MAX is not defined on Hurd, let's check for it and define
whenever it is necessary.

https://bugs.freedesktop.org/show_bug.cgi?id=74313
2015-02-24 15:39:24 +01:00
Marc-André Lureau
6a49d59e7e build-sys: fix out-of-tree build of tests
Fixes the following build error:
In file included from
/home/elmarco/src/spice-new/src/spice/server/tests/test_display_base.h:4:0,
                 from
                 /home/elmarco/src/spice-new/src/spice/server/tests/test_display_no_ssl.c:11:
                 /home/elmarco/src/spice-new/src/spice/server/spice.h:23:27:
                 fatal error: spice-version.h: No such file or directory
                  #include "spice-version.h"
                                             ^
2014-11-29 15:32:44 +01:00
Christophe Fergeau
504d027bb2 server/tests/Makefile.am: White-space cleanup
Make sure the \ at the end of lines are nicely aligned
2014-09-18 14:06:55 +02:00