Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Remove uv_init calls from tests and benchmarks

  • Loading branch information...
piscisaureus committed Sep 8, 2011
1 parent 79eaf40 commit 2c96ad226144caf5b3162b9cc4ffe61407debfb2
@@ -86,7 +86,6 @@ BENCHMARK_IMPL(gethostbyname) {
return 1;
}

uv_init();
loop = uv_default_loop();

ares_callbacks = 0;
@@ -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);
@@ -200,7 +200,6 @@ static void pinger_new() {


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

start_time = uv_now(loop);
@@ -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);
@@ -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);
@@ -391,7 +390,6 @@ HELPER_IMPL(pipe_pump_server) {
int r;
type = PIPE;

uv_init();
loop = uv_default_loop();

/* Server */
@@ -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);
@@ -431,7 +428,6 @@ void pipe_pump(int n) {
TARGET_CONNECTIONS = n;
type = PIPE;

uv_init();
loop = uv_default_loop();

/* Start making connections */
@@ -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);
@@ -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;
@@ -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))
@@ -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))
@@ -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))
@@ -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))
@@ -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);
@@ -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");
}
@@ -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);
@@ -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);
@@ -180,8 +180,6 @@ static void client_connect() {


TEST_IMPL(delayed_accept) {
uv_init();

start_server();

client_connect();
@@ -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);
@@ -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,
@@ -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,
@@ -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);
@@ -713,7 +709,6 @@ TEST_IMPL(fs_async_sendfile) {
struct stat s1, s2;

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

@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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 */
@@ -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 */
@@ -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,
@@ -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;

@@ -90,8 +90,6 @@ TEST_IMPL(gethostbyname) {
return 1;
}

uv_init();

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

@@ -309,7 +309,6 @@ static void udp_sender(void) {


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

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


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

if (udp_listener())
@@ -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);
@@ -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);
@@ -221,8 +221,6 @@ static void pipe_pinger_new() {


TEST_IMPL(tcp_ping_pong) {
uv_init();

tcp_pinger_new();
uv_run(uv_default_loop());

@@ -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());

@@ -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());

@@ -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);
@@ -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);
@@ -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);
@@ -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);

0 comments on commit 2c96ad2

Please sign in to comment.
You can’t perform that action at this time.