libuv 1.47.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-11-07 17:30:39 +00:00
parent 889773c38d
commit ee9cb63327
226 changed files with 6648 additions and 6444 deletions

View File

@@ -60,7 +60,7 @@ static void close_cb(uv_handle_t* handle) {
static void shutdown_cb(uv_shutdown_t* req, int status) {
ASSERT(status == 0);
ASSERT_OK(status);
ASSERT(nested == 0 && "shutdown_cb must be called from a fresh stack");
shutdown_cb_called++;
@@ -77,7 +77,7 @@ static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
return;
} else if (nread < 0) {
ASSERT(nread == UV_EOF);
ASSERT_EQ(nread, UV_EOF);
nested++;
uv_close((uv_handle_t*)tcp, close_cb);
@@ -105,7 +105,7 @@ static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
static void timer_cb(uv_timer_t* handle) {
ASSERT(handle == &timer);
ASSERT_PTR_EQ(handle, &timer);
ASSERT(nested == 0 && "timer_cb must be called from a fresh stack");
puts("Timeout complete. Now read data...");
@@ -125,7 +125,7 @@ static void timer_cb(uv_timer_t* handle) {
static void write_cb(uv_write_t* req, int status) {
int r;
ASSERT(status == 0);
ASSERT_OK(status);
ASSERT(nested == 0 && "write_cb must be called from a fresh stack");
puts("Data written. 500ms timeout...");
@@ -136,9 +136,9 @@ static void write_cb(uv_write_t* req, int status) {
* for the backend to use dirty stack for calling read_cb. */
nested++;
r = uv_timer_init(uv_default_loop(), &timer);
ASSERT(r == 0);
ASSERT_OK(r);
r = uv_timer_start(&timer, timer_cb, 500, 0);
ASSERT(r == 0);
ASSERT_OK(r);
nested--;
write_cb_called++;
@@ -150,7 +150,7 @@ static void connect_cb(uv_connect_t* req, int status) {
puts("Connected. Write some data to echo server...");
ASSERT(status == 0);
ASSERT_OK(status);
ASSERT(nested == 0 && "connect_cb must be called from a fresh stack");
nested++;
@@ -171,7 +171,7 @@ static void connect_cb(uv_connect_t* req, int status) {
TEST_IMPL(callback_stack) {
struct sockaddr_in addr;
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
if (uv_tcp_init(uv_default_loop(), &client)) {
FATAL("uv_tcp_init failed");
@@ -191,13 +191,18 @@ TEST_IMPL(callback_stack) {
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
ASSERT(nested == 0);
ASSERT(connect_cb_called == 1 && "connect_cb must be called exactly once");
ASSERT(write_cb_called == 1 && "write_cb must be called exactly once");
ASSERT(timer_cb_called == 1 && "timer_cb must be called exactly once");
ASSERT(bytes_received == sizeof MESSAGE);
ASSERT(shutdown_cb_called == 1 && "shutdown_cb must be called exactly once");
ASSERT(close_cb_called == 2 && "close_cb must be called exactly twice");
ASSERT_OK(nested);
ASSERT_NE(connect_cb_called == 1 && \
"connect_cb must be called exactly once", 0);
ASSERT_NE(write_cb_called == 1 && "write_cb must be called exactly once",
0);
ASSERT_NE(timer_cb_called == 1 && "timer_cb must be called exactly once",
0);
ASSERT_EQ(bytes_received, sizeof MESSAGE);
ASSERT_NE(shutdown_cb_called == 1 && \
"shutdown_cb must be called exactly once", 0);
ASSERT_NE(close_cb_called == 2 && "close_cb must be called exactly twice",
0);
MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0;