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
This commit is contained in:
Stefan Eissing 2024-10-01 12:48:46 +02:00 committed by Daniel Stenberg
parent 566a6d7b09
commit bc055d08ac
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 15 additions and 1 deletions

View File

@ -577,7 +577,7 @@ lib1912_LDADD = $(TESTUTIL_LIBS)
lib1913_SOURCES = lib1913.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1913_SOURCES = lib1913.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1913_LDADD = $(TESTUTIL_LIBS) lib1913_LDADD = $(TESTUTIL_LIBS)
lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
lib1915_LDADD = $(TESTUTIL_LIBS) lib1915_LDADD = $(TESTUTIL_LIBS)
lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS) lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)

View File

@ -23,6 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "test.h" #include "test.h"
#include "testtrace.h"
#include "testutil.h" #include "testutil.h"
#include "warnless.h" #include "warnless.h"
#include "memdebug.h" #include "memdebug.h"
@ -104,26 +105,39 @@ CURLcode test(char *URL)
global_init(CURL_GLOBAL_ALL); global_init(CURL_GLOBAL_ALL);
libtest_debug_config.nohex = 1;
libtest_debug_config.tracetime = 1;
easy_init(hnd); easy_init(hnd);
easy_setopt(hnd, CURLOPT_URL, URL); easy_setopt(hnd, CURLOPT_URL, URL);
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsread); easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsread);
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st); easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite); easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st); easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE); 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); res = curl_easy_perform(hnd);
curl_easy_cleanup(hnd); curl_easy_cleanup(hnd);
hnd = NULL; hnd = NULL;
if(res == CURLE_OPERATION_TIMEDOUT) /* we expect that on Windows */
res = CURLE_COULDNT_CONNECT;
printf("First request returned %d\n", res); printf("First request returned %d\n", res);
res = CURLE_OK; res = CURLE_OK;
easy_init(hnd); easy_init(hnd);
easy_setopt(hnd, CURLOPT_URL, URL); easy_setopt(hnd, CURLOPT_URL, URL);
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail); easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail);
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st); easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite); easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st); easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE); 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); res = curl_easy_perform(hnd);
curl_easy_cleanup(hnd); curl_easy_cleanup(hnd);
hnd = NULL; hnd = NULL;