]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test1515: add tracing and more debug info
authorStefan Eissing <stefan@eissing.org>
Thu, 3 Oct 2024 11:09:17 +0000 (13:09 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Oct 2024 12:41:55 +0000 (14:41 +0200)
Test failed on some Windows CI and log files did not really
tell why. Add more output.

Closes #15140

tests/libtest/Makefile.inc
tests/libtest/lib1515.c

index 056968c99fa69871627d729d08192118a6c4170a..c79ce622a435a810dad9a0dad203c12a328dde01 100644 (file)
@@ -402,7 +402,7 @@ lib1513_LDADD = $(TESTUTIL_LIBS)
 lib1514_SOURCES = lib1514.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 lib1514_LDADD = $(TESTUTIL_LIBS)
 
-lib1515_SOURCES = lib1515.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1515_SOURCES = lib1515.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
 lib1515_LDADD = $(TESTUTIL_LIBS)
 
 lib1517_SOURCES = lib1517.c $(SUPPORTFILES)
index 5d762513d55633fd7f4853c56c005db0f82f6db7..f772d9e38b2f9ae9cab3c59a91e0432ebf885c49 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include "test.h"
+#include "testtrace.h"
 #include "testutil.h"
 #include "warnless.h"
 #include "memdebug.h"
 
 #define DNS_TIMEOUT 1
 
-static int debug_callback(CURL *curl, curl_infotype info, char *msg,
-                          size_t len, void *ptr)
-{
-  (void)curl;
-  (void)ptr;
-
-  if(info == CURLINFO_TEXT)
-    fprintf(stderr, "debug: %.*s", (int) len, msg);
-
-  return 0;
-}
-
 static CURLcode do_one_request(CURLM *m, char *URL, char *resolve)
 {
   CURL *curls;
@@ -64,10 +53,14 @@ static CURLcode do_one_request(CURLM *m, char *URL, char *resolve)
 
   easy_setopt(curls, CURLOPT_URL, URL);
   easy_setopt(curls, CURLOPT_RESOLVE, resolve_list);
-  easy_setopt(curls, CURLOPT_DEBUGFUNCTION, debug_callback);
-  easy_setopt(curls, CURLOPT_VERBOSE, 1);
   easy_setopt(curls, CURLOPT_DNS_CACHE_TIMEOUT, DNS_TIMEOUT);
 
+  libtest_debug_config.nohex = 1;
+  libtest_debug_config.tracetime = 1;
+  easy_setopt(curls, CURLOPT_DEBUGDATA, &libtest_debug_config);
+  easy_setopt(curls, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
+  easy_setopt(curls, CURLOPT_VERBOSE, 1L);
+
   multi_add_handle(m, curls);
   multi_perform(m, &still_running);
 
@@ -127,6 +120,7 @@ CURLcode test(char *URL)
   start_test_timing();
 
   global_init(CURL_GLOBAL_ALL);
+  curl_global_trace("all");
   multi_init(multi);
 
   for(i = 1; i <= count; i++) {
@@ -137,6 +131,7 @@ CURLcode test(char *URL)
     /* second request must succeed like the first one */
     res = do_one_request(multi, target_url, dns_entry);
     if(res != CURLE_OK) {
+      fprintf(stderr, "request %s failed with %d\n", target_url, res);
       goto test_cleanup;
     }