On Mon, 2018-11-19 at 11:43 +0000, Daniel P. Berrangé wrote:
> Make it possible to debug failures by displaying the URL,
> curl error code/message and http code.
> 
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> ---
>  tests/test-mediauris.c | 4 ++++
>  tests/test-treeuris.c  | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/tests/test-mediauris.c b/tests/test-mediauris.c
> index 443fdc3..c906f08 100644
> --- a/tests/test-mediauris.c
> +++ b/tests/test-mediauris.c
> @@ -46,6 +46,10 @@ static void test_media(OsinfoMediaList *medialist,
> GError **error, CURL *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_OK) {
> +            g_printerr("Failed URI %s res=%d (%s) code=%ld\n",
> +                       url, res, curl_easy_strerror(res), 

We have a small problem on using g_printerr() though. It'll make the
test to abort in the first failure it faces and it's not something we
would like to do.

> response_code);
> +        }
>          g_assert_cmpint(res, ==, CURLE_OK);
>  
>          tmp = tmp->next;
> diff --git a/tests/test-treeuris.c b/tests/test-treeuris.c
> index 9b5c679..b0cddbf 100644
> --- a/tests/test-treeuris.c
> +++ b/tests/test-treeuris.c
> @@ -46,6 +46,10 @@ static void test_tree(OsinfoTreeList *treelist,
> GError **error, CURL *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_OK) {
> +            g_printerr("Failed URI %s res=%d (%s) code=%ld\n",
> +                       url, res, curl_easy_strerror(res),
> response_code);

Same comment here.

> +        }
>          g_assert_cmpint(res, ==, CURLE_OK);
>  
>          tmp = tmp->next;

Would you be okay on changing the g_printerr() to g_test_message() or
similar? If yes, please, just do the change and push the patch without
the need of a v2.

Also, I've talked to Věra and in general we need to improve our tests
in order to have them displaying better info ... mainly in cases where
we go through our database. Thanks for working on this!

Best Regards,
-- 
Fabiano Fidêncio

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

Reply via email to