diff options
author | cjihrig <cjihrig@gmail.com> | 2019-05-15 13:24:08 -0400 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2020-03-02 14:52:56 +0000 |
commit | b53ce6e6c587c147ad74d9cf1ec21976dfdd0506 (patch) | |
tree | 76cfeca5f0b23f8a9c43a07e0d17173ee4cd272e /deps/uv/test/test-fs.c | |
parent | ecbb331be0bda5c63f72fe575b3684f00c7164db (diff) | |
download | node-new-b53ce6e6c587c147ad74d9cf1ec21976dfdd0506.tar.gz |
deps: upgrade to libuv 1.29.1
Notable changes:
- uv_get_constrained_memory() has been added.
- A race condition in uv_async_send() has been fixed.
- uv_get_free_memory() and uv_get_total_memory() now read from
/proc/meminfo, which should improve correctness when called
from inside an lxc container.
- A failed assertion in uv_fs_poll_stop() has been fixed.
- A bug in MAC addresses for IP-aliases has been fixed.
Fixes: https://github.com/nodejs/node/issues/27170
Fixes: https://github.com/nodejs/node/issues/27493
PR-URL: https://github.com/nodejs/node/pull/27718
Backport-PR-URL: https://github.com/nodejs/node/pull/31969
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uv/test/test-fs.c')
-rw-r--r-- | deps/uv/test/test-fs.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 35f7d0c3f1..c3153c717b 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -611,6 +611,15 @@ static void sendfile_cb(uv_fs_t* req) { } +static void sendfile_nodata_cb(uv_fs_t* req) { + ASSERT(req == &sendfile_req); + ASSERT(req->fs_type == UV_FS_SENDFILE); + ASSERT(req->result == 0); + sendfile_cb_count++; + uv_fs_req_cleanup(req); +} + + static void open_noent_cb(uv_fs_t* req) { ASSERT(req->fs_type == UV_FS_OPEN); ASSERT(req->result == UV_ENOENT); @@ -1049,7 +1058,7 @@ TEST_IMPL(fs_async_dir) { } -TEST_IMPL(fs_async_sendfile) { +static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) { int f, r; struct stat s1, s2; @@ -1062,14 +1071,8 @@ TEST_IMPL(fs_async_sendfile) { f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR); ASSERT(f != -1); - r = write(f, "begin\n", 6); - ASSERT(r == 6); - - r = lseek(f, 65536, SEEK_CUR); - ASSERT(r == 65542); - - r = write(f, "end\n", 4); - ASSERT(r != -1); + if (setup != NULL) + setup(f); r = close(f); ASSERT(r == 0); @@ -1087,7 +1090,7 @@ TEST_IMPL(fs_async_sendfile) { uv_fs_req_cleanup(&open_req2); r = uv_fs_sendfile(loop, &sendfile_req, open_req2.result, open_req1.result, - 0, 131072, sendfile_cb); + 0, 131072, cb); ASSERT(r == 0); uv_run(loop, UV_RUN_DEFAULT); @@ -1100,9 +1103,10 @@ TEST_IMPL(fs_async_sendfile) { ASSERT(r == 0); uv_fs_req_cleanup(&close_req); - stat("test_file", &s1); - stat("test_file2", &s2); - ASSERT(65546 == s2.st_size && s1.st_size == s2.st_size); + ASSERT(0 == stat("test_file", &s1)); + ASSERT(0 == stat("test_file2", &s2)); + ASSERT(s1.st_size == s2.st_size); + ASSERT(s2.st_size == expected_size); /* Cleanup. */ unlink("test_file"); @@ -1113,6 +1117,23 @@ TEST_IMPL(fs_async_sendfile) { } +static void sendfile_setup(int f) { + ASSERT(6 == write(f, "begin\n", 6)); + ASSERT(65542 == lseek(f, 65536, SEEK_CUR)); + ASSERT(4 == write(f, "end\n", 4)); +} + + +TEST_IMPL(fs_async_sendfile) { + return test_sendfile(sendfile_setup, sendfile_cb, 65546); +} + + +TEST_IMPL(fs_async_sendfile_nodata) { + return test_sendfile(NULL, sendfile_nodata_cb, 0); +} + + TEST_IMPL(fs_mkdtemp) { int r; const char* path_template = "test_dir_XXXXXX"; @@ -1171,6 +1192,7 @@ TEST_IMPL(fs_fstat) { ASSERT(req.result == sizeof(test_buf)); uv_fs_req_cleanup(&req); + memset(&req.statbuf, 0xaa, sizeof(req.statbuf)); r = uv_fs_fstat(NULL, &req, file, NULL); ASSERT(r == 0); ASSERT(req.result == 0); @@ -1257,6 +1279,8 @@ TEST_IMPL(fs_fstat) { s->st_birthtim.tv_sec == t.st_ctim.tv_sec); ASSERT(s->st_birthtim.tv_nsec == 0 || s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec); + ASSERT(s->st_flags == 0); + ASSERT(s->st_gen == 0); #endif uv_fs_req_cleanup(&req); |