Commit Graph

8 Commits

Author SHA1 Message Date
Frediano Ziglio
e788e6e476 Remove conversion warnings
Use casts to avoid all that warning.
They should go away once you use more type safe types.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01: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
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