Re: [PATCH] Enhance test-isodetect: continue after failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
thank you for yours review. I am sending you new version.

BR
Vera

On Tue, Oct 16, 2018 at 10:57 AM Daniel P. Berrangé <berrange@xxxxxxxxxx> wrote:
On Mon, Oct 15, 2018 at 07:43:59PM +0200, Věra Cholasta wrote:
> ---
>  tests/test-isodetect.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
> index 76f0c5a..f40f5cc 100644
> --- a/tests/test-isodetect.c
> +++ b/tests/test-isodetect.c
> @@ -390,17 +390,16 @@ static void test_one(const gchar *vendor)

>      g_assert_nonnull(isos);

> -    tmp = isos;
> -    while (tmp) {
> +    for (tmp = isos; tmp; tmp = tmp->next) {
>          struct ISOInfo *info  = tmp->data;
>          gboolean matched = osinfo_db_identify_media(db, info->media);
>          OsinfoOs *os;

>          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);
> +            continue;

You've removed the message that tells us what actually failed.


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 :|
From 8d5b8239a4391fd37606b4de5a0ba21da1376349 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C4=9Bra=20Cholasta?= <vbudikov@xxxxxxxxxx>
Date: Tue, 16 Oct 2018 19:30:46 +0200
Subject: [PATCH 1/2] test-isodetect: replace while loop with for loop

---
 tests/test-isodetect.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
index 76f0c5a..c1833ae 100644
--- a/tests/test-isodetect.c
+++ b/tests/test-isodetect.c
@@ -390,8 +390,7 @@ static void test_one(const gchar *vendor)
 
     g_assert_nonnull(isos);
 
-    tmp = isos;
-    while (tmp) {
+    for (tmp = isos; tmp; tmp = tmp->next) {
         struct ISOInfo *info  = tmp->data;
         gboolean matched = osinfo_db_identify_media(db, info->media);
         OsinfoOs *os;
@@ -408,8 +407,6 @@ static void test_one(const gchar *vendor)
         g_assert_cmpstr(shortid, ==, info->shortid);
         g_object_unref(G_OBJECT(os));
         test_langs(info);
-
-        tmp = tmp->next;
     }
 
     g_list_foreach(isos, (GFunc)free_iso, NULL);
-- 
1.8.3.1

From 561fc01aa725a3075cccc672efcb6ebec18d2ab9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C4=9Bra=20Cholasta?= <vbudikov@xxxxxxxxxx>
Date: Tue, 16 Oct 2018 19:31:23 +0200
Subject: [PATCH 2/2] test-isodetect: continue after failure

---
 tests/test-isodetect.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
index c1833ae..2f644e8 100644
--- a/tests/test-isodetect.c
+++ b/tests/test-isodetect.c
@@ -398,8 +398,10 @@ static void test_one(const gchar *vendor)
         g_test_message("checking OS %s for ISO %s",
                        info->shortid, info->filename);
         if (!matched) {
-            g_error("ISO %s was not matched by OS %s",
-                    info->filename, info->shortid);
+            g_printerr("ISO %s was not matched by OS %s\n/isodetect/%s: ",
+                       info->filename, info->shortid, vendor);
+            g_test_fail();
+            break;
         }
 
         g_object_get(info->media, "os", &os, NULL);
@@ -420,6 +422,12 @@ main(int argc, char *argv[])
 {
     g_test_init(&argc, &argv, NULL);
 
+#if GLIB_CHECK_VERSION(2, 38, 0)
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+    g_test_set_nonfatal_assertions();
+    G_GNUC_END_IGNORE_DEPRECATIONS
+#endif
+
     GList *vendors = load_vendors(NULL);
     GList *it;
     for (it = vendors; it != NULL; it = it->next) {
-- 
1.8.3.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux