]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: allow passing details for passed validation tests
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Nov 2025 09:30:31 +0000 (04:30 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Nov 2025 17:25:38 +0000 (17:25 +0000)
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.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tools/virt-validate-common.c
tools/virt-validate-common.h

index 9768fd9208805df480c9973221f313ca58d9c5a9..ef6130ff2a98a5e447879d1de34520e339effe9e 100644 (file)
@@ -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");
 }
 
 
index 7f7c373a66fa8a19f4fb5e5bdc641ac77fba8f82..8981f5af713652c1b0a61d4b8a0324a0c8bdb679 100644 (file)
@@ -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);