Remove tests depending on osinfo-db

Those tests are now part of osinfo-db.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-04-10 14:39:03 +02:00
parent d6aa609f21
commit 454fbcc26f
6 changed files with 53132 additions and 0 deletions

View File

@ -0,0 +1,559 @@
From d0f081759b99f6642ab5fe0e875dfd878f7ed8d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Wed, 10 Apr 2019 14:56:56 +0200
Subject: [PATCH] tests: Remove test-*.uris
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Those tests are now part of osinfo-db.
With this change we can get rid of the curl dependency we have.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
---
README | 1 -
configure.ac | 8 ---
tests/Makefile.am | 26 +---------
tests/test-imageuris.c | 90 --------------------------------
tests/test-mediauris.c | 96 ----------------------------------
tests/test-treeuris.c | 94 ---------------------------------
tests/test-uris-common.c | 109 ---------------------------------------
tests/test-uris-common.h | 26 ----------
8 files changed, 2 insertions(+), 448 deletions(-)
delete mode 100644 tests/test-imageuris.c
delete mode 100644 tests/test-mediauris.c
delete mode 100644 tests/test-treeuris.c
delete mode 100644 tests/test-uris-common.c
delete mode 100644 tests/test-uris-common.h
diff --git a/README b/README
index e3d528c..7f73e74 100644
--- a/README
+++ b/README
@@ -26,7 +26,6 @@ Dependencies
- Optional:
- gobject-introspection
- - libcurl (for tests only)
- Vala (build-time only)
Patch submissions
diff --git a/configure.ac b/configure.ac
index fef3cbc..6c3ea01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,14 +55,6 @@ AC_ARG_ENABLE([tests],
AS_HELP_STRING([--enable-tests], [enable test suite]),
[], [enable_tests=yes])
-if test "x$enable_tests" != "xno" ; then
- have_curl=no
- PKG_CHECK_MODULES([CURL], [libcurl], [have_curl=yes], [:])
- AC_SUBST(CURL_CFLAGS)
- AC_SUBST(CURL_LIBS)
-fi
-AM_CONDITIONAL([HAVE_CURL],[test "x$have_curl" = "xyes"])
-
AM_CONDITIONAL([ENABLE_TESTS],[test "x$enable_tests" = "xyes"])
LIBOSINFO_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a822af2..27b0f8d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,14 +23,6 @@ check_PROGRAMS = \
test-imagelist \
$(NULL)
-if HAVE_CURL
-check_PROGRAMS += \
- test-mediauris \
- test-treeuris \
- test-imageuris \
- $(NULL)
-endif
-
COMMON_LDADD = \
$(COVERAGE_LDFLAGS) \
$(GLIB_LIBS) \
@@ -78,8 +70,8 @@ test_list_LDADD = $(COMMON_LDADD)
test_list_CFLAGS = $(COMMON_CFLAGS)
test_list_SOURCES = test-list.c
-test_media_LDADD = $(COMMON_LDADD) $(CURL_LIBS)
-test_media_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS)
+test_media_LDADD = $(COMMON_LDADD)
+test_media_CFLAGS = $(COMMON_CFLAGS)
test_media_SOURCES = test-media.c
test_devicelist_LDADD = $(COMMON_LDADD)
@@ -110,20 +102,6 @@ test_isodetect_LDADD = $(COMMON_LDADD)
test_isodetect_CFLAGS = $(COMMON_CFLAGS)
test_isodetect_SOURCES = test-isodetect.c
-if HAVE_CURL
-test_mediauris_LDADD = $(COMMON_LDADD) $(CURL_LIBS)
-test_mediauris_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS)
-test_mediauris_SOURCES = test-mediauris.c test-uris-common.c test-uris-common.h
-
-test_treeuris_LDADD = $(COMMON_LDADD) $(CURL_LIBS)
-test_treeuris_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS)
-test_treeuris_SOURCES = test-treeuris.c test-uris-common.c test-uris-common.h
-
-test_imageuris_LDADD = $(COMMON_LDADD) $(CURL_LIBS)
-test_imageuris_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS)
-test_imageuris_SOURCES = test-imageuris.c test-uris-common.c test-uris-common.h
-endif
-
test_install_script_LDADD = $(COMMON_LDADD)
test_install_script_CFLAGS = $(COMMON_CFLAGS)
test_install_script_SOURCES = test-install-script.c
diff --git a/tests/test-imageuris.c b/tests/test-imageuris.c
deleted file mode 100644
index ca6e648..0000000
--- a/tests/test-imageuris.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2108 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>
- *
- * Authors:
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <osinfo/osinfo.h>
-#include <curl/curl.h>
-
-#include "test-uris-common.h"
-
-static void
-test_imageuris(gconstpointer data)
-{
- OsinfoOs *os = OSINFO_OS(data);
- GError *error = NULL;
-
- OsinfoImageList *imagelist = osinfo_os_get_image_list(os);
-
- test_uri(OSINFO_LIST(imagelist), (GetURLFunc) osinfo_image_get_url, &error);
-
- g_assert_no_error(error);
-
- g_object_unref(imagelist);
-}
-
-int
-main(int argc, char *argv[])
-{
- int ret;
- OsinfoLoader *loader = osinfo_loader_new();
- OsinfoDb *db = osinfo_loader_get_db(loader);
- OsinfoOsList *oslist = NULL;
- GError *error = NULL;
-
- g_test_init(&argc, &argv, NULL);
- g_test_set_nonfatal_assertions();
-
- if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
- return 77; /* Skip */
-
- /* Upfront so we don't confuse valgrind */
- curl_global_init(CURL_GLOBAL_ALL);
- osinfo_db_get_type();
- osinfo_os_get_type();
- osinfo_list_get_type();
- osinfo_oslist_get_type();
- osinfo_filter_get_type();
-
- osinfo_loader_process_default_path(loader, &error);
- g_assert_no_error(error);
-
- oslist = osinfo_db_get_os_list(db);
- test_uris(oslist, "/imageuris/uris", test_imageuris);
-
- ret = g_test_run();
-
- if (oslist)
- g_object_unref(oslist);
-
- g_object_unref(loader);
-
- curl_global_cleanup();
-
- return ret;
-}
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/tests/test-mediauris.c b/tests/test-mediauris.c
deleted file mode 100644
index c9e09c7..0000000
--- a/tests/test-mediauris.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>
- *
- * Authors:
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <osinfo/osinfo.h>
-#include <curl/curl.h>
-
-#include "test-uris-common.h"
-
-static void
-test_mediauris(gconstpointer data)
-{
- OsinfoOs *os = OSINFO_OS(data);
- GError *error = NULL;
-
- OsinfoMediaList *medialist = osinfo_os_get_media_list(os);
-
- test_uri(OSINFO_LIST(medialist), (GetURLFunc) osinfo_media_get_url, &error);
-
- g_assert_no_error(error);
-
- g_object_unref(medialist);
-}
-
-int
-main(int argc, char *argv[])
-{
- int ret;
- OsinfoLoader *loader = osinfo_loader_new();
- OsinfoDb *db = osinfo_loader_get_db(loader);
- OsinfoOsList *oslist = NULL;
- GError *error = NULL;
-
- g_test_init(&argc, &argv, NULL);
- g_test_set_nonfatal_assertions();
-
- if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
- return 77; /* Skip */
-
- /* Upfront so we don't confuse valgrind */
- curl_global_init(CURL_GLOBAL_ALL);
- osinfo_entity_get_type();
- osinfo_db_get_type();
- osinfo_device_get_type();
- osinfo_platform_get_type();
- osinfo_os_get_type();
- osinfo_list_get_type();
- osinfo_devicelist_get_type();
- osinfo_platformlist_get_type();
- osinfo_oslist_get_type();
- osinfo_filter_get_type();
-
-
- osinfo_loader_process_default_path(loader, &error);
- g_assert_no_error(error);
-
- oslist = osinfo_db_get_os_list(db);
- test_uris(oslist, "/mediauris/uris", test_mediauris);
-
- ret = g_test_run();
-
- if (oslist)
- g_object_unref(oslist);
-
- g_object_unref(loader);
-
- curl_global_cleanup();
-
- return ret;
-}
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/tests/test-treeuris.c b/tests/test-treeuris.c
deleted file mode 100644
index 48ce82a..0000000
--- a/tests/test-treeuris.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>
- *
- * Authors:
- * Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <osinfo/osinfo.h>
-#include <curl/curl.h>
-
-#include "test-uris-common.h"
-
-static void
-test_treeuris(gconstpointer data)
-{
- OsinfoOs *os = OSINFO_OS(data);
- GError *error = NULL;
- OsinfoTreeList *treelist = osinfo_os_get_tree_list(os);
-
- test_uri(OSINFO_LIST(treelist), (GetURLFunc) osinfo_tree_get_url, &error);
-
- g_assert_no_error(error);
-
- g_object_unref(treelist);
-}
-
-int
-main(int argc, char *argv[])
-{
- int ret;
- OsinfoLoader *loader = osinfo_loader_new();
- OsinfoDb *db = osinfo_loader_get_db(loader);
- OsinfoOsList *oslist = NULL;
- GError *error = NULL;
-
- g_test_init(&argc, &argv, NULL);
- g_test_set_nonfatal_assertions();
-
- if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
- return 77; /* Skip */
-
- /* Upfront so we don't confuse valgrind */
- curl_global_init(CURL_GLOBAL_ALL);
- osinfo_entity_get_type();
- osinfo_db_get_type();
- osinfo_device_get_type();
- osinfo_platform_get_type();
- osinfo_os_get_type();
- osinfo_list_get_type();
- osinfo_devicelist_get_type();
- osinfo_platformlist_get_type();
- osinfo_oslist_get_type();
- osinfo_filter_get_type();
-
- osinfo_loader_process_default_path(loader, &error);
- g_assert_no_error(error);
-
- oslist = osinfo_db_get_os_list(db);
- test_uris(oslist, "/treeuris/uris", test_treeuris);
-
- ret = g_test_run();
-
- if (oslist)
- g_object_unref(oslist);
-
- g_object_unref(loader);
-
- curl_global_cleanup();
-
- return ret;
-}
-/*
- * Local variables:
- * indent-tabs-mode: nil
- * c-indent-level: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/tests/test-uris-common.c b/tests/test-uris-common.c
deleted file mode 100644
index 8ebe4ea..0000000
--- a/tests/test-uris-common.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <osinfo/osinfo.h>
-#include <curl/curl.h>
-
-#include "test-uris-common.h"
-
-static size_t write_callback(char *ptr,
- size_t size,
- size_t nmemb,
- void *userdata)
-{
- abort();
-}
-
-void test_uri(OsinfoList *list, GetURLFunc get_url_func, GError **error)
-{
- GList *el = NULL, *tmp;
-
- tmp = el = osinfo_list_get_elements(list);
- while (tmp) {
- const gchar *url = get_url_func(tmp->data);
- const gchar *debugstr;
- CURL *curl;
- CURLcode res;
- long response_code;
-
- if (url == NULL || g_str_equal(url, "")) {
- tmp = tmp->next;
- continue;
- }
-
- curl = curl_easy_init();
- curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
- curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60L);
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
-
- if ((debugstr = g_getenv("LIBOSINFO_TEST_DEBUG"))) {
- int debug_level = atoi(debugstr);
-
- curl_easy_setopt(curl, CURLOPT_VERBOSE, debug_level > 0 ? 1L : 0L);
- }
-
- g_test_message("%s", url);
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
-
- g_test_message("res=%d, %s; code=%ld", res, curl_easy_strerror(res), response_code);
-
- if (res == CURLE_OPERATION_TIMEDOUT) {
- g_printerr("Ignoring network timeout failure for %s\n", url);
- } else {
- if (res != CURLE_OK) {
- g_printerr("Failed URI %s res=%d (%s) code=%ld\n",
- url, res, curl_easy_strerror(res), response_code);
- }
- g_assert_cmpint(res, ==, CURLE_OK);
- }
-
- tmp = tmp->next;
- curl_easy_cleanup(curl);
- }
-
- g_list_free(el);
-}
-
-
-void test_uris(OsinfoOsList *oslist, const gchar *prefix, TestURLFunc test_func)
-{
- GList *osel = NULL, *tmp;
-
- tmp = osel = osinfo_list_get_elements(OSINFO_LIST(oslist));
-
- while (tmp) {
- OsinfoOs *os = tmp->data;
- gchar *name = g_strdup_printf("%s/%s",
- prefix,
- osinfo_product_get_short_id(OSINFO_PRODUCT(os)));
-
- g_test_add_data_func(name, os, test_func);
- g_free(name);
-
- tmp = tmp->next;
- }
-
- g_list_free(osel);
-}
diff --git a/tests/test-uris-common.h b/tests/test-uris-common.h
deleted file mode 100644
index 34cc242..0000000
--- a/tests/test-uris-common.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>
- */
-
-#include <config.h>
-
-#include <osinfo/osinfo.h>
-
-typedef const gchar *(*GetURLFunc)(gpointer p);
-typedef void (*TestURLFunc)(gconstpointer p);
-
-void test_uri(OsinfoList *list, GetURLFunc get_url_func, GError **error);
-void test_uris(OsinfoOsList *oslist, const gchar *prefix, TestURLFunc test_func);
--
2.20.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,187 @@
From afdc58833731620db11bb07610773acd69064cf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 19 Mar 2019 13:17:03 +0100
Subject: [PATCH] test-os: Remove test_resources_minimum_recommended_maximum
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This test is now part of osinfo-db.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
tests/test-os.c | 150 ------------------------------------------------
1 file changed, 150 deletions(-)
diff --git a/tests/test-os.c b/tests/test-os.c
index 178bd15..80f866b 100644
--- a/tests/test-os.c
+++ b/tests/test-os.c
@@ -270,154 +270,6 @@ static void test_resources_basic(void)
}
-static void test_n_cpus(OsinfoResources *resources1, OsinfoResources *resources2)
-{
- gint resources1_cpus, resources2_cpus;
-
- resources1_cpus = osinfo_resources_get_n_cpus(resources1);
- resources2_cpus = osinfo_resources_get_n_cpus(resources2);
-
- if (resources2_cpus >= 0 && resources1_cpus >= 0)
- g_assert_true(resources2_cpus >= resources1_cpus);
-}
-
-
-static void test_cpu(OsinfoResources *resources1, OsinfoResources *resources2)
-{
- gint64 resources1_cpu, resources2_cpu;
-
- resources1_cpu = osinfo_resources_get_cpu(resources1);
- resources2_cpu = osinfo_resources_get_cpu(resources2);
-
- if (resources2_cpu >= 0 && resources1_cpu >= 0)
- g_assert_true(resources2_cpu >= resources1_cpu);
-}
-
-
-static void test_ram(OsinfoResources *resources1, OsinfoResources *resources2)
-{
- gint64 resources1_ram, resources2_ram;
-
- resources1_ram = osinfo_resources_get_ram(resources1);
- resources2_ram = osinfo_resources_get_ram(resources2);
-
- if (resources2_ram >= 0 && resources1_ram >= 0)
- g_assert_true(resources2_ram >= resources1_ram);
-}
-
-
-static void test_storage(OsinfoResources *resources1, OsinfoResources *resources2)
-{
- gint64 resources1_storage, resources2_storage;
-
- resources1_storage = osinfo_resources_get_storage(resources1);
- resources2_storage = osinfo_resources_get_storage(resources2);
-
- if (resources2_storage >= 0 && resources1_storage >= 0)
- g_assert_true(resources2_storage >= resources1_storage);
-}
-
-
-static void
-compare_resources(OsinfoOs *os,
- OsinfoList *resourceslist1,
- OsinfoList *resourceslist2)
-{
- GList *list1, *list2;
- GList *it1, *it2;
-
- list1 = osinfo_list_get_elements(resourceslist1);
- list2 = osinfo_list_get_elements(resourceslist2);
-
- if (list1 == NULL || list2 == NULL)
- return;
-
- for (it1 = list1; it1 != NULL; it1 = it1->next) {
- OsinfoResources *resources1 = it1->data;
- const gchar *arch1;
-
- arch1 = osinfo_resources_get_architecture(resources1);
-
- for (it2 = list2; it2 != NULL; it2 = it2->next) {
- OsinfoResources *resources2 = it2->data;
- const gchar *arch2 = osinfo_resources_get_architecture(resources2);
-
- if (g_str_equal(arch1, arch2)) {
- const gchar *name;
-
- name = osinfo_product_get_name(OSINFO_PRODUCT(os));
-
- g_test_message("checking %s (architecture: %s)",
- name, arch1);
-
- test_n_cpus(resources1, resources2);
- test_cpu(resources1, resources2);
- test_ram(resources1, resources2);
- test_storage(resources1, resources2);
- break;
- }
- }
- }
-}
-
-
-static void
-test_resources_minimum_recommended_maximum(void)
-{
- OsinfoLoader *loader = osinfo_loader_new();
- OsinfoDb *db = osinfo_loader_get_db(loader);
- OsinfoOsList *oslist;
- GList *oses;
- GList *oses_it;
- 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);
-
- oslist = osinfo_db_get_os_list(db);
- oses = osinfo_list_get_elements(OSINFO_LIST(oslist));
-
- for (oses_it = oses; oses_it != NULL; oses_it = oses_it->next) {
- OsinfoOs *os = oses_it->data;
- OsinfoResourcesList *minimum_list, *recommended_list, *maximum_list;
-
- minimum_list = osinfo_os_get_minimum_resources(os);
- recommended_list = osinfo_os_get_recommended_resources(os);
- maximum_list = osinfo_os_get_maximum_resources(os);
-
- if (osinfo_list_get_length(OSINFO_LIST(minimum_list)) > 0 &&
- osinfo_list_get_length(OSINFO_LIST(recommended_list)) > 0)
- compare_resources(os,
- OSINFO_LIST(minimum_list),
- OSINFO_LIST(recommended_list));
-
- if (osinfo_list_get_length(OSINFO_LIST(minimum_list)) > 0 &&
- osinfo_list_get_length(OSINFO_LIST(maximum_list)) > 0)
- compare_resources(os,
- OSINFO_LIST(minimum_list),
- OSINFO_LIST(maximum_list));
-
- if (osinfo_list_get_length(OSINFO_LIST(recommended_list)) > 0 &&
- osinfo_list_get_length(OSINFO_LIST(maximum_list)) > 0)
- compare_resources(os,
- OSINFO_LIST(recommended_list),
- OSINFO_LIST(maximum_list));
-
- g_object_unref(minimum_list);
- g_object_unref(recommended_list);
- g_object_unref(maximum_list);
- }
-
- g_object_unref(oslist);
- g_list_free(oses);
-
- g_object_unref(loader);
-}
-
-
static void
test_uniqueness(OsinfoOs *os,
OsinfoResourcesList *(*get_resources)(OsinfoOs *))
@@ -1000,8 +852,6 @@ main(int argc, char *argv[])
g_test_add_func("/os/devices/inheritance/removal",
test_devices_inheritance_removal);
g_test_add_func("/os/resources/basic", test_resources_basic);
- g_test_add_func("/os/resources/minimum_recommended_maximum",
- test_resources_minimum_recommended_maximum);
g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness);
g_test_add_func("/os/resources/inheritance", test_resources_inheritance);
g_test_add_func("/os/find_install_script", test_find_install_script);
--
2.20.1

View File

@ -0,0 +1,108 @@
From ef34c41da7a58fec499607f3b42d24e950dd24b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Wed, 20 Mar 2019 11:55:31 +0100
Subject: [PATCH] test-os: Remove test_resources_uniqueness
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This test is now part of osinfo-db.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
tests/test-os.c | 71 -------------------------------------------------
1 file changed, 71 deletions(-)
diff --git a/tests/test-os.c b/tests/test-os.c
index 80f866b..1a5ab67 100644
--- a/tests/test-os.c
+++ b/tests/test-os.c
@@ -270,76 +270,6 @@ static void test_resources_basic(void)
}
-static void
-test_uniqueness(OsinfoOs *os,
- OsinfoResourcesList *(*get_resources)(OsinfoOs *))
-{
- OsinfoResourcesList *resourceslist;
- GList *arches = NULL;
- GList *list, *it;
-
- resourceslist = get_resources(os);
- list = osinfo_list_get_elements(OSINFO_LIST(resourceslist));
-
- for (it = list; it != NULL; it = it->next) {
- OsinfoResources *resources = it->data;
- const gchar *arch = osinfo_resources_get_architecture(resources);
-
- if (g_list_find_custom(arches, arch, (GCompareFunc) g_strcmp0) == NULL) {
- arches = g_list_prepend(arches, (gchar *)arch);
- continue;
- }
-
- g_test_message("\"%s\" has more than one resources entry for architecture \"%s\"",
- osinfo_product_get_short_id(OSINFO_PRODUCT(os)),
- arch);
- g_test_fail();
- }
-
- g_list_free(arches);
- g_list_free(list);
- g_object_unref(resourceslist);
-}
-
-
-static void
-test_resources_uniqueness(void)
-{
- OsinfoLoader *loader = osinfo_loader_new();
- OsinfoDb *db = osinfo_loader_get_db(loader);
- OsinfoOsList *oslist;
- GList *oses;
- GList *oses_it;
- 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);
-
- oslist = osinfo_db_get_os_list(db);
- oses = osinfo_list_get_elements(OSINFO_LIST(oslist));
-
- for (oses_it = oses; oses_it != NULL; oses_it = oses_it->next) {
- OsinfoOs *os = oses_it->data;
-
- g_test_message("Testing minimum resources uniqueness for \"%s\"",
- osinfo_product_get_short_id(OSINFO_PRODUCT(os)));
- test_uniqueness(os, osinfo_os_get_minimum_resources);
-
- g_test_message("Testing recommended resources uniqueness for \"%s\"",
- osinfo_product_get_short_id(OSINFO_PRODUCT(os)));
- test_uniqueness(os, osinfo_os_get_recommended_resources);
- }
-
- g_object_unref(oslist);
- g_list_free(oses);
-
- g_object_unref(loader);
-}
-
-
static GList *get_all_distros(OsinfoOsList *oslist)
{
GList *oses;
@@ -852,7 +782,6 @@ main(int argc, char *argv[])
g_test_add_func("/os/devices/inheritance/removal",
test_devices_inheritance_removal);
g_test_add_func("/os/resources/basic", test_resources_basic);
- g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness);
g_test_add_func("/os/resources/inheritance", test_resources_inheritance);
g_test_add_func("/os/find_install_script", test_find_install_script);
--
2.20.1

View File

@ -0,0 +1,183 @@
From e878c7b91d6385ebcf77aa8a5b9c1789f3b206bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Wed, 20 Mar 2019 14:44:45 +0100
Subject: [PATCH] test-os: Remove test_devices_duplication
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This test is now part of osinfo-db.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
tests/test-os.c | 146 ------------------------------------------------
1 file changed, 146 deletions(-)
diff --git a/tests/test-os.c b/tests/test-os.c
index 1a5ab67..ea7f98c 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

View File

@ -11,6 +11,11 @@ URL: https://libosinfo.org/
###Patches###
Patch0001: 0001-media-Fix-usage-of-application-id.patch
Patch0002: 0002-loader-Properly-load-the-arch-value-for-images.patch
Patch0003: 0003-tests-Remove-test-.uris.patch
Patch0004: 0004-tests-Remove-test-isodetect.patch
Patch0005: 0005-test-os-Remove-test_resources_minimum_recommended_ma.patch
Patch0006: 0006-test-os-Remove-test_resources_uniqueness.patch
Patch0007: 0007-test-os-Remove-test_devices_duplication.patch
BuildRequires: gettext-devel
BuildRequires: glib2-devel
@ -106,6 +111,7 @@ fi
* Wed Apr 10 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.4.0-2
- Fix usage of application ID
- Fix images' load
- Remove tests depending on osinfo-db
* Fri Mar 01 2019 Fabiano Fidêncio <fidencio@redhat.com> 1.4.0-1
- Update to 1.4.0 release