[Spice-devel] [cacard v2] tests: Fix 'simpletlv' on i686 arches

Christophe Fergeau cfergeau at redhat.com
Tue Aug 14 12:59:39 UTC 2018


Sorry, this one is missing at least one hunk, will send a v3.

Christophe

On Tue, Aug 14, 2018 at 02:40:58PM +0200, Christophe Fergeau wrote:
> The simpletlv_* functions return lengths as an int, but the test is
> casting it to a size_t before comparing it against -1. This is not
> giving the expected result on i686, causing the test to fail. The
> variables used in the test do not need to be size_t, and can be changed
> to int to match the return value and avoid the failure.
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  tests/simpletlv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/simpletlv.c b/tests/simpletlv.c
> index cd0cd69..3e5958e 100644
> --- a/tests/simpletlv.c
> +++ b/tests/simpletlv.c
> @@ -48,7 +48,7 @@ static void test_length_simple(void)
>  
>  static void test_length_nested(void)
>  {
> -    size_t length = 0;
> +    int length = 0;
>      unsigned char simple_value[] = "\x12\x14";
>      static struct simpletlv_member simple[1] = {
>        {0x25, 2, {/*.value = simple_value*/}, SIMPLETLV_TYPE_LEAF}
> @@ -102,7 +102,7 @@ static void test_length_skipped(void)
>  static void test_encode_simple(void)
>  {
>      unsigned char *result = NULL;
> -    size_t result_len = 0;
> +    int result_len = 0;
>      unsigned char simple_value[] = "\x10\x11";
>      unsigned char simple_encoded[] = "\x25\x02\x10\x11";
>      unsigned char long_value[256] = "Long data value";
> -- 
> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180814/71f22ac3/attachment.sig>


More information about the Spice-devel mailing list