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; +} +