diff --git a/test/benchmark-async.c b/test/benchmark-async.c index 7d3c936d..33d9ab44 100644 --- a/test/benchmark-async.c +++ b/test/benchmark-async.c @@ -86,7 +86,9 @@ static int test_async(int nthreads) { ctx->loop = uv_loop_new(); ASSERT(ctx->loop != NULL); ASSERT(0 == uv_async_init(ctx->loop, &ctx->worker_async, worker_async_cb)); - ASSERT(0 == uv_async_init(uv_default_loop(), &ctx->main_async, main_async_cb)); + ASSERT(0 == uv_async_init(uv_default_loop(), + &ctx->main_async, + main_async_cb)); ASSERT(0 == uv_thread_create(&ctx->thread, worker, ctx)); } diff --git a/test/benchmark-ping-pongs.c b/test/benchmark-ping-pongs.c index a6306e32..d93e561e 100644 --- a/test/benchmark-ping-pongs.c +++ b/test/benchmark-ping-pongs.c @@ -148,7 +148,9 @@ static void pinger_read_cb(uv_stream_t* tcp, if (pinger->state == 0) { pinger->pongs++; if (uv_now(loop) - start_time > TIME) { - uv_shutdown(&pinger->shutdown_req, (uv_stream_t*) tcp, pinger_shutdown_cb); + uv_shutdown(&pinger->shutdown_req, + (uv_stream_t*) tcp, + pinger_shutdown_cb); break; } else { pinger_write_ping(pinger); diff --git a/test/benchmark-pound.c b/test/benchmark-pound.c index e8d87055..58792854 100644 --- a/test/benchmark-pound.c +++ b/test/benchmark-pound.c @@ -229,7 +229,10 @@ static void pipe_make_connect(conn_rec* p) { r = uv_pipe_init(loop, (uv_pipe_t*)&p->stream, 0); ASSERT(r == 0); - uv_pipe_connect(&((pipe_conn_rec*)p)->conn_req, (uv_pipe_t*)&p->stream, TEST_PIPENAME, connect_cb); + uv_pipe_connect(&((pipe_conn_rec*) p)->conn_req, + (uv_pipe_t*) &p->stream, + TEST_PIPENAME, + connect_cb); #if DEBUG printf("make connect %d\n", p->i); @@ -308,20 +311,40 @@ static int pound_it(int concurrency, BENCHMARK_IMPL(tcp4_pound_100) { - return pound_it(100, "tcp", tcp_do_setup, tcp_do_connect, tcp_make_connect, NULL); + return pound_it(100, + "tcp", + tcp_do_setup, + tcp_do_connect, + tcp_make_connect, + NULL); } BENCHMARK_IMPL(tcp4_pound_1000) { - return pound_it(1000, "tcp", tcp_do_setup, tcp_do_connect, tcp_make_connect, NULL); + return pound_it(1000, + "tcp", + tcp_do_setup, + tcp_do_connect, + tcp_make_connect, + NULL); } BENCHMARK_IMPL(pipe_pound_100) { - return pound_it(100, "pipe", pipe_do_setup, pipe_do_connect, pipe_make_connect, NULL); + return pound_it(100, + "pipe", + pipe_do_setup, + pipe_do_connect, + pipe_make_connect, + NULL); } BENCHMARK_IMPL(pipe_pound_1000) { - return pound_it(1000, "pipe", pipe_do_setup, pipe_do_connect, pipe_make_connect, NULL); + return pound_it(1000, + "pipe", + pipe_do_setup, + pipe_do_connect, + pipe_make_connect, + NULL); } diff --git a/test/benchmark-pump.c b/test/benchmark-pump.c index eda3c142..b557cd4b 100644 --- a/test/benchmark-pump.c +++ b/test/benchmark-pump.c @@ -101,11 +101,16 @@ static void show_stats(uv_timer_t* handle, int status) { uv_update_time(loop); diff = uv_now(loop) - start_time; - LOGF("%s_pump%d_client: %.1f gbit/s\n", type == TCP ? "tcp" : "pipe", write_sockets, - gbit(nsent_total, diff)); + LOGF("%s_pump%d_client: %.1f gbit/s\n", + type == TCP ? "tcp" : "pipe", + write_sockets, + gbit(nsent_total, diff)); for (i = 0; i < write_sockets; i++) { - uv_close(type == TCP ? (uv_handle_t*)&tcp_write_handles[i] : (uv_handle_t*)&pipe_write_handles[i], NULL); + if (type == TCP) + uv_close((uv_handle_t*) &tcp_write_handles[i], NULL); + else + uv_close((uv_handle_t*) &pipe_write_handles[i], NULL); } exit(0); @@ -123,8 +128,10 @@ static void read_show_stats(void) { uv_update_time(loop); diff = uv_now(loop) - start_time; - LOGF("%s_pump%d_server: %.1f gbit/s\n", type == TCP ? "tcp" : "pipe", max_read_sockets, - gbit(nrecv_total, diff)); + LOGF("%s_pump%d_server: %.1f gbit/s\n", + type == TCP ? "tcp" : "pipe", + max_read_sockets, + gbit(nrecv_total, diff)); } @@ -219,7 +226,10 @@ static void connect_cb(uv_connect_t* req, int status) { /* Yay! start writing */ for (i = 0; i < write_sockets; i++) { - do_write(type == TCP ? (uv_stream_t*)&tcp_write_handles[i] : (uv_stream_t*)&pipe_write_handles[i]); + if (type == TCP) + do_write((uv_stream_t*) &tcp_write_handles[i]); + else + do_write((uv_stream_t*) &pipe_write_handles[i]); } } } diff --git a/test/benchmark-udp-pummel.c b/test/benchmark-udp-pummel.c index f8f702c0..d99250af 100644 --- a/test/benchmark-udp-pummel.c +++ b/test/benchmark-udp-pummel.c @@ -26,7 +26,7 @@ #include #include -#define EXPECTED "RANG TANG DING DONG I AM THE JAPANESE SANDMAN" /* "Take eight!" */ +#define EXPECTED "RANG TANG DING DONG I AM THE JAPANESE SANDMAN" #define TEST_DURATION 5000 /* ms */ diff --git a/test/dns-server.c b/test/dns-server.c index 8ffe4e7b..8c701221 100644 --- a/test/dns-server.c +++ b/test/dns-server.c @@ -159,12 +159,16 @@ static void process_req(uv_stream_t* handle, /* process len and id */ if (readbuf_remaining < hdrbuf_remaining) { /* too little to get request header. save for next buffer */ - memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], dnsreq, readbuf_remaining); + memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], + dnsreq, + readbuf_remaining); hdrbuf_remaining = DNSREC_LEN - readbuf_remaining; break; } else { /* save header */ - memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], dnsreq, hdrbuf_remaining); + memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], + dnsreq, + hdrbuf_remaining); dnsreq += hdrbuf_remaining; readbuf_remaining -= hdrbuf_remaining; hdrbuf_remaining = 0; @@ -192,7 +196,9 @@ static void process_req(uv_stream_t* handle, } } - /* if we had to use bytes from prev buffer, start processing the current one */ + /* If we had to use bytes from prev buffer, start processing the current + * one. + */ if (usingprev == 1) { /* free previous buffer */ free(dns->state.prevbuf_ptr); diff --git a/test/runner-win.c b/test/runner-win.c index 5d232594..83d76783 100644 --- a/test/runner-win.c +++ b/test/runner-win.c @@ -110,7 +110,9 @@ int process_start(char *name, char *part, process_info_t *p, int is_helper) { if (!SetHandleInformation(nul, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) goto error; - result = GetModuleFileNameW(NULL, (WCHAR*)&image, sizeof(image) / sizeof(WCHAR)); + result = GetModuleFileNameW(NULL, + (WCHAR*) &image, + sizeof(image) / sizeof(WCHAR)); if (result == 0 || result == sizeof(image)) goto error; @@ -214,8 +216,12 @@ int process_copy_output(process_info_t *p, int fd) { char buf[1024]; char *line, *start; - if (SetFilePointer(p->stdio_out, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) + if (SetFilePointer(p->stdio_out, + 0, + 0, + FILE_BEGIN) == INVALID_SET_FILE_POINTER) { return -1; + } if (tap_output) write(fd, "#", 1); @@ -337,8 +343,13 @@ static int clear_line() { if (!SetConsoleCursorPosition(handle, coord)) return -1; - if (!FillConsoleOutputCharacterW(handle, 0x20, info.dwSize.X, coord, &written)) + if (!FillConsoleOutputCharacterW(handle, + 0x20, + info.dwSize.X, + coord, + &written)) { return -1; + } return 0; } diff --git a/test/runner.c b/test/runner.c index d8e9ddeb..f4d982c5 100644 --- a/test/runner.c +++ b/test/runner.c @@ -410,7 +410,8 @@ static int compare_task(const void* va, const void* vb) { } -static int find_helpers(const task_entry_t* task, const task_entry_t** helpers) { +static int find_helpers(const task_entry_t* task, + const task_entry_t** helpers) { const task_entry_t* helper; int n_helpers; diff --git a/test/test-fs.c b/test/test-fs.c index 5e022371..f0ff824f 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -1333,7 +1333,12 @@ TEST_IMPL(fs_symlink) { close(link); - r = uv_fs_symlink(loop, &req, "test_file_symlink", "test_file_symlink_symlink", 0, NULL); + r = uv_fs_symlink(loop, + &req, + "test_file_symlink", + "test_file_symlink_symlink", + 0, + NULL); ASSERT(r == 0); uv_fs_req_cleanup(&req); @@ -1343,7 +1348,12 @@ TEST_IMPL(fs_symlink) { uv_fs_req_cleanup(&req); /* async link */ - r = uv_fs_symlink(loop, &req, "test_file", "test_file_symlink2", 0, symlink_cb); + r = uv_fs_symlink(loop, + &req, + "test_file", + "test_file_symlink2", + 0, + symlink_cb); ASSERT(r == 0); uv_run(loop, UV_RUN_DEFAULT); ASSERT(symlink_cb_count == 1); @@ -1362,7 +1372,12 @@ TEST_IMPL(fs_symlink) { close(link); - r = uv_fs_symlink(loop, &req, "test_file_symlink2", "test_file_symlink2_symlink", 0, NULL); + r = uv_fs_symlink(loop, + &req, + "test_file_symlink2", + "test_file_symlink2_symlink", + 0, + NULL); ASSERT(r == 0); uv_fs_req_cleanup(&req); diff --git a/test/test-get-currentexe.c b/test/test-get-currentexe.c index 8882732e..be578db7 100644 --- a/test/test-get-currentexe.c +++ b/test/test-get-currentexe.c @@ -47,7 +47,9 @@ TEST_IMPL(get_currentexe) { } match = strstr(buffer, path); - /* Verify that the path returned from uv_exepath is a subdirectory of executable_path */ + /* Verify that the path returned from uv_exepath is a subdirectory of + * executable_path. + */ ASSERT(match && !strcmp(match, path)); ASSERT(size == strlen(buffer)); diff --git a/test/test-ping-pong.c b/test/test-ping-pong.c index fb8f5669..6a680ada 100644 --- a/test/test-ping-pong.c +++ b/test/test-ping-pong.c @@ -78,7 +78,11 @@ static void pinger_write_ping(pinger_t* pinger) { buf = uv_buf_init(PING, sizeof(PING) - 1); req = malloc(sizeof(*req)); - if (uv_write(req, (uv_stream_t*)&pinger->stream.tcp, &buf, 1, pinger_after_write)) { + if (uv_write(req, + (uv_stream_t*) &pinger->stream.tcp, + &buf, + 1, + pinger_after_write)) { FATAL("uv_write failed"); } diff --git a/test/test-spawn.c b/test/test-spawn.c index 97d08d52..ca399db4 100644 --- a/test/test-spawn.c +++ b/test/test-spawn.c @@ -113,7 +113,9 @@ static void kill_cb(uv_process_t* process, ASSERT(err == UV_ESRCH); } -static void detach_failure_cb(uv_process_t* process, int64_t exit_status, int term_signal) { +static void detach_failure_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { printf("detach_cb\n"); exit_cb_called++; } @@ -630,7 +632,11 @@ TEST_IMPL(spawn_detect_pipe_name_collisions_on_windows) { options.stdio_count = 2; /* Create a pipe that'll cause a collision. */ - _snprintf(name, sizeof(name), "\\\\.\\pipe\\uv\\%p-%d", &out, GetCurrentProcessId()); + _snprintf(name, + sizeof(name), + "\\\\.\\pipe\\uv\\%p-%d", + &out, + GetCurrentProcessId()); pipe_handle = CreateNamedPipeA(name, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, @@ -729,8 +735,12 @@ TEST_IMPL(argument_escaping) { wprintf(L" verbatim_output: %s\n", verbatim_output); wprintf(L"non_verbatim_output: %s\n", non_verbatim_output); - ASSERT(wcscmp(verbatim_output, L"cmd.exe /c c:\\path\\to\\node.exe --eval \"require('c:\\\\path\\\\to\\\\test.js')\"") == 0); - ASSERT(wcscmp(non_verbatim_output, L"cmd.exe /c \"c:\\path\\to\\node.exe --eval \\\"require('c:\\\\path\\\\to\\\\test.js')\\\"\"") == 0); + ASSERT(wcscmp(verbatim_output, + L"cmd.exe /c c:\\path\\to\\node.exe --eval " + L"\"require('c:\\\\path\\\\to\\\\test.js')\"") == 0); + ASSERT(wcscmp(non_verbatim_output, + L"cmd.exe /c \"c:\\path\\to\\node.exe --eval " + L"\\\"require('c:\\\\path\\\\to\\\\test.js')\\\"\"") == 0); free(verbatim_output); free(non_verbatim_output); @@ -758,17 +768,23 @@ TEST_IMPL(environment_creation) { WCHAR* env; for (i = 0; i < sizeof(environment) / sizeof(environment[0]) - 1; i++) { - ptr += uv_utf8_to_utf16(environment[i], ptr, expected + sizeof(expected) - ptr); + ptr += uv_utf8_to_utf16(environment[i], + ptr, + expected + sizeof(expected) - ptr); } memcpy(ptr, L"SYSTEMROOT=", sizeof(L"SYSTEMROOT=")); ptr += sizeof(L"SYSTEMROOT=")/sizeof(WCHAR) - 1; - ptr += GetEnvironmentVariableW(L"SYSTEMROOT", ptr, expected + sizeof(expected) - ptr); + ptr += GetEnvironmentVariableW(L"SYSTEMROOT", + ptr, + expected + sizeof(expected) - ptr); ++ptr; memcpy(ptr, L"SYSTEMDRIVE=", sizeof(L"SYSTEMDRIVE=")); ptr += sizeof(L"SYSTEMDRIVE=")/sizeof(WCHAR) - 1; - ptr += GetEnvironmentVariableW(L"SYSTEMDRIVE", ptr, expected + sizeof(expected) - ptr); + ptr += GetEnvironmentVariableW(L"SYSTEMDRIVE", + ptr, + expected + sizeof(expected) - ptr); ++ptr; *ptr = '\0'; diff --git a/test/test-tcp-bind-error.c b/test/test-tcp-bind-error.c index 0ceceded..42c01062 100644 --- a/test/test-tcp-bind-error.c +++ b/test/test-tcp-bind-error.c @@ -116,7 +116,8 @@ TEST_IMPL(tcp_bind_error_addrnotavail_2) { TEST_IMPL(tcp_bind_error_fault) { - char garbage[] = "blah blah blah blah blah blah blah blah blah blah blah blah"; + char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; struct sockaddr_in* garbage_addr; uv_tcp_t server; int r; diff --git a/test/test-tcp-bind6-error.c b/test/test-tcp-bind6-error.c index 7eb2f05b..08772190 100644 --- a/test/test-tcp-bind6-error.c +++ b/test/test-tcp-bind6-error.c @@ -92,7 +92,8 @@ TEST_IMPL(tcp_bind6_error_addrnotavail) { TEST_IMPL(tcp_bind6_error_fault) { - char garbage[] = "blah blah blah blah blah blah blah blah blah blah blah blah"; + char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; struct sockaddr_in6* garbage_addr; uv_tcp_t server; int r;