]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test2405: split off H2 tests to new test 2407, fix callback prototype
authorViktor Szakats <commit@vsz.me>
Wed, 12 Nov 2025 09:27:36 +0000 (10:27 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 12 Nov 2025 12:56:02 +0000 (13:56 +0100)
To untangle the different curl/server requirements of these tests.
Also to make this test run for non-H2 builds. Searching the cause of
the flakiness documented in #19481.

Also:
- fix the callback function prototype. Detected by ASAN with this patch,
  though the issue was pre-existing.
  ```
  lib/cw-out.c:211:14: runtime error: call to function emptyWriteFunc
    through pointer to incorrect function type
    'unsigned long (*)(char *, unsigned long, unsigned long, void *)'
  tests/libtest/lib2405.c:72: note: emptyWriteFunc defined here
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib/cw-out.c:211:14
  ```
  Ref: https://github.com/curl/curl/actions/runs/19296686908/job/55180334364?pr=19487#step:44:3768

Follow-up to 96a5ce5a82eb0f08650649ffafb7bb4e51fc4444 #19481

Closes #19487

tests/data/Makefile.am
tests/data/test2405
tests/data/test2407 [new file with mode: 0644]
tests/libtest/lib2405.c

index bdec674dff26cdfbec283dd3d30a22018de1e0a9..c9e3f75ba16a322440c89eb931c62c988c68ca99 100644 (file)
@@ -261,7 +261,7 @@ test2200 test2201 test2202 test2203 test2204 test2205 \
 test2300 test2301 test2302 test2303 test2304 test2306 test2307 test2308 \
 test2309 \
 \
-test2400 test2401 test2402 test2403 test2404 test2405 test2406 \
+test2400 test2401 test2402 test2403 test2404 test2405 test2406 test2407 \
 \
 test2500 test2501 test2502 test2503 \
 \
index ee25b1de53e4a34a0907beb3d815d896c1e1c8b4..79f5e337c3e962296d4b45c69eaec90b8071a8b7 100644 (file)
@@ -3,7 +3,6 @@
 <keywords>
 multi
 HTTP
-HTTP/2
 </keywords>
 </info>
 
@@ -29,7 +28,7 @@ Funny-head: yesyes
 # Client-side
 <client>
 <server>
-http/2
+http
 </server>
 <tool>
 lib%TESTNUMBER
@@ -38,7 +37,7 @@ lib%TESTNUMBER
 checking curl_multi_waitfds functionality
 </name>
 <command>
-http://%HOSTIP:%HTTP2PORT/%TESTNUMBER
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
 </command>
 </client>
 
diff --git a/tests/data/test2407 b/tests/data/test2407
new file mode 100644 (file)
index 0000000..c103cf7
--- /dev/null
@@ -0,0 +1,51 @@
+<testcase>
+<info>
+<keywords>
+multi
+HTTP
+HTTP/2
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 200 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6007
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+%repeat[1000 x foobar]%
+</data>
+</reply>
+
+# Client-side
+<client>
+<features>
+http/2
+</features>
+<server>
+http/2
+</server>
+<tool>
+lib2405
+</tool>
+<name>
+checking curl_multi_waitfds functionality (HTTP/2)
+</name>
+<command>
+http://%HOSTIP:%HTTP2PORT/%TESTNUMBER
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+</verify>
+</testcase>
index 1cbb8401ae1810461439e170fddb6a947701e8c4..2945b45b6ca8a739ea712f28f83b32515baf5c89 100644 (file)
@@ -68,7 +68,7 @@ enum {
   TEST_USE_HTTP2_MPLEX
 };
 
-static size_t emptyWriteFunc(void *ptr, size_t size, size_t nmemb,
+static size_t emptyWriteFunc(char *ptr, size_t size, size_t nmemb,
                              void *data) {
   (void)ptr; (void)data;
   return size * nmemb;
@@ -381,14 +381,19 @@ static CURLcode test_lib2405(const char *URL)
   if(res != CURLE_OK)
     goto test_cleanup;
 
-  /* HTTP1, expected 2 waitfds - one for each transfer */
-  test_run_check(TEST_USE_HTTP1, 2);
-
-  /* HTTP2, expected 2 waitfds - one for each transfer */
-  test_run_check(TEST_USE_HTTP2, 2);
+  if(testnum == 2405) {
+    /* HTTP1, expected 2 waitfds - one for each transfer */
+    test_run_check(TEST_USE_HTTP1, 2);
+  }
+#ifdef USE_HTTP2
+  else { /* 2407 */
+    /* HTTP2, expected 2 waitfds - one for each transfer */
+    test_run_check(TEST_USE_HTTP2, 2);
 
-  /* HTTP2 with multiplexing, expected 1 waitfds - one for all transfers */
-  test_run_check(TEST_USE_HTTP2_MPLEX, 1);
+    /* HTTP2 with multiplexing, expected 1 waitfds - one for all transfers */
+    test_run_check(TEST_USE_HTTP2_MPLEX, 1);
+  }
+#endif
 
 test_cleanup:
   curl_global_cleanup();