summaryrefslogtreecommitdiff
path: root/tests/test-os.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2019-03-19 13:17:03 +0100
committerFabiano FidĂȘncio <fidencio@redhat.com>2019-03-21 13:41:05 +0100
commit0ad1810282b210a6712b1434d2c97f1642a99359 (patch)
tree2b830e7dc2c705c038051de3b8418d59108ab70d /tests/test-os.c
parentf5c9ab338eb912c3d892cfc9591acc82319f9a96 (diff)
downloadlibosinfo-0ad1810282b210a6712b1434d2c97f1642a99359.tar.gz
test-os: Remove test_resources_minimum_recommended_maximum
This test is now part of osinfo-db. Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'tests/test-os.c')
-rw-r--r--tests/test-os.c150
1 files changed, 0 insertions, 150 deletions
diff --git a/tests/test-os.c b/tests/test-os.c
index 7244c0a..eecf820 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);