mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Add more IOCP tests. They might not pass yet.
svn:r1487
This commit is contained in:
parent
5d2c1650f3
commit
5f1d6e640f
@ -38,6 +38,7 @@ extern struct testcase_t main_testcases[];
|
||||
extern struct testcase_t evtag_testcases[];
|
||||
extern struct testcase_t evbuffer_testcases[];
|
||||
extern struct testcase_t bufferevent_testcases[];
|
||||
extern struct testcase_t bufferevent_iocp_testcases[];
|
||||
extern struct testcase_t util_testcases[];
|
||||
extern struct testcase_t signal_testcases[];
|
||||
extern struct testcase_t http_testcases[];
|
||||
@ -82,6 +83,7 @@ void run_legacy_test_fn(void *ptr);
|
||||
#define TT_LEGACY (TT_FIRST_USER_FLAG<<3)
|
||||
#define TT_NEED_THREADS (TT_FIRST_USER_FLAG<<4)
|
||||
#define TT_NO_LOGS (TT_FIRST_USER_FLAG<<5)
|
||||
#define TT_ENABLE_IOCP (TT_FIRST_USER_FLAG<<6)
|
||||
|
||||
/* All the flags that a legacy test needs. */
|
||||
#define TT_ISOLATED TT_FORK|TT_NEED_SOCKETPAIR|TT_NEED_BASE
|
||||
|
@ -609,3 +609,25 @@ struct testcase_t bufferevent_testcases[] = {
|
||||
|
||||
END_OF_TESTCASES,
|
||||
};
|
||||
|
||||
struct testcase_t bufferevent_iocp_testcases[] = {
|
||||
|
||||
LEGACY(bufferevent, TT_ISOLATED|TT_ENABLE_IOCP),
|
||||
LEGACY(bufferevent_watermarks, TT_ISOLATED|TT_ENABLE_IOCP),
|
||||
LEGACY(bufferevent_filters, TT_ISOLATED|TT_ENABLE_IOCP),
|
||||
#if 0
|
||||
{ "bufferevent_connect", test_bufferevent_connect, TT_FORK|TT_NEED_BASE,
|
||||
&basic_setup, (void*)"" },
|
||||
{ "bufferevent_connect_defer", test_bufferevent_connect,
|
||||
TT_FORK|TT_NEED_BASE, &basic_setup, (void*)"defer" },
|
||||
{ "bufferevent_connect_lock", test_bufferevent_connect,
|
||||
TT_FORK|TT_NEED_BASE|TT_NEED_THREADS, &basic_setup, (void*)"lock" },
|
||||
{ "bufferevent_connect_lock_defer", test_bufferevent_connect,
|
||||
TT_FORK|TT_NEED_BASE|TT_NEED_THREADS, &basic_setup,
|
||||
(void*)"defer lock" },
|
||||
{ "bufferevent_connect_fail", test_bufferevent_connect_fail,
|
||||
TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
|
||||
#endif
|
||||
|
||||
END_OF_TESTCASES,
|
||||
};
|
||||
|
@ -131,5 +131,9 @@ struct testcase_t listener_testcases[] = {
|
||||
{ "randport", regress_pick_a_port, TT_FORK|TT_NEED_BASE,
|
||||
&basic_setup, NULL},
|
||||
|
||||
{ "iocp/randport", regress_pick_a_port,
|
||||
TT_FORK|TT_NEED_BASE|TT_ENABLE_IOCP,
|
||||
&basic_setup, NULL},
|
||||
|
||||
END_OF_TESTCASES,
|
||||
};
|
||||
|
@ -75,6 +75,8 @@
|
||||
#include "regress.h"
|
||||
#include "tinytest.h"
|
||||
#include "tinytest_macros.h"
|
||||
#include "../iocp-internal.h"
|
||||
|
||||
|
||||
/* ============================================================ */
|
||||
/* Code to wrap up old legacy test cases that used setup() and cleanup().
|
||||
@ -132,6 +134,11 @@ basic_test_setup(const struct testcase_t *testcase)
|
||||
int spair[2] = { -1, -1 };
|
||||
struct basic_test_data *data = NULL;
|
||||
|
||||
#ifndef WIN32
|
||||
if (testcase->flags & TT_ENABLE_IOCP)
|
||||
return (void*)TT_SKIP;
|
||||
#endif
|
||||
|
||||
if (testcase->flags & TT_NEED_THREADS) {
|
||||
if (!(testcase->flags & TT_FORK))
|
||||
return NULL;
|
||||
@ -170,7 +177,12 @@ basic_test_setup(const struct testcase_t *testcase)
|
||||
if (!base)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (testcase->flags & TT_ENABLE_IOCP) {
|
||||
if (event_base_start_iocp(base)<0) {
|
||||
event_base_free(base);
|
||||
return (void*)TT_SKIP;
|
||||
}
|
||||
}
|
||||
|
||||
if (testcase->flags & TT_NEED_DNS) {
|
||||
evdns_set_log_fn(dnslogcb);
|
||||
@ -232,6 +244,8 @@ static void *
|
||||
legacy_test_setup(const struct testcase_t *testcase)
|
||||
{
|
||||
struct basic_test_data *data = basic_test_setup(testcase);
|
||||
if (data == (void*)TT_SKIP)
|
||||
return data;
|
||||
global_base = data->base;
|
||||
pair[0] = data->pair[0];
|
||||
pair[1] = data->pair[1];
|
||||
@ -306,6 +320,7 @@ struct testgroup_t testgroups[] = {
|
||||
#ifdef WIN32
|
||||
{ "iocp/", iocp_testcases },
|
||||
#endif
|
||||
{ "iocp/bufferevent/", bufferevent_iocp_testcases },
|
||||
#ifdef _EVENT_HAVE_OPENSSL
|
||||
{ "ssl/", ssl_testcases },
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user