test,win: fix -Wunused-function warnings (#4866)

This commit is contained in:
Ben Noordhuis 2025-08-24 20:21:46 +02:00 committed by GitHub
parent 3813460d57
commit 385896c388
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 16 deletions

View File

@ -26,6 +26,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef _WIN32
/*
* Try to connect to an address on which nothing listens, get ECONNREFUSED
* (uv errno 12) and get connect_cb() called once with status != 0.
* Related issue: https://github.com/joyent/libuv/issues/443
*/
TEST_IMPL(tcp_connect_error_after_write) {
RETURN_SKIP("This test is disabled on Windows. "
"See https://github.com/joyent/libuv/issues/444\n");
}
#else /* !_WIN32 */
static int connect_cb_called; static int connect_cb_called;
static int write_cb_called; static int write_cb_called;
static int close_cb_called; static int close_cb_called;
@ -55,11 +66,6 @@ static void write_cb(uv_write_t* req, int status) {
* Related issue: https://github.com/joyent/libuv/issues/443 * Related issue: https://github.com/joyent/libuv/issues/443
*/ */
TEST_IMPL(tcp_connect_error_after_write) { TEST_IMPL(tcp_connect_error_after_write) {
#ifdef _WIN32
RETURN_SKIP("This test is disabled on Windows for now. "
"See https://github.com/joyent/libuv/issues/444\n");
#else
uv_connect_t connect_req; uv_connect_t connect_req;
struct sockaddr_in addr; struct sockaddr_in addr;
uv_write_t write_req; uv_write_t write_req;
@ -94,5 +100,5 @@ TEST_IMPL(tcp_connect_error_after_write) {
MAKE_VALGRIND_HAPPY(uv_default_loop()); MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0; return 0;
#endif
} }
#endif /* !_WIN32 */

View File

@ -22,6 +22,11 @@
#include "uv.h" #include "uv.h"
#include "task.h" #include "task.h"
#ifdef _WIN32
TEST_IMPL(tcp_rst) {
RETURN_SKIP("Unix only test");
}
#else /* !_WIN32 */
static uv_tcp_t tcp; static uv_tcp_t tcp;
static uv_connect_t connect_req; static uv_connect_t connect_req;
static uv_buf_t qbuf; static uv_buf_t qbuf;
@ -76,12 +81,12 @@ static void connect_cb(uv_connect_t *req, int status) {
* RST. Test checks that uv_guess_handle still works on a reset TCP handle. * RST. Test checks that uv_guess_handle still works on a reset TCP handle.
*/ */
TEST_IMPL(tcp_rst) { TEST_IMPL(tcp_rst) {
struct sockaddr_in server_addr;
int r;
#if defined(__OpenBSD__) #if defined(__OpenBSD__)
RETURN_SKIP("Test does not currently work in OpenBSD"); RETURN_SKIP("Test does not currently work in OpenBSD");
#endif #endif
#ifndef _WIN32
struct sockaddr_in server_addr;
int r;
qbuf.base = "QSH"; qbuf.base = "QSH";
qbuf.len = 3; qbuf.len = 3;
@ -104,7 +109,5 @@ TEST_IMPL(tcp_rst) {
MAKE_VALGRIND_HAPPY(uv_default_loop()); MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0; return 0;
#else
RETURN_SKIP("Unix only test");
#endif
} }
#endif /* !_WIN32 */

View File

@ -112,13 +112,14 @@ static void start_server(void) {
} }
TEST_IMPL(tcp_write_in_a_row) { TEST_IMPL(tcp_write_in_a_row) {
uv_connect_t connect_req;
struct sockaddr_in addr;
#if defined(_WIN32) #if defined(_WIN32)
RETURN_SKIP("tcp_write_in_a_row does not work on Windows"); RETURN_SKIP("tcp_write_in_a_row does not work on Windows");
#elif defined(__PASE__) #elif defined(__PASE__)
RETURN_SKIP("tcp_write_in_a_row does not work on IBM i PASE"); RETURN_SKIP("tcp_write_in_a_row does not work on IBM i PASE");
#else #endif
uv_connect_t connect_req;
struct sockaddr_in addr;
start_server(); start_server();
@ -139,5 +140,4 @@ TEST_IMPL(tcp_write_in_a_row) {
MAKE_VALGRIND_HAPPY(uv_default_loop()); MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0; return 0;
#endif
} }