[libvirt] [PATCH 12/23] cputest: Print correct feature in virCPUUpdateLive test

Jiri Denemark posted 23 patches 7 years, 7 months ago
There is a newer version of this series
[libvirt] [PATCH 12/23] cputest: Print correct feature in virCPUUpdateLive test
Posted by Jiri Denemark 7 years, 7 months ago
If the actual result does not match our expectation, the tests would
not correctly show the difference if a CPU feature is disabled in the
expected result and the actual result does not mention it at all. The
test could complain about an unrelated CPU feature or it could even
crash in case the actual result contains no more features to go through.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 tests/cputest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cputest.c b/tests/cputest.c
index 57cff04f38..dcfdf57d43 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -605,7 +605,7 @@ cpuTestUpdateLiveCompare(virArch arch,
             (cmp > 0 &&
              featExp->policy == VIR_CPU_FEATURE_DISABLE)) {
             VIR_TEST_VERBOSE("Actual CPU has extra feature '%s'\n",
-                             featAct->name);
+                             cmp <= 0 ? featAct->name : featExp->name);
             ret = -1;
         }
     }
-- 
2.14.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 12/23] cputest: Print correct feature in virCPUUpdateLive test
Posted by John Ferlan 7 years, 7 months ago

On 10/04/2017 10:58 AM, Jiri Denemark wrote:
> If the actual result does not match our expectation, the tests would
> not correctly show the difference if a CPU feature is disabled in the
> expected result and the actual result does not mention it at all. The
> test could complain about an unrelated CPU feature or it could even
> crash in case the actual result contains no more features to go through.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  tests/cputest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

I recognize this - it was something I noted at one time from a Coverity
test failure...

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

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