[PATCH 1/5] tools: allow passing details for passed validation tests

Daniel P. Berrangé via Devel posted 5 patches 23 hours ago
[PATCH 1/5] tools: allow passing details for passed validation tests
Posted by Daniel P. Berrangé via Devel 23 hours ago
From: Daniel P. Berrangé <berrange@redhat.com>

In a number of virt-host-validte tests we are testing for
at least one out of multiple acceptable features. For
example the 'secure guest' test can be satisfied by
s390x protvirt, or x86 TDX, SEV, SEV-ES, SEV-SNP.

It would be useful to inform the user which one we detected
when the test passes. This introduces virValidatePassDetails
to enable that.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tools/virt-validate-common.c | 12 +++++++++++-
 tools/virt-validate-common.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/virt-validate-common.c b/tools/virt-validate-common.c
index 9768fd9208..ef6130ff2a 100644
--- a/tools/virt-validate-common.c
+++ b/tools/virt-validate-common.c
@@ -62,14 +62,24 @@ static bool virValidateWantEscape(void)
 }
 
 void virValidatePass(void)
+{
+    virValidatePassDetails(NULL);
+}
+
+void virValidatePassDetails(const char *info)
 {
     if (quiet)
         return;
 
     if (virValidateWantEscape())
-        fprintf(stdout, "\033[32m%s\033[0m\n", _("PASS"));
+        fprintf(stdout, "\033[32m%s\033[0m", _("PASS"));
     else
         fprintf(stdout, "%s\n", _("PASS"));
+
+    if (info)
+        fprintf(stdout, " (%s)\n", info);
+    else
+        fprintf(stdout, "\n");
 }
 
 
diff --git a/tools/virt-validate-common.h b/tools/virt-validate-common.h
index 7f7c373a66..8981f5af71 100644
--- a/tools/virt-validate-common.h
+++ b/tools/virt-validate-common.h
@@ -52,6 +52,7 @@ void virValidateCheck(const char *prefix,
                       ...) G_GNUC_PRINTF(2, 3);
 
 void virValidatePass(void);
+void virValidatePassDetails(const char *info);
 void virValidateFail(virValidateLevel level,
                      const char *format,
                      ...) G_GNUC_PRINTF(2, 3);
-- 
2.51.1

Re: [PATCH 1/5] tools: allow passing details for passed validation tests
Posted by Peter Krempa via Devel 20 hours ago
On Thu, Nov 20, 2025 at 10:14:47 +0000, Daniel P. Berrangé via Devel wrote:
> From: Daniel P. Berrangé <berrange@redhat.com>
> 
> In a number of virt-host-validte tests we are testing for
> at least one out of multiple acceptable features. For
> example the 'secure guest' test can be satisfied by
> s390x protvirt, or x86 TDX, SEV, SEV-ES, SEV-SNP.
> 
> It would be useful to inform the user which one we detected
> when the test passes. This introduces virValidatePassDetails
> to enable that.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tools/virt-validate-common.c | 12 +++++++++++-
>  tools/virt-validate-common.h |  1 +
>  2 files changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>