[Libosinfo] [libosinfo] test-isodetect: Improve error message on detection failures

Christophe Fergeau cfergeau at redhat.com
Wed Jan 10 09:36:41 UTC 2018


Since the switch to the GTest framework, when the test suite fails to
identify an ISO, the error message is:
ERROR:test-isodetect.c:359:test_one: 'matched' should be TRUE
while it used to be the much more explicit:
ERROR **: ISO alpine-extended-3.7.0_rc2-x86_64.iso.txt was not matched by OS alpinelinux3.7

This commit readds the explicit message on this particular failure.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 tests/test-isodetect.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
index a269c3f7..8e511135 100644
--- a/tests/test-isodetect.c
+++ b/tests/test-isodetect.c
@@ -356,7 +356,10 @@ static void test_one(const gchar *vendor)
 
         g_test_message("checking OS %s for ISO %s",
                        info->shortid, info->filename);
-        g_assert_true(matched);
+        if (!matched) {
+            g_error("ISO %s was not matched by OS %s",
+                    info->filename, info->shortid);
+        }
 
         g_object_get(info->media, "os", &os, NULL);
         const gchar *shortid = osinfo_product_get_short_id(OSINFO_PRODUCT(os));
-- 
2.14.3




More information about the Libosinfo mailing list