test: test if UV_ELOOP mapping works
This commit is contained in:
parent
3ff3626e52
commit
0596c59bc3
@ -432,6 +432,14 @@ static void open_nametoolong_cb(uv_fs_t* req) {
|
||||
uv_fs_req_cleanup(req);
|
||||
}
|
||||
|
||||
static void open_loop_cb(uv_fs_t* req) {
|
||||
ASSERT(req->fs_type == UV_FS_OPEN);
|
||||
ASSERT(req->errorno == UV_ELOOP);
|
||||
ASSERT(req->result == -1);
|
||||
open_cb_count++;
|
||||
uv_fs_req_cleanup(req);
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_file_noent) {
|
||||
uv_fs_t req;
|
||||
@ -483,6 +491,33 @@ TEST_IMPL(fs_file_nametoolong) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_file_loop) {
|
||||
uv_fs_t req;
|
||||
int r;
|
||||
|
||||
loop = uv_default_loop();
|
||||
|
||||
unlink("test_symlink");
|
||||
symlink("test_symlink", "test_symlink");
|
||||
|
||||
r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, NULL);
|
||||
ASSERT(r == -1);
|
||||
ASSERT(req.result == -1);
|
||||
ASSERT(uv_last_error(loop).code == UV_ELOOP);
|
||||
uv_fs_req_cleanup(&req);
|
||||
|
||||
r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, open_loop_cb);
|
||||
ASSERT(r == 0);
|
||||
|
||||
ASSERT(open_cb_count == 0);
|
||||
uv_run(loop);
|
||||
ASSERT(open_cb_count == 1);
|
||||
|
||||
unlink("test_symlink");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void check_utime(const char* path, double atime, double mtime) {
|
||||
struct stat* s;
|
||||
uv_fs_t req;
|
||||
|
||||
@ -105,6 +105,7 @@ TEST_DECLARE (spawn_and_ping)
|
||||
TEST_DECLARE (kill)
|
||||
TEST_DECLARE (fs_file_noent)
|
||||
TEST_DECLARE (fs_file_nametoolong)
|
||||
TEST_DECLARE (fs_file_loop)
|
||||
TEST_DECLARE (fs_file_async)
|
||||
TEST_DECLARE (fs_file_sync)
|
||||
TEST_DECLARE (fs_async_dir)
|
||||
@ -275,6 +276,7 @@ TASK_LIST_START
|
||||
|
||||
TEST_ENTRY (fs_file_noent)
|
||||
TEST_ENTRY (fs_file_nametoolong)
|
||||
TEST_ENTRY (fs_file_loop)
|
||||
TEST_ENTRY (fs_file_async)
|
||||
TEST_ENTRY (fs_file_sync)
|
||||
TEST_ENTRY (fs_async_dir)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user