From: Stefan Eissing Date: Tue, 1 Oct 2024 10:48:46 +0000 (+0200) Subject: test1915: add tracing and connect timeout X-Git-Tag: curl-8_11_0~240 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc055d08acb29a8fe05f432640d01fe51379428c;p=thirdparty%2Fcurl.git test1915: add tracing and connect timeout 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 --- diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index c79ce622a4..339a00fc4e 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -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) diff --git a/tests/libtest/lib1915.c b/tests/libtest/lib1915.c index 35b4d40869..ead6713a0e 100644 --- a/tests/libtest/lib1915.c +++ b/tests/libtest/lib1915.c @@ -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;