[libvirt] [PATCH] tests: Fix message for IP parse/format failures

Roman Bolshakov posted 1 patch 9 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190808103746.82350-1-r.bolshakov@yadro.com
tests/sockettest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[libvirt] [PATCH] tests: Fix message for IP parse/format failures

Posted by Roman Bolshakov 9 weeks ago
Confusing message is printed when a parse/format sockettest fails. E.g.
there's a test that parses/formats ::ffff and the format fails like that:
  38) Test format ::ffff family AF_UNSPEC                               ...
  Offset 2
  Expect [0.0.255.255]
  Actual [ffff]

It should be instead:
  38) Test format ::ffff family AF_UNSPEC                               ...
  Offset 2
  Expect [ffff]
  Actual [0.0.255.255]

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 tests/sockettest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/sockettest.c b/tests/sockettest.c
index 0c6c79f2a9..859f02e51e 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -50,7 +50,7 @@ static int testFormat(virSocketAddr *addr, const char *addrstr, bool pass)
         return pass ? -1 : 0;
 
     if (STRNEQ(newaddrstr, addrstr)) {
-        virTestDifference(stderr, newaddrstr, addrstr);
+        virTestDifference(stderr, addrstr, newaddrstr);
         VIR_FREE(newaddrstr);
         return pass ? -1 : 0;
     } else {
-- 
2.22.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: Fix message for IP parse/format failures

Posted by Andrea Bolognani 9 weeks ago
On Thu, 2019-08-08 at 13:37 +0300, Roman Bolshakov wrote:
> Confusing message is printed when a parse/format sockettest fails. E.g.
> there's a test that parses/formats ::ffff and the format fails like that:
>   38) Test format ::ffff family AF_UNSPEC                               ...
>   Offset 2
>   Expect [0.0.255.255]
>   Actual [ffff]
> 
> It should be instead:
>   38) Test format ::ffff family AF_UNSPEC                               ...
>   Offset 2
>   Expect [ffff]
>   Actual [0.0.255.255]
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>  tests/sockettest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Nice catch!

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

and pushed.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list