parent
2f1150e680
commit
53f9d5a841
@ -19,12 +19,13 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
BENCHMARK_DECLARE (echo_server)
|
||||
BENCHMARK_DECLARE (ping_pongs)
|
||||
BENCHMARK_DECLARE (dummy)
|
||||
BENCHMARK_DECLARE (ping_pongs)
|
||||
HELPER_DECLARE (echo_server)
|
||||
|
||||
TASK_LIST_START
|
||||
BENCHMARK_ENTRY (dummy)
|
||||
BENCHMARK_ENTRY (ping_pongs)
|
||||
BENCHMARK_ENTRY (dummy)
|
||||
|
||||
BENCHMARK_ENTRY (ping_pongs)
|
||||
BENCHMARK_HELPER (ping_pongs, echo_server)
|
||||
TASK_LIST_END
|
||||
|
||||
@ -135,18 +135,7 @@ int echo_stop() {
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(echo_server) {
|
||||
oio_init();
|
||||
if (echo_start(TEST_PORT))
|
||||
return 1;
|
||||
|
||||
fprintf(stderr, "Listening!\n");
|
||||
oio_run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: Ugly. Isn't there a better way to do this? */
|
||||
BENCHMARK_IMPL(echo_server) {
|
||||
HELPER_IMPL(echo_server) {
|
||||
oio_init();
|
||||
if (echo_start(TEST_PORT))
|
||||
return 1;
|
||||
|
||||
@ -51,30 +51,34 @@ int run_task(task_entry_t *test, int timeout, int benchmark_output);
|
||||
/*
|
||||
* Macros used by test-list.h and benchmark-list.h.
|
||||
*/
|
||||
#define TASK_LIST_START \
|
||||
#define TASK_LIST_START \
|
||||
task_entry_t TASKS[] = {
|
||||
|
||||
#define TASK_LIST_END \
|
||||
{ 0, 0, 0, 0 } \
|
||||
#define TASK_LIST_END \
|
||||
{ 0, 0, 0, 0 } \
|
||||
};
|
||||
|
||||
#define TEST_DECLARE(name) \
|
||||
#define TEST_DECLARE(name) \
|
||||
int run_test_##name();
|
||||
|
||||
#define TEST_ENTRY(name) \
|
||||
#define TEST_ENTRY(name) \
|
||||
{ #name, #name, &run_test_##name, 0 },
|
||||
|
||||
#define TEST_HELPER(name, proc) \
|
||||
{ #name, #proc, &run_test_##proc, 1 },
|
||||
|
||||
#define BENCHMARK_DECLARE(name) \
|
||||
#define BENCHMARK_DECLARE(name) \
|
||||
int run_benchmark_##name();
|
||||
|
||||
#define BENCHMARK_ENTRY(name) \
|
||||
#define BENCHMARK_ENTRY(name) \
|
||||
{ #name, #name, &run_benchmark_##name, 0 },
|
||||
|
||||
#define BENCHMARK_HELPER(name, proc) \
|
||||
{ #name, #proc, &run_benchmark_##proc, 1 },
|
||||
#define HELPER_DECLARE(name) \
|
||||
int run_helper_##name();
|
||||
|
||||
#define HELPER_ENTRY(task_name, name) \
|
||||
{ #task_name, #name, &run_helper_##name, 1 },
|
||||
|
||||
#define TEST_HELPER HELPER_ENTRY
|
||||
#define BENCHMARK_HELPER HELPER_ENTRY
|
||||
|
||||
|
||||
/*
|
||||
* Include platform-dependent definitions
|
||||
|
||||
@ -63,11 +63,14 @@
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Just sugar for wrapping the main() for a task. */
|
||||
/* Just sugar for wrapping the main() for a task or helper. */
|
||||
#define TEST_IMPL(name) \
|
||||
int run_test_##name()
|
||||
|
||||
#define BENCHMARK_IMPL(name) \
|
||||
int run_benchmark_##name()
|
||||
|
||||
#define HELPER_IMPL(name) \
|
||||
int run_helper_##name()
|
||||
|
||||
#endif /* TASK_H_ */
|
||||
|
||||
@ -47,11 +47,11 @@ static void on_connect(oio_req *req, int err) {
|
||||
TEST_IMPL(test_connection_fail) {
|
||||
struct sockaddr_in client_addr, server_addr;
|
||||
int r;
|
||||
|
||||
|
||||
oio_init();
|
||||
|
||||
client_addr = oio_ip4_addr("0.0.0.0", 0);
|
||||
|
||||
|
||||
/* There should be no servers listening on this port. */
|
||||
server_addr = oio_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
TEST_DECLARE (echo_server)
|
||||
TEST_DECLARE (ping_pong)
|
||||
TEST_DECLARE (close_cb_stack)
|
||||
TEST_DECLARE (timeout)
|
||||
TEST_DECLARE (fail_always)
|
||||
TEST_DECLARE (pass_always)
|
||||
TEST_DECLARE (test_connection_fail)
|
||||
TEST_DECLARE (ping_pong)
|
||||
TEST_DECLARE (close_cb_stack)
|
||||
TEST_DECLARE (timeout)
|
||||
TEST_DECLARE (fail_always)
|
||||
TEST_DECLARE (pass_always)
|
||||
TEST_DECLARE (test_connection_fail)
|
||||
HELPER_DECLARE (echo_server)
|
||||
|
||||
TASK_LIST_START
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user