mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-05 07:16:37 +00:00
Update libuv
This commit is contained in:
+85
-12
@@ -29,7 +29,7 @@
|
||||
|
||||
/* FIXME we shouldn't need to branch in this file */
|
||||
#if defined(__unix__) || defined(__POSIX__) || \
|
||||
defined(__APPLE__) || defined(_AIX)
|
||||
defined(__APPLE__) || defined(_AIX) || defined(__MVS__)
|
||||
#include <unistd.h> /* unlink, rmdir, etc. */
|
||||
#else
|
||||
# include <direct.h>
|
||||
@@ -510,6 +510,18 @@ static void empty_scandir_cb(uv_fs_t* req) {
|
||||
scandir_cb_count++;
|
||||
}
|
||||
|
||||
static void non_existent_scandir_cb(uv_fs_t* req) {
|
||||
uv_dirent_t dent;
|
||||
|
||||
ASSERT(req == &scandir_req);
|
||||
ASSERT(req->fs_type == UV_FS_SCANDIR);
|
||||
ASSERT(req->result == UV_ENOENT);
|
||||
ASSERT(req->ptr == NULL);
|
||||
ASSERT(UV_ENOENT == uv_fs_scandir_next(req, &dent));
|
||||
uv_fs_req_cleanup(req);
|
||||
scandir_cb_count++;
|
||||
}
|
||||
|
||||
|
||||
static void file_scandir_cb(uv_fs_t* req) {
|
||||
ASSERT(req == &scandir_req);
|
||||
@@ -662,8 +674,8 @@ static void check_utime(const char* path, double atime, double mtime) {
|
||||
ASSERT(req.result == 0);
|
||||
s = &req.statbuf;
|
||||
|
||||
ASSERT(s->st_atim.tv_sec == atime);
|
||||
ASSERT(s->st_mtim.tv_sec == mtime);
|
||||
ASSERT(s->st_atim.tv_sec + (s->st_atim.tv_nsec / 1000000000.0) == atime);
|
||||
ASSERT(s->st_mtim.tv_sec + (s->st_mtim.tv_nsec / 1000000000.0) == mtime);
|
||||
|
||||
uv_fs_req_cleanup(&req);
|
||||
}
|
||||
@@ -1134,10 +1146,22 @@ TEST_IMPL(fs_fstat) {
|
||||
ASSERT(s->st_mtim.tv_nsec == 0);
|
||||
ASSERT(s->st_ctim.tv_sec == t.st_ctime);
|
||||
ASSERT(s->st_ctim.tv_nsec == 0);
|
||||
#elif defined(__sun) || \
|
||||
defined(_BSD_SOURCE) || \
|
||||
defined(_SVID_SOURCE) || \
|
||||
defined(_XOPEN_SOURCE) || \
|
||||
#elif defined(__ANDROID__)
|
||||
ASSERT(s->st_atim.tv_sec == t.st_atime);
|
||||
ASSERT(s->st_atim.tv_nsec == t.st_atimensec);
|
||||
ASSERT(s->st_mtim.tv_sec == t.st_mtime);
|
||||
ASSERT(s->st_mtim.tv_nsec == t.st_mtimensec);
|
||||
ASSERT(s->st_ctim.tv_sec == t.st_ctime);
|
||||
ASSERT(s->st_ctim.tv_nsec == t.st_ctimensec);
|
||||
#elif defined(__sun) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(_GNU_SOURCE) || \
|
||||
defined(_BSD_SOURCE) || \
|
||||
defined(_SVID_SOURCE) || \
|
||||
defined(_XOPEN_SOURCE) || \
|
||||
defined(_DEFAULT_SOURCE)
|
||||
ASSERT(s->st_atim.tv_sec == t.st_atim.tv_sec);
|
||||
ASSERT(s->st_atim.tv_nsec == t.st_atim.tv_nsec);
|
||||
@@ -1145,10 +1169,8 @@ TEST_IMPL(fs_fstat) {
|
||||
ASSERT(s->st_mtim.tv_nsec == t.st_mtim.tv_nsec);
|
||||
ASSERT(s->st_ctim.tv_sec == t.st_ctim.tv_sec);
|
||||
ASSERT(s->st_ctim.tv_nsec == t.st_ctim.tv_nsec);
|
||||
# if defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
ASSERT(s->st_birthtim.tv_sec == t.st_birthtim.tv_sec);
|
||||
ASSERT(s->st_birthtim.tv_nsec == t.st_birthtim.tv_nsec);
|
||||
ASSERT(s->st_flags == t.st_flags);
|
||||
@@ -1968,6 +1990,15 @@ TEST_IMPL(fs_utime) {
|
||||
|
||||
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
|
||||
|
||||
/*
|
||||
* Test sub-second timestamps only on Windows (assuming NTFS). Some other
|
||||
* platforms support sub-second timestamps, but that support is filesystem-
|
||||
* dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
mtime += 0.444; /* 1982-09-10 11:22:33.444 */
|
||||
#endif
|
||||
|
||||
r = uv_fs_utime(NULL, &req, path, atime, mtime, NULL);
|
||||
ASSERT(r == 0);
|
||||
ASSERT(req.result == 0);
|
||||
@@ -2055,6 +2086,15 @@ TEST_IMPL(fs_futime) {
|
||||
|
||||
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
|
||||
|
||||
/*
|
||||
* Test sub-second timestamps only on Windows (assuming NTFS). Some other
|
||||
* platforms support sub-second timestamps, but that support is filesystem-
|
||||
* dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
mtime += 0.444; /* 1982-09-10 11:22:33.444 */
|
||||
#endif
|
||||
|
||||
r = uv_fs_open(NULL, &req, path, O_RDWR, 0, NULL);
|
||||
ASSERT(r >= 0);
|
||||
ASSERT(req.result >= 0);
|
||||
@@ -2147,6 +2187,39 @@ TEST_IMPL(fs_scandir_empty_dir) {
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_scandir_non_existent_dir) {
|
||||
const char* path;
|
||||
uv_fs_t req;
|
||||
uv_dirent_t dent;
|
||||
int r;
|
||||
|
||||
path = "./non_existent_dir/";
|
||||
loop = uv_default_loop();
|
||||
|
||||
uv_fs_rmdir(NULL, &req, path, NULL);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
/* Fill the req to ensure that required fields are cleaned up */
|
||||
memset(&req, 0xdb, sizeof(req));
|
||||
|
||||
r = uv_fs_scandir(NULL, &req, path, 0, NULL);
|
||||
ASSERT(r == UV_ENOENT);
|
||||
ASSERT(req.result == UV_ENOENT);
|
||||
ASSERT(req.ptr == NULL);
|
||||
ASSERT(UV_ENOENT == uv_fs_scandir_next(&req, &dent));
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
r = uv_fs_scandir(loop, &scandir_req, path, 0, non_existent_scandir_cb);
|
||||
ASSERT(r == 0);
|
||||
|
||||
ASSERT(scandir_cb_count == 0);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(scandir_cb_count == 1);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_scandir_file) {
|
||||
const char* path;
|
||||
int r;
|
||||
@@ -2605,7 +2678,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
|
||||
r = uv_fs_read(NULL, &read_req, open_req1.result,
|
||||
iovs, iovcount, offset, NULL);
|
||||
ASSERT(r >= 0);
|
||||
ASSERT(read_req.result == sizeof(test_buf) * iovcount);
|
||||
ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount);
|
||||
|
||||
for (index = 0; index < iovcount; ++index)
|
||||
ASSERT(strncmp(buffer + index * sizeof(test_buf),
|
||||
|
||||
Reference in New Issue
Block a user