Skip to content

Commit bc055d0

Browse files
icingbagder
authored andcommitted
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 curl#15107
1 parent 566a6d7 commit bc055d0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

tests/libtest/Makefile.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ lib1912_LDADD = $(TESTUTIL_LIBS)
577577
lib1913_SOURCES = lib1913.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
578578
lib1913_LDADD = $(TESTUTIL_LIBS)
579579

580-
lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
580+
lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
581581
lib1915_LDADD = $(TESTUTIL_LIBS)
582582

583583
lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)

tests/libtest/lib1915.c

+14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
***************************************************************************/
2424
#include "test.h"
2525

26+
#include "testtrace.h"
2627
#include "testutil.h"
2728
#include "warnless.h"
2829
#include "memdebug.h"
@@ -104,26 +105,39 @@ CURLcode test(char *URL)
104105

105106
global_init(CURL_GLOBAL_ALL);
106107

108+
libtest_debug_config.nohex = 1;
109+
libtest_debug_config.tracetime = 1;
110+
107111
easy_init(hnd);
108112
easy_setopt(hnd, CURLOPT_URL, URL);
113+
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
109114
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsread);
110115
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
111116
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
112117
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
113118
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
119+
easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
120+
easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
121+
easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
114122
res = curl_easy_perform(hnd);
115123
curl_easy_cleanup(hnd);
116124
hnd = NULL;
125+
if(res == CURLE_OPERATION_TIMEDOUT) /* we expect that on Windows */
126+
res = CURLE_COULDNT_CONNECT;
117127
printf("First request returned %d\n", res);
118128
res = CURLE_OK;
119129

120130
easy_init(hnd);
121131
easy_setopt(hnd, CURLOPT_URL, URL);
132+
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
122133
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail);
123134
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
124135
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
125136
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
126137
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
138+
easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
139+
easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
140+
easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
127141
res = curl_easy_perform(hnd);
128142
curl_easy_cleanup(hnd);
129143
hnd = NULL;

0 commit comments

Comments
 (0)