Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Remove uv_init calls from tests and benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Sep 11, 2011
1 parent 79eaf40 commit 2c96ad2
Show file tree
Hide file tree
Showing 33 changed files with 0 additions and 144 deletions.
1 change: 0 additions & 1 deletion test/benchmark-ares.c
Expand Up @@ -86,7 +86,6 @@ BENCHMARK_IMPL(gethostbyname) {
return 1;
}

uv_init();
loop = uv_default_loop();

ares_callbacks = 0;
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-getaddrinfo.c
Expand Up @@ -68,7 +68,6 @@ static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) {
BENCHMARK_IMPL(getaddrinfo) {
int i;

uv_init(loop);
loop = uv_default_loop();

uv_update_time(loop);
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-ping-pongs.c
Expand Up @@ -200,7 +200,6 @@ static void pinger_new() {


BENCHMARK_IMPL(ping_pongs) {
uv_init();
loop = uv_default_loop();

start_time = uv_now(loop);
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-pound.c
Expand Up @@ -277,7 +277,6 @@ static int pound_it(int concurrency,
uint64_t start_time; /* in ns */
uint64_t end_time;

uv_init();
loop = uv_default_loop();

uv_update_time(loop);
Expand Down
4 changes: 0 additions & 4 deletions test/benchmark-pump.c
Expand Up @@ -367,7 +367,6 @@ HELPER_IMPL(tcp_pump_server) {
int r;

type = TCP;
uv_init();
loop = uv_default_loop();

listen_addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
Expand All @@ -391,7 +390,6 @@ HELPER_IMPL(pipe_pump_server) {
int r;
type = PIPE;

uv_init();
loop = uv_default_loop();

/* Server */
Expand All @@ -414,7 +412,6 @@ void tcp_pump(int n) {
TARGET_CONNECTIONS = n;
type = TCP;

uv_init();
loop = uv_default_loop();

connect_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
Expand All @@ -431,7 +428,6 @@ void pipe_pump(int n) {
TARGET_CONNECTIONS = n;
type = PIPE;

uv_init();
loop = uv_default_loop();

/* Start making connections */
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-spawn.c
Expand Up @@ -132,7 +132,6 @@ BENCHMARK_IMPL(spawn) {
int r;
static int64_t start_time, end_time;

uv_init();
loop = uv_default_loop();

r = uv_exepath(exepath, &exepath_size);
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-udp-packet-storm.c
Expand Up @@ -134,7 +134,6 @@ static int do_packet_storm(int n_senders, int n_receivers) {
ASSERT(n_senders <= MAX_SENDERS);
ASSERT(n_receivers <= MAX_RECEIVERS);

uv_init();
loop = uv_default_loop();

n_senders_ = n_senders;
Expand Down
1 change: 0 additions & 1 deletion test/dns-server.c
Expand Up @@ -317,7 +317,6 @@ static int dns_start(int port) {


HELPER_IMPL(dns_server) {
uv_init();
loop = uv_default_loop();

if (dns_start(TEST_PORT_2))
Expand Down
3 changes: 0 additions & 3 deletions test/echo-server.c
Expand Up @@ -272,7 +272,6 @@ static int pipe_echo_start(char* pipeName) {


HELPER_IMPL(tcp4_echo_server) {
uv_init();
loop = uv_default_loop();

if (tcp4_echo_start(TEST_PORT))
Expand All @@ -284,7 +283,6 @@ HELPER_IMPL(tcp4_echo_server) {


HELPER_IMPL(tcp6_echo_server) {
uv_init();
loop = uv_default_loop();

if (tcp6_echo_start(TEST_PORT))
Expand All @@ -296,7 +294,6 @@ HELPER_IMPL(tcp6_echo_server) {


HELPER_IMPL(pipe_echo_server) {
uv_init();
loop = uv_default_loop();

if (pipe_echo_start(TEST_PIPENAME))
Expand Down
2 changes: 0 additions & 2 deletions test/test-async.c
Expand Up @@ -182,8 +182,6 @@ static void prepare_cb(uv_prepare_t* handle, int status) {
TEST_IMPL(async) {
int r;

uv_init();

r = uv_prepare_init(uv_default_loop(), &prepare_handle);
ASSERT(r == 0);
r = uv_prepare_start(&prepare_handle, prepare_cb);
Expand Down
2 changes: 0 additions & 2 deletions test/test-callback-stack.c
Expand Up @@ -176,8 +176,6 @@ static void connect_cb(uv_connect_t* req, int status) {
TEST_IMPL(callback_stack) {
struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT);

uv_init();

if (uv_tcp_init(uv_default_loop(), &client)) {
FATAL("uv_tcp_init failed");
}
Expand Down
5 changes: 0 additions & 5 deletions test/test-connection-fail.c
Expand Up @@ -119,8 +119,6 @@ void connection_fail(uv_connect_cb connect_cb) {
* expect an error.
*/
TEST_IMPL(connection_fail) {
uv_init();

connection_fail(on_connect_with_close);

ASSERT(timer_close_cb_calls == 0);
Expand All @@ -136,9 +134,6 @@ TEST_IMPL(connection_fail) {
* attempt.
*/
TEST_IMPL(connection_fail_doesnt_auto_close) {
uv_init();


uv_timer_init(uv_default_loop(), &timer);

connection_fail(on_connect_without_close);
Expand Down
2 changes: 0 additions & 2 deletions test/test-delayed-accept.c
Expand Up @@ -180,8 +180,6 @@ static void client_connect() {


TEST_IMPL(delayed_accept) {
uv_init();

start_server();

client_connect();
Expand Down
17 changes: 0 additions & 17 deletions test/test-fs.c
Expand Up @@ -387,7 +387,6 @@ TEST_IMPL(fs_file_noent) {
uv_fs_t req;
int r;

uv_init();
loop = uv_default_loop();

r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, NULL);
Expand Down Expand Up @@ -476,7 +475,6 @@ TEST_IMPL(fs_file_async) {
unlink("test_file");
unlink("test_file2");

uv_init();
loop = uv_default_loop();

r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
Expand Down Expand Up @@ -539,7 +537,6 @@ TEST_IMPL(fs_file_sync) {
unlink("test_file");
unlink("test_file2");

uv_init();
loop = uv_default_loop();

r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
Expand Down Expand Up @@ -625,7 +622,6 @@ TEST_IMPL(fs_async_dir) {
unlink("test_dir/file2");
rmdir("test_dir");

uv_init();
loop = uv_default_loop();

r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb);
Expand Down Expand Up @@ -713,7 +709,6 @@ TEST_IMPL(fs_async_sendfile) {
struct stat s1, s2;

/* Setup. */
uv_init();
unlink("test_file");
unlink("test_file2");

Expand Down Expand Up @@ -781,8 +776,6 @@ TEST_IMPL(fs_fstat) {
/* Setup. */
unlink("test_file");

uv_init();

loop = uv_default_loop();

r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
Expand Down Expand Up @@ -837,8 +830,6 @@ TEST_IMPL(fs_chmod) {
/* Setup. */
unlink("test_file");

uv_init();

loop = uv_default_loop();

r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
Expand Down Expand Up @@ -926,8 +917,6 @@ TEST_IMPL(fs_chown) {
/* Setup. */
unlink("test_file");

uv_init();

loop = uv_default_loop();

r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
Expand Down Expand Up @@ -987,8 +976,6 @@ TEST_IMPL(fs_link) {
unlink("test_file_link");
unlink("test_file_link2");

uv_init();

loop = uv_default_loop();

r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
Expand Down Expand Up @@ -1073,8 +1060,6 @@ TEST_IMPL(fs_symlink) {
unlink("test_file_symlink_symlink");
unlink("test_file_symlink2_symlink");

uv_init();

loop = uv_default_loop();

r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
Expand Down Expand Up @@ -1187,7 +1172,6 @@ TEST_IMPL(fs_utime) {
uv_fs_t req;
int r;

uv_init();
loop = uv_default_loop();

atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
Expand Down Expand Up @@ -1228,7 +1212,6 @@ TEST_IMPL(fs_futime) {
uv_fs_t req;
int r;

uv_init();
loop = uv_default_loop();

atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
Expand Down
5 changes: 0 additions & 5 deletions test/test-getaddrinfo.c
Expand Up @@ -72,9 +72,6 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle,
TEST_IMPL(getaddrinfo_basic) {
int r;

uv_init();


r = uv_getaddrinfo(uv_default_loop(),
&getaddrinfo_handle,
&getaddrinfo_basic_cb,
Expand All @@ -95,8 +92,6 @@ TEST_IMPL(getaddrinfo_concurrent) {
int i, r;
int* data;

uv_init();

for (i = 0; i < CONCURRENT_COUNT; i++) {
callback_counts[i] = 0;

Expand Down
2 changes: 0 additions & 2 deletions test/test-gethostbyname.c
Expand Up @@ -90,8 +90,6 @@ TEST_IMPL(gethostbyname) {
return 1;
}

uv_init();

printf("Start basic gethostbyname test\n");
prep_tcploopback();

Expand Down
2 changes: 0 additions & 2 deletions test/test-getsockname.c
Expand Up @@ -309,7 +309,6 @@ static void udp_sender(void) {


TEST_IMPL(getsockname_tcp) {
uv_init();
loop = uv_default_loop();

if (tcp_listener())
Expand All @@ -327,7 +326,6 @@ TEST_IMPL(getsockname_tcp) {


TEST_IMPL(getsockname_udp) {
uv_init();
loop = uv_default_loop();

if (udp_listener())
Expand Down
3 changes: 0 additions & 3 deletions test/test-idle.c
Expand Up @@ -60,9 +60,6 @@ static void idle_cb(uv_idle_t* handle, int status) {
TEST_IMPL(idle_starvation) {
int r;

uv_init();


r = uv_idle_init(uv_default_loop(), &idle_handle);
ASSERT(r == 0);
r = uv_idle_start(&idle_handle, idle_cb);
Expand Down
3 changes: 0 additions & 3 deletions test/test-loop-handles.c
Expand Up @@ -299,9 +299,6 @@ TEST_IMPL(loop_handles) {
int i;
int r;

uv_init();


r = uv_prepare_init(uv_default_loop(), &prepare_1_handle);
ASSERT(r == 0);
r = uv_prepare_start(&prepare_1_handle, prepare_1_cb);
Expand Down
6 changes: 0 additions & 6 deletions test/test-ping-pong.c
Expand Up @@ -221,8 +221,6 @@ static void pipe_pinger_new() {


TEST_IMPL(tcp_ping_pong) {
uv_init();

tcp_pinger_new();
uv_run(uv_default_loop());

Expand All @@ -233,8 +231,6 @@ TEST_IMPL(tcp_ping_pong) {


TEST_IMPL(tcp_ping_pong_v6) {
uv_init();

tcp_pinger_v6_new();
uv_run(uv_default_loop());

Expand All @@ -245,8 +241,6 @@ TEST_IMPL(tcp_ping_pong_v6) {


TEST_IMPL(pipe_ping_pong) {
uv_init();

pipe_pinger_new();
uv_run(uv_default_loop());

Expand Down
12 changes: 0 additions & 12 deletions test/test-pipe-bind-error.c
Expand Up @@ -45,9 +45,6 @@ TEST_IMPL(pipe_bind_error_addrinuse) {
uv_pipe_t server1, server2;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server1);
ASSERT(r == 0);
r = uv_pipe_bind(&server1, TEST_PIPENAME);
Expand Down Expand Up @@ -82,9 +79,6 @@ TEST_IMPL(pipe_bind_error_addrnotavail) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0);
r = uv_pipe_bind(&server, BAD_PIPENAME);
Expand All @@ -106,9 +100,6 @@ TEST_IMPL(pipe_bind_error_inval) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0);
r = uv_pipe_bind(&server, TEST_PIPENAME);
Expand All @@ -132,9 +123,6 @@ TEST_IMPL(pipe_listen_without_bind) {
uv_pipe_t server;
int r;

uv_init();


r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0);
r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL);
Expand Down

0 comments on commit 2c96ad2

Please sign in to comment.