[Libosinfo] [libosinfo PATCH 4/4] test-os-resources: Cover maximum resources in tests
Fabiano Fidêncio
fidencio at redhat.com
Wed Nov 14 15:54:15 UTC 2018
https://gitlab.com/libosinfo/osinfo-db/issues/11
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
tests/test-os-resources.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tests/test-os-resources.c b/tests/test-os-resources.c
index fa9df6a..6526680 100644
--- a/tests/test-os-resources.c
+++ b/tests/test-os-resources.c
@@ -115,7 +115,7 @@ compare_resources(OsinfoOs *os,
static void
-test_minimum_recommended_resources(void)
+test_minimum_recommended_maximum_resources(void)
{
OsinfoLoader *loader = osinfo_loader_new();
OsinfoDb *db = osinfo_loader_get_db(loader);
@@ -135,10 +135,11 @@ test_minimum_recommended_resources(void)
for (oses_it = oses; oses_it != NULL; oses_it = oses_it->next) {
OsinfoOs *os = oses->data;
- OsinfoResourcesList *minimum_list, *recommended_list;
+ 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)
@@ -146,8 +147,21 @@ test_minimum_recommended_resources(void)
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);
@@ -164,7 +178,7 @@ main(int argc, char *argv[])
g_test_init(&argc, &argv, NULL);
- g_test_add_func("/os/resources/minimum_recommended", test_minimum_recommended_resources);
+ g_test_add_func("/os/resources/minimum_recommended_maximum", test_minimum_recommended_maximum_resources);
/* Upfront so we don't confuse valgrind */
osinfo_entity_get_type();
--
2.19.1
More information about the Libosinfo
mailing list