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

Daniel P. Berrange berrange at redhat.com
Wed Jan 10 09:57:36 UTC 2018


On Wed, Jan 10, 2018 at 10:36:41AM +0100, Christophe Fergeau wrote:
> 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));

Reviewed-by: Daniel P. Berrange <berrange at redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the Libosinfo mailing list