summaryrefslogtreecommitdiff
path: root/tests/libtest/test.h
diff options
context:
space:
mode:
authorGergely Nagy <ngg@tresorit.com>2019-11-17 15:12:15 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-11-25 15:45:56 +0100
commitf3c35e371cc70f1b6bc33f7faa904d37d1567eb3 (patch)
tree3c7668dec5726aa510d7be282ff440c9ee370802 /tests/libtest/test.h
parent0a65febccf0e31bc987be3f90c01194804e61b77 (diff)
downloadgnurl-f3c35e371cc70f1b6bc33f7faa904d37d1567eb3.tar.gz
gnurl-f3c35e371cc70f1b6bc33f7faa904d37d1567eb3.tar.bz2
gnurl-f3c35e371cc70f1b6bc33f7faa904d37d1567eb3.zip
multi: add curl_multi_wakeup()
This commit adds curl_multi_wakeup() which was previously in the TODO list under the curl_multi_unblock name. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_WAKEUP_FAILURE) is returned from curl_multi_wakeup(). Fixes #4418 Closes #4608
Diffstat (limited to 'tests/libtest/test.h')
-rw-r--r--tests/libtest/test.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/libtest/test.h b/tests/libtest/test.h
index bb1acca0e..3c8323de4 100644
--- a/tests/libtest/test.h
+++ b/tests/libtest/test.h
@@ -355,6 +355,60 @@ extern int unitfail;
/* ---------------------------------------------------------------- */
+#define exe_multi_poll(A,B,C,D,E,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_poll((A), (B), (C), (D), (E))) != CURLM_OK) { \
+ fprintf(stderr, "%s:%d curl_multi_poll() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = (int)ec; \
+ } \
+ else if(*((E)) < 0) { \
+ fprintf(stderr, "%s:%d curl_multi_poll() succeeded, " \
+ "but returned invalid numfds value (%d)\n", \
+ (Y), (Z), (int)*((E))); \
+ res = TEST_ERR_NUM_HANDLES; \
+ } \
+} WHILE_FALSE
+
+#define res_multi_poll(A, B, C, D, E) \
+ exe_multi_poll((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
+
+#define chk_multi_poll(A, B, C, D, E, Y, Z) do { \
+ exe_multi_poll((A), (B), (C), (D), (E), (Y), (Z)); \
+ if(res) \
+ goto test_cleanup; \
+} WHILE_FALSE
+
+#define multi_poll(A, B, C, D, E) \
+ chk_multi_poll((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
+
+/* ---------------------------------------------------------------- */
+
+#define exe_multi_wakeup(A,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_wakeup((A))) != CURLM_OK) { \
+ fprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = (int)ec; \
+ } \
+} WHILE_FALSE
+
+#define res_multi_wakeup(A) \
+ exe_multi_wakeup((A), (__FILE__), (__LINE__))
+
+#define chk_multi_wakeup(A, Y, Z) do { \
+ exe_multi_wakeup((A), (Y), (Z)); \
+ if(res) \
+ goto test_cleanup; \
+} WHILE_FALSE
+
+#define multi_wakeup(A) \
+ chk_multi_wakeup((A), (__FILE__), (__LINE__))
+
+/* ---------------------------------------------------------------- */
+
#define exe_select_test(A, B, C, D, E, Y, Z) do { \
int ec; \
if(select_wrapper((A), (B), (C), (D), (E)) == -1) { \