summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-12-16 10:39:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-12-17 16:55:56 +0100
commitff4d2c2a056691ab173de7bfaa6d0e325691f136 (patch)
tree0d6c86ffd7b452640315659f3c2866d5e51553e8 /tests
parenta5bc272223681e1473f260ab9580b50753f25b7b (diff)
downloadcurl-ff4d2c2a056691ab173de7bfaa6d0e325691f136.tar.gz
test1522: add debug tracing
I used this to track down some issues and I figured I could just as well keep this extra logging in here for future needs. Closes #6331
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/Makefile.inc3
-rw-r--r--tests/libtest/lib1522.c31
2 files changed, 22 insertions, 12 deletions
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index 1628671c7..c23bc5b1a 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -481,7 +481,8 @@ lib1520_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1520
nodist_lib1521_SOURCES = lib1521.c $(SUPPORTFILES)
lib1521_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)
-lib1522_SOURCES = lib1522.c $(SUPPORTFILES)
+lib1522_SOURCES = lib1522.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE)
+lib1522_LDADD = $(TESTUTIL_LIBS)
lib1522_CPPFLAGS = $(AM_CPPFLAGS)
lib1523_SOURCES = lib1523.c $(SUPPORTFILES)
diff --git a/tests/libtest/lib1522.c b/tests/libtest/lib1522.c
index e070e80f4..2532a6ca2 100644
--- a/tests/libtest/lib1522.c
+++ b/tests/libtest/lib1522.c
@@ -23,6 +23,7 @@
/* test case and code based on https://github.com/curl/curl/issues/2847 */
+#include "testtrace.h"
#include "testutil.h"
#include "warnless.h"
#include "memdebug.h"
@@ -49,25 +50,32 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
int test(char *URL)
{
CURLcode code;
+ CURLcode res;
struct curl_slist *pHeaderList = NULL;
- CURL *pCurl = curl_easy_init();
+ CURL *curl = curl_easy_init();
memset(g_Data, 'A', sizeof(g_Data)); /* send As! */
- curl_easy_setopt(pCurl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
- curl_easy_setopt(pCurl, CURLOPT_URL, URL);
- curl_easy_setopt(pCurl, CURLOPT_POSTFIELDS, g_Data);
- curl_easy_setopt(pCurl, CURLOPT_POSTFIELDSIZE, (long)sizeof(g_Data));
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
+ curl_easy_setopt(curl, CURLOPT_URL, URL);
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, g_Data);
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)sizeof(g_Data));
+
+ libtest_debug_config.nohex = 1;
+ libtest_debug_config.tracetime = 1;
+ test_setopt(curl, CURLOPT_DEBUGDATA, &libtest_debug_config);
+ test_setopt(curl, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
+ test_setopt(curl, CURLOPT_VERBOSE, 1L);
/* Remove "Expect: 100-continue" */
pHeaderList = curl_slist_append(pHeaderList, "Expect:");
- curl_easy_setopt(pCurl, CURLOPT_HTTPHEADER, pHeaderList);
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaderList);
- code = curl_easy_perform(pCurl);
+ code = curl_easy_perform(curl);
if(code == CURLE_OK) {
curl_off_t uploadSize;
- curl_easy_getinfo(pCurl, CURLINFO_SIZE_UPLOAD_T, &uploadSize);
+ curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &uploadSize);
printf("uploadSize = %ld\n", (long)uploadSize);
@@ -75,15 +83,16 @@ int test(char *URL)
printf("!!!!!!!!!! PASS\n");
}
else {
- printf("!!!!!!!!!! FAIL\n");
+ printf("sent %d, libcurl says %d\n",
+ (int)sizeof(g_Data), (int)uploadSize);
}
}
else {
printf("curl_easy_perform() failed. e = %d\n", code);
}
-
+ test_cleanup:
curl_slist_free_all(pHeaderList);
- curl_easy_cleanup(pCurl);
+ curl_easy_cleanup(curl);
curl_global_cleanup();
return 0;