]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test1915: add tracing and connect timeout
authorStefan Eissing <stefan@eissing.org>
Tue, 1 Oct 2024 10:48:46 +0000 (12:48 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Oct 2024 14:06:08 +0000 (16:06 +0200)
Since we see Windows fails of 1915, add tracing and a connect timeout.
The test uses a port no one is supposed to listen on, but Windows has
this weird wait logic. So, set a short timeout.

Closes #15107

tests/libtest/Makefile.inc
tests/libtest/lib1915.c

index c79ce622a435a810dad9a0dad203c12a328dde01..339a00fc4ed41e1491ea945ff9ebeb7caf058c69 100644 (file)
@@ -577,7 +577,7 @@ lib1912_LDADD = $(TESTUTIL_LIBS)
 lib1913_SOURCES = lib1913.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 lib1913_LDADD = $(TESTUTIL_LIBS)
 
-lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
 lib1915_LDADD = $(TESTUTIL_LIBS)
 
 lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)
index 35b4d408690f02ef7a4ba2b68075be611773a6a2..ead6713a0e840d06ab148fe6f03a11165c9b6307 100644 (file)
@@ -23,6 +23,7 @@
  ***************************************************************************/
 #include "test.h"
 
+#include "testtrace.h"
 #include "testutil.h"
 #include "warnless.h"
 #include "memdebug.h"
@@ -104,26 +105,39 @@ CURLcode test(char *URL)
 
   global_init(CURL_GLOBAL_ALL);
 
+  libtest_debug_config.nohex = 1;
+  libtest_debug_config.tracetime = 1;
+
   easy_init(hnd);
   easy_setopt(hnd, CURLOPT_URL, URL);
+  easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
   easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsread);
   easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
   easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
   easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
   easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
+  easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
+  easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
+  easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
   res = curl_easy_perform(hnd);
   curl_easy_cleanup(hnd);
   hnd = NULL;
+  if(res == CURLE_OPERATION_TIMEDOUT) /* we expect that on Windows */
+    res = CURLE_COULDNT_CONNECT;
   printf("First request returned %d\n", res);
   res = CURLE_OK;
 
   easy_init(hnd);
   easy_setopt(hnd, CURLOPT_URL, URL);
+  easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
   easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail);
   easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
   easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
   easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
   easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
+  easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
+  easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
+  easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
   res = curl_easy_perform(hnd);
   curl_easy_cleanup(hnd);
   hnd = NULL;