Although the issue with curl should be fixed by the previous commit,
let's abort in case it misbehaves, avoiding then to have all the data
printed on stdout.

Signed-off-by: Fabiano Fidêncio <[email protected]>
---
 tests/test-imageuris.c | 9 +++++++++
 tests/test-mediauris.c | 9 +++++++++
 tests/test-treeuris.c  | 9 +++++++++
 3 files changed, 27 insertions(+)

diff --git a/tests/test-imageuris.c b/tests/test-imageuris.c
index 4fb0675..33fdc19 100644
--- a/tests/test-imageuris.c
+++ b/tests/test-imageuris.c
@@ -24,6 +24,14 @@
 #include <osinfo/osinfo.h>
 #include <curl/curl.h>
 
+static size_t write_callback(char *ptr,
+                             size_t size,
+                             size_t nmemb,
+                             void *userdata)
+{
+    abort();
+}
+
 static void test_image(OsinfoImageList *imagelist, GError **error)
 {
     GList *imageel = NULL, *tmp;
@@ -48,6 +56,7 @@ static void test_image(OsinfoImageList *imagelist, GError 
**error)
         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);
diff --git a/tests/test-mediauris.c b/tests/test-mediauris.c
index 6d7319c..e35f152 100644
--- a/tests/test-mediauris.c
+++ b/tests/test-mediauris.c
@@ -24,6 +24,14 @@
 #include <osinfo/osinfo.h>
 #include <curl/curl.h>
 
+static size_t write_callback(char *ptr,
+                             size_t size,
+                             size_t nmemb,
+                             void *userdata)
+{
+    abort();
+}
+
 static void test_media(OsinfoMediaList *medialist, GError **error)
 {
     GList *mediael = NULL, *tmp;
@@ -48,6 +56,7 @@ static void test_media(OsinfoMediaList *medialist, GError 
**error)
         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);
diff --git a/tests/test-treeuris.c b/tests/test-treeuris.c
index 42376d9..76ab862 100644
--- a/tests/test-treeuris.c
+++ b/tests/test-treeuris.c
@@ -24,6 +24,14 @@
 #include <osinfo/osinfo.h>
 #include <curl/curl.h>
 
+static size_t write_callback(char *ptr,
+                             size_t size,
+                             size_t nmemb,
+                             void *userdata)
+{
+    abort();
+}
+
 static void test_tree(OsinfoTreeList *treelist, GError **error)
 {
     GList *treeel = NULL, *tmp;
@@ -48,6 +56,7 @@ static void test_tree(OsinfoTreeList *treelist, GError 
**error)
         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);
-- 
2.20.1

_______________________________________________
Libosinfo mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libosinfo

Reply via email to