aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-12-13 13:40:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-12-13 13:40:25 +0000
commitd346ba5c3c685ecb58e40b1fdd48c0f6dca332b5 (patch)
tree61c614da957c805f7d6484796332208ec4b18e6b /tests/libtest
parent978541adc20126accef2ec82cbbba3ddc655a172 (diff)
lib502.c for multi interface tests on a single URL without select()
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/Makefile.am6
-rw-r--r--tests/libtest/lib502.c33
2 files changed, 38 insertions, 1 deletions
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index f11ff10fa..103f3e1c6 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -9,7 +9,7 @@ INCLUDES = -I$(top_srcdir)/include
LIBDIR = ../../lib
# here are all tools used for running libcurl tests
-bin_PROGRAMS = lib500 lib501
+bin_PROGRAMS = lib500 lib501 lib502
lib500_SOURCES = lib500.c first.c test.h
lib500_LDADD = $(LIBDIR)/libcurl.la
@@ -18,3 +18,7 @@ lib500_DEPENDENCIES = $(LIBDIR)/libcurl.la
lib501_SOURCES = lib501.c first.c test.h
lib501_LDADD = $(LIBDIR)/libcurl.la
lib501_DEPENDENCIES = $(LIBDIR)/libcurl.la
+
+lib502_SOURCES = lib502.c first.c test.h
+lib502_LDADD = $(LIBDIR)/libcurl.la
+lib502_DEPENDENCIES = $(LIBDIR)/libcurl.la
diff --git a/tests/libtest/lib502.c b/tests/libtest/lib502.c
new file mode 100644
index 000000000..55ca6c5db
--- /dev/null
+++ b/tests/libtest/lib502.c
@@ -0,0 +1,33 @@
+#include "test.h"
+
+/*
+ * Get a single URL without select().
+ */
+
+CURLcode test(char *URL)
+{
+ CURL *c;
+ CURLM *m;
+ CURLMcode res;
+ int running=1;
+
+ curl_global_init(CURL_GLOBAL_ALL);
+ c = curl_easy_init();
+ curl_easy_setopt(c, CURLOPT_URL, URL);
+ m = curl_multi_init();
+
+ res = curl_multi_add_handle(m, c);
+ while (running) {
+ res = curl_multi_perform(m, &running);
+ if (running <= 0) {
+ fprintf(stderr, "nothing left running.\n");
+ break;
+ }
+ }
+ curl_multi_remove_handle(m, c);
+ curl_easy_cleanup(c);
+ curl_multi_cleanup(m);
+
+ return 0;
+}
+