[libosinfo PATCH 5/5] test-os: Remove test_devices_duplication

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

 



This test is now part of osinfo-db.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tests/test-os.c | 146 ------------------------------------------------
 1 file changed, 146 deletions(-)

diff --git a/tests/test-os.c b/tests/test-os.c
index cb7d972..b8b0a16 100644
--- a/tests/test-os.c
+++ b/tests/test-os.c
@@ -270,151 +270,6 @@ static void test_resources_basic(void)
 }
 
 
-static GList *get_all_distros(OsinfoOsList *oslist)
-{
-    GList *oses;
-    GList *distros = NULL;
-    GList *it;
-
-    oses = osinfo_list_get_elements(OSINFO_LIST(oslist));
-    for (it = oses; it != NULL; it = it->next) {
-        OsinfoOs *os;
-        const gchar *distro;
-
-        os = OSINFO_OS(it->data);
-        distro = osinfo_os_get_distro(os);
-
-        if (g_list_find_custom(distros, distro, (GCompareFunc) g_strcmp0) == NULL)
-            distros = g_list_prepend(distros, (gchar *)distro);
-    }
-
-    g_list_free(oses);
-
-    return distros;
-}
-
-
-static void check_duplicated_devices_cb(OsinfoProduct *product,
-                                        gpointer user_data)
-{
-    OsinfoOs *os = OSINFO_OS(user_data);
-    OsinfoOs *foreach_os = OSINFO_OS(product);
-    OsinfoDeviceList *devices_os, *devices_foreach_os;
-    GList *list_devices = NULL, *list_foreach_devices = NULL, *list_duplicated = NULL;
-    GList *l;
-
-    if (os == foreach_os)
-        return;
-
-    devices_os = osinfo_os_get_devices(os, NULL);
-    devices_foreach_os = osinfo_os_get_devices(foreach_os, NULL);
-
-    if (osinfo_list_get_length(OSINFO_LIST(devices_os)) == 0 ||
-        osinfo_list_get_length(OSINFO_LIST(devices_foreach_os)) == 0)
-        goto done;
-
-    list_devices = osinfo_list_get_elements(OSINFO_LIST(devices_os));
-    list_foreach_devices = osinfo_list_get_elements(OSINFO_LIST(devices_foreach_os));
-
-    for (l = list_devices; l != NULL; l = l->next) {
-        OsinfoDevice *d = OSINFO_DEVICE(l->data);
-        GList *ll;
-
-        for (ll = list_foreach_devices; ll != NULL; ll = ll->next) {
-            OsinfoDevice *dd = OSINFO_DEVICE(ll->data);
-            if (d == dd)
-                list_duplicated = g_list_prepend(list_duplicated, d);
-        }
-    }
-
-    if (list_duplicated != NULL) {
-        gchar *string = NULL;
-        for (l = list_duplicated; l != NULL; l = l->next) {
-            gchar *tmp = NULL;
-            if (string != NULL)
-                tmp = g_strdup_printf("%s\n  - %s\n",
-                                      string,
-                                      osinfo_device_get_name(OSINFO_DEVICE(l->data)));
-            else
-                tmp = g_strdup_printf("\n  - %s",
-                                      osinfo_device_get_name(OSINFO_DEVICE(l->data)));
-
-            g_free(string);
-            string = tmp;
-        }
-
-        g_debug("\nTesting \"%s\" against \"%s\" and found the following duplicated devices: %s",
-                osinfo_product_get_short_id(OSINFO_PRODUCT(os)),
-                osinfo_product_get_short_id(product),
-                string);
-        g_free(string);
-
-        g_test_fail();
-    }
-
- done:
-    g_list_free(list_duplicated);
-    g_list_free(list_devices);
-    g_list_free(list_foreach_devices);
-    g_object_unref(devices_os);
-    g_object_unref(devices_foreach_os);
-}
-
-
-static void check_duplicated_devices(OsinfoOs *os)
-{
-    osinfo_product_foreach_related(OSINFO_PRODUCT(os),
-                                   OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM |
-                                   OSINFO_PRODUCT_FOREACH_FLAG_CLONES,
-                                   check_duplicated_devices_cb,
-                                   os);
-}
-
-
-static void test_devices_duplication(void)
-{
-    OsinfoLoader *loader = osinfo_loader_new();
-    OsinfoDb *db = osinfo_loader_get_db(loader);
-    OsinfoOsList *all_oses_list;
-    GList *distros, *l;
-    GError *error = NULL;
-
-    g_assert_true(OSINFO_IS_LOADER(loader));
-    g_assert_true(OSINFO_IS_DB(db));
-
-    osinfo_loader_process_default_path(loader, &error);
-    g_assert_no_error(error);
-
-    all_oses_list = osinfo_db_get_os_list(db);
-    distros = get_all_distros(all_oses_list);
-
-    for (l = distros; l != NULL; l = l->next) {
-        const gchar *distro;
-        OsinfoOsList *oslist;
-        OsinfoFilter *filter;
-        int i;
-
-        distro = l->data;
-
-        filter = osinfo_filter_new();
-        osinfo_filter_add_constraint(filter, OSINFO_OS_PROP_DISTRO, distro);
-        oslist = OSINFO_OSLIST(osinfo_list_new_filtered(OSINFO_LIST(all_oses_list), filter));
-
-        for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(oslist)); i++) {
-            OsinfoOs *os = OSINFO_OS(osinfo_list_get_nth(OSINFO_LIST(oslist), i));
-            check_duplicated_devices(os);
-        }
-
-        g_object_unref(filter);
-        g_object_unref(oslist);
-    }
-
-    g_list_free(distros);
-    g_object_unref(all_oses_list);
-    g_object_unref(loader);
-}
-
-
 static void
 devices_inheritance_basic_check(OsinfoDb *db,
                                 const gchar *os_id)
@@ -776,7 +631,6 @@ main(int argc, char *argv[])
     g_test_add_func("/os/devices", test_devices);
     g_test_add_func("/os/devices_filter", test_devices_filter);
     g_test_add_func("/os/device_driver", test_device_driver);
-    g_test_add_func("/os/devices/duplication", test_devices_duplication);
     g_test_add_func("/os/devices/inheritance/basic",
                     test_devices_inheritance_basic);
     g_test_add_func("/os/devices/inheritance/removal",
-- 
2.20.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