libuv 1.48.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4828 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		
							
								
								
									
										1
									
								
								deps/libuv/test/run-tests.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								deps/libuv/test/run-tests.c
									
									
									
									
										vendored
									
									
								
							| @@ -25,6 +25,7 @@ | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| # include <io.h> | ||||
| # define read _read | ||||
| #else | ||||
| # include <unistd.h> | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										2
									
								
								deps/libuv/test/runner-win.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								deps/libuv/test/runner-win.c
									
									
									
									
										vendored
									
									
								
							| @@ -310,7 +310,7 @@ static int clear_line(void) { | ||||
|   COORD coord; | ||||
|   DWORD written; | ||||
|  | ||||
|   handle = (HANDLE)_get_osfhandle(fileno(stderr)); | ||||
|   handle = (HANDLE)_get_osfhandle(_fileno(stderr)); | ||||
|   if (handle == INVALID_HANDLE_VALUE) | ||||
|     return -1; | ||||
|  | ||||
|   | ||||
							
								
								
									
										3
									
								
								deps/libuv/test/test-fs-copyfile.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								deps/libuv/test/test-fs-copyfile.c
									
									
									
									
										vendored
									
									
								
							| @@ -74,7 +74,8 @@ static void touch_file(const char* name, unsigned int size) { | ||||
|   int r; | ||||
|   unsigned int i; | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, name, O_WRONLY | O_CREAT | O_TRUNC, | ||||
|   r = uv_fs_open(NULL, &req, name, | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | UV_FS_O_TRUNC, | ||||
|                  S_IWUSR | S_IRUSR, NULL); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|   ASSERT_GE(r, 0); | ||||
|   | ||||
							
								
								
									
										6
									
								
								deps/libuv/test/test-fs-event.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								deps/libuv/test/test-fs-event.c
									
									
									
									
										vendored
									
									
								
							| @@ -80,7 +80,9 @@ static void create_file(const char* name) { | ||||
|   uv_file file; | ||||
|   uv_fs_t req; | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR, NULL); | ||||
|   r = uv_fs_open(NULL, &req, name, UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   file = r; | ||||
|   uv_fs_req_cleanup(&req); | ||||
| @@ -95,7 +97,7 @@ static void touch_file(const char* name) { | ||||
|   uv_fs_t req; | ||||
|   uv_buf_t buf; | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, name, O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, name, UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   file = r; | ||||
|   uv_fs_req_cleanup(&req); | ||||
|   | ||||
							
								
								
									
										4
									
								
								deps/libuv/test/test-fs-readdir.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								deps/libuv/test/test-fs-readdir.c
									
									
									
									
										vendored
									
									
								
							| @@ -359,7 +359,7 @@ TEST_IMPL(fs_readdir_non_empty_dir) { | ||||
|   r = uv_fs_open(uv_default_loop(), | ||||
|                  &create_req, | ||||
|                  "test_dir/file1", | ||||
|                  O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR, | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&create_req); | ||||
| @@ -373,7 +373,7 @@ TEST_IMPL(fs_readdir_non_empty_dir) { | ||||
|   r = uv_fs_open(uv_default_loop(), | ||||
|                  &create_req, | ||||
|                  "test_dir/file2", | ||||
|                  O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR, | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&create_req); | ||||
|   | ||||
							
								
								
									
										183
									
								
								deps/libuv/test/test-fs.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										183
									
								
								deps/libuv/test/test-fs.c
									
									
									
									
										vendored
									
									
								
							| @@ -51,6 +51,9 @@ | ||||
| # ifndef lseek | ||||
| #   define lseek _lseek | ||||
| # endif | ||||
| # define S_IFDIR _S_IFDIR | ||||
| # define S_IFCHR _S_IFCHR | ||||
| # define S_IFREG _S_IFREG | ||||
| #endif | ||||
|  | ||||
| #define TOO_LONG_NAME_LENGTH 65536 | ||||
| @@ -227,7 +230,7 @@ static void realpath_cb(uv_fs_t* req) { | ||||
|   uv_cwd(test_file_abs_buf, &test_file_abs_size); | ||||
| #ifdef _WIN32 | ||||
|   strcat(test_file_abs_buf, "\\test_file"); | ||||
|   ASSERT_OK(stricmp(req->ptr, test_file_abs_buf)); | ||||
|   ASSERT_OK(_stricmp(req->ptr, test_file_abs_buf)); | ||||
| #else | ||||
|   strcat(test_file_abs_buf, "/test_file"); | ||||
|   ASSERT_OK(strcmp(req->ptr, test_file_abs_buf)); | ||||
| @@ -343,7 +346,7 @@ static void statfs_cb(uv_fs_t* req) { | ||||
|   defined(__OpenBSD__) || defined(__NetBSD__) | ||||
|   ASSERT_OK(stats->f_type); | ||||
| #else | ||||
|   ASSERT_GT(stats->f_type, 0); | ||||
|   ASSERT_UINT64_GT(stats->f_type, 0); | ||||
| #endif | ||||
|  | ||||
|   ASSERT_GT(stats->f_bsize, 0); | ||||
| @@ -718,12 +721,13 @@ TEST_IMPL(fs_file_noent) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "does_not_exist", O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "does_not_exist", UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_EQ(r, UV_ENOENT); | ||||
|   ASSERT_EQ(req.result, UV_ENOENT); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, open_noent_cb); | ||||
|   r = uv_fs_open(loop, &req, "does_not_exist", UV_FS_O_RDONLY, 0, | ||||
|                  open_noent_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   ASSERT_OK(open_cb_count); | ||||
| @@ -746,12 +750,12 @@ TEST_IMPL(fs_file_nametoolong) { | ||||
|   memset(name, 'a', TOO_LONG_NAME_LENGTH); | ||||
|   name[TOO_LONG_NAME_LENGTH] = 0; | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, name, O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, name, UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_EQ(r, UV_ENAMETOOLONG); | ||||
|   ASSERT_EQ(req.result, UV_ENAMETOOLONG); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb); | ||||
|   r = uv_fs_open(loop, &req, name, UV_FS_O_RDONLY, 0, open_nametoolong_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   ASSERT_OK(open_cb_count); | ||||
| @@ -786,12 +790,12 @@ TEST_IMPL(fs_file_loop) { | ||||
|   ASSERT_OK(r); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_symlink", O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "test_symlink", UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_EQ(r, UV_ELOOP); | ||||
|   ASSERT_EQ(req.result, UV_ELOOP); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, open_loop_cb); | ||||
|   r = uv_fs_open(loop, &req, "test_symlink", UV_FS_O_RDONLY, 0, open_loop_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   ASSERT_OK(open_cb_count); | ||||
| @@ -918,7 +922,7 @@ TEST_IMPL(fs_file_async) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IRUSR | S_IWUSR, create_cb); | ||||
|   ASSERT_OK(r); | ||||
|   uv_run(loop, UV_RUN_DEFAULT); | ||||
| @@ -938,7 +942,7 @@ TEST_IMPL(fs_file_async) { | ||||
|   ASSERT_EQ(1, close_cb_count); | ||||
|   ASSERT_EQ(1, rename_cb_count); | ||||
|  | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file2", O_RDWR, 0, open_cb); | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file2", UV_FS_O_RDWR, 0, open_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   uv_run(loop, UV_RUN_DEFAULT); | ||||
| @@ -950,7 +954,7 @@ TEST_IMPL(fs_file_async) { | ||||
|   ASSERT_EQ(1, write_cb_count); | ||||
|   ASSERT_EQ(1, ftruncate_cb_count); | ||||
|  | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb); | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file2", UV_FS_O_RDONLY, 0, open_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   uv_run(loop, UV_RUN_DEFAULT); | ||||
| @@ -982,7 +986,8 @@ static void fs_file_sync(int add_flags) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(loop, &open_req1, "test_file", | ||||
|       O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL); | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -998,7 +1003,8 @@ static void fs_file_sync(int add_flags) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR | add_flags, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDWR | add_flags, 0, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -1025,7 +1031,7 @@ static void fs_file_sync(int add_flags) { | ||||
|   ASSERT_OK(rename_req.result); | ||||
|   uv_fs_req_cleanup(&rename_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY | add_flags, 0, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDONLY | add_flags, 0, | ||||
|       NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -1071,7 +1077,8 @@ static void fs_file_write_null_buffer(int add_flags) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", | ||||
|       O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL); | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -1116,7 +1123,8 @@ TEST_IMPL(fs_async_dir) { | ||||
|   ASSERT_EQ(1, mkdir_cb_count); | ||||
|  | ||||
|   /* Create 2 files synchronously. */ | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file1", | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -1124,7 +1132,8 @@ TEST_IMPL(fs_async_dir) { | ||||
|   ASSERT_OK(r); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file2", | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -1193,7 +1202,7 @@ TEST_IMPL(fs_async_dir) { | ||||
| } | ||||
|  | ||||
|  | ||||
| static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) { | ||||
| static int test_sendfile(void (*setup)(int), uv_fs_cb cb, size_t expected_size) { | ||||
|   int f, r; | ||||
|   struct stat s1, s2; | ||||
|   uv_fs_t req; | ||||
| @@ -1205,7 +1214,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) { | ||||
|   unlink("test_file"); | ||||
|   unlink("test_file2"); | ||||
|  | ||||
|   f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR); | ||||
|   f = open("test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, S_IWUSR | S_IRUSR); | ||||
|   ASSERT_NE(f, -1); | ||||
|  | ||||
|   if (setup != NULL) | ||||
| @@ -1215,12 +1224,12 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) { | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   /* Test starts here. */ | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req2, "test_file2", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req2, "test_file2", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req2.result, 0); | ||||
| @@ -1248,7 +1257,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) { | ||||
|  | ||||
|   if (expected_size > 0) { | ||||
|     ASSERT_UINT64_EQ(s1.st_size, s2.st_size + 1); | ||||
|     r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDWR, 0, NULL); | ||||
|     r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDWR, 0, NULL); | ||||
|     ASSERT_GE(r, 0); | ||||
|     ASSERT_GE(open_req1.result, 0); | ||||
|     uv_fs_req_cleanup(&open_req1); | ||||
| @@ -1364,7 +1373,7 @@ TEST_IMPL(fs_mkstemp) { | ||||
|   uv_fs_close(NULL, &req, mkstemp_req2.result, NULL); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   fd = uv_fs_open(NULL, &req, mkstemp_req1.path , O_RDONLY, 0, NULL); | ||||
|   fd = uv_fs_open(NULL, &req, mkstemp_req1.path, UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_GE(fd, 0); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
| @@ -1410,7 +1419,7 @@ TEST_IMPL(fs_fstat) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -1617,7 +1626,7 @@ TEST_IMPL(fs_access) { | ||||
|   access_cb_count = 0; /* reset for the next test */ | ||||
|  | ||||
|   /* Create file */ | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -1678,7 +1687,7 @@ TEST_IMPL(fs_chmod) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -1777,9 +1786,7 @@ TEST_IMPL(fs_unlink_readonly) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &req, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT, | ||||
|                  &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -1836,9 +1843,7 @@ TEST_IMPL(fs_unlink_archive_readonly) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &req, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT, | ||||
|                  &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -1894,7 +1899,7 @@ TEST_IMPL(fs_chown) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -1989,7 +1994,7 @@ TEST_IMPL(fs_link) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -2010,7 +2015,7 @@ TEST_IMPL(fs_link) { | ||||
|   ASSERT_OK(req.result); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file_link", O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "test_file_link", UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   link = req.result; | ||||
| @@ -2031,7 +2036,7 @@ TEST_IMPL(fs_link) { | ||||
|   uv_run(loop, UV_RUN_DEFAULT); | ||||
|   ASSERT_EQ(1, link_cb_count); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file_link2", O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "test_file_link2", UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   link = req.result; | ||||
| @@ -2090,7 +2095,7 @@ TEST_IMPL(fs_readlink) { | ||||
|     /* Setup */ | ||||
|  | ||||
|     /* Create a non-symlink file */ | ||||
|     r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|     r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                    S_IWUSR | S_IRUSR, NULL); | ||||
|     ASSERT_GE(r, 0); | ||||
|     ASSERT_GE(req.result, 0); | ||||
| @@ -2162,7 +2167,7 @@ TEST_IMPL(fs_symlink) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
| @@ -2200,7 +2205,7 @@ TEST_IMPL(fs_symlink) { | ||||
|   ASSERT_OK(req.result); | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file_symlink", O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "test_file_symlink", UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   link = req.result; | ||||
| @@ -2236,7 +2241,7 @@ TEST_IMPL(fs_symlink) { | ||||
|   r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL); | ||||
|   ASSERT_OK(r); | ||||
| #ifdef _WIN32 | ||||
|   ASSERT_OK(stricmp(req.ptr, test_file_abs_buf)); | ||||
|   ASSERT_OK(_stricmp(req.ptr, test_file_abs_buf)); | ||||
| #else | ||||
|   ASSERT_OK(strcmp(req.ptr, test_file_abs_buf)); | ||||
| #endif | ||||
| @@ -2253,7 +2258,7 @@ TEST_IMPL(fs_symlink) { | ||||
|   uv_run(loop, UV_RUN_DEFAULT); | ||||
|   ASSERT_EQ(1, symlink_cb_count); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, "test_file_symlink2", O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, "test_file_symlink2", UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   link = req.result; | ||||
| @@ -2386,13 +2391,14 @@ int test_symlink_dir_impl(int type) { | ||||
|   ASSERT_OK(r); | ||||
| #ifdef _WIN32 | ||||
|   ASSERT_EQ(strlen(req.ptr), test_dir_abs_size - 5); | ||||
|   ASSERT_OK(strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5)); | ||||
|   ASSERT_OK(_strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5)); | ||||
| #else | ||||
|   ASSERT_OK(strcmp(req.ptr, test_dir_abs_buf)); | ||||
| #endif | ||||
|   uv_fs_req_cleanup(&req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file1", | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -2400,7 +2406,8 @@ int test_symlink_dir_impl(int type) { | ||||
|   ASSERT_OK(r); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_dir/file2", | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -2622,7 +2629,9 @@ TEST_IMPL(fs_utime) { | ||||
|   /* Setup. */ | ||||
|   loop = uv_default_loop(); | ||||
|   unlink(path); | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   uv_fs_req_cleanup(&req); | ||||
| @@ -2666,7 +2675,9 @@ TEST_IMPL(fs_utime_round) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|   unlink(path); | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   uv_fs_req_cleanup(&req); | ||||
| @@ -2743,7 +2754,9 @@ TEST_IMPL(fs_futime) { | ||||
|   /* Setup. */ | ||||
|   loop = uv_default_loop(); | ||||
|   unlink(path); | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   uv_fs_req_cleanup(&req); | ||||
| @@ -2751,7 +2764,7 @@ TEST_IMPL(fs_futime) { | ||||
|  | ||||
|   atime = mtime = 400497753.25; /* 1982-09-10 11:22:33.25 */ | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   file = req.result; /* FIXME probably not how it's supposed to be used */ | ||||
| @@ -2803,7 +2816,9 @@ TEST_IMPL(fs_lutime) { | ||||
|   /* Setup */ | ||||
|   loop = uv_default_loop(); | ||||
|   unlink(path); | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   uv_fs_req_cleanup(&req); | ||||
| @@ -2999,7 +3014,7 @@ TEST_IMPL(fs_open_dir) { | ||||
|   path = "."; | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &req, path, O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &req, path, UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(req.result, 0); | ||||
|   ASSERT_NULL(req.ptr); | ||||
| @@ -3009,7 +3024,7 @@ TEST_IMPL(fs_open_dir) { | ||||
|   r = uv_fs_close(NULL, &req, file, NULL); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   r = uv_fs_open(loop, &req, path, O_RDONLY, 0, open_cb_simple); | ||||
|   r = uv_fs_open(loop, &req, path, UV_FS_O_RDONLY, 0, open_cb_simple); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   ASSERT_OK(open_cb_count); | ||||
| @@ -3030,7 +3045,8 @@ static void fs_file_open_append(int add_flags) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", | ||||
|       O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL); | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -3047,7 +3063,7 @@ static void fs_file_open_append(int add_flags) { | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", | ||||
|       O_RDWR | O_APPEND | add_flags, 0, NULL); | ||||
|                  UV_FS_O_RDWR | UV_FS_O_APPEND | add_flags, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -3063,7 +3079,7 @@ static void fs_file_open_append(int add_flags) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, | ||||
|       S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3105,7 +3121,7 @@ TEST_IMPL(fs_rename_to_existing_file) { | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3122,7 +3138,7 @@ TEST_IMPL(fs_rename_to_existing_file) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", O_WRONLY | O_CREAT, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|       S_IWUSR | S_IRUSR, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3138,7 +3154,7 @@ TEST_IMPL(fs_rename_to_existing_file) { | ||||
|   ASSERT_OK(rename_req.result); | ||||
|   uv_fs_req_cleanup(&rename_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -3171,7 +3187,7 @@ static void fs_read_bufs(int add_flags) { | ||||
|  | ||||
|   ASSERT_LE(0, uv_fs_open(NULL, &open_req1, | ||||
|                           "test/fixtures/lorem_ipsum.txt", | ||||
|                           O_RDONLY | add_flags, 0, NULL)); | ||||
|                           UV_FS_O_RDONLY | add_flags, 0, NULL)); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
|  | ||||
| @@ -3235,7 +3251,8 @@ static void fs_read_file_eof(int add_flags) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", | ||||
|       O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL); | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -3251,7 +3268,7 @@ static void fs_read_file_eof(int add_flags) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0, | ||||
|       NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3299,7 +3316,8 @@ static void fs_write_multiple_bufs(int add_flags) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", | ||||
|       O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL); | ||||
|                  UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -3316,7 +3334,7 @@ static void fs_write_multiple_bufs(int add_flags) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0, | ||||
|       NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3405,7 +3423,7 @@ static void fs_write_alotof_bufs(int add_flags) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT | add_flags, | ||||
|                  UV_FS_O_RDWR | UV_FS_O_CREAT | add_flags, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -3439,7 +3457,7 @@ static void fs_write_alotof_bufs(int add_flags) { | ||||
|   ASSERT_OK(close_req.result); | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0, | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0, | ||||
|     NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
| @@ -3518,7 +3536,7 @@ static void fs_write_alotof_bufs_with_offset(int add_flags) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT | add_flags, | ||||
|                  UV_FS_O_RDWR | UV_FS_O_CREAT | add_flags, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -3904,9 +3922,7 @@ TEST_IMPL(get_osfhandle_valid_handle) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT, | ||||
|                  &open_req1, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -3945,7 +3961,7 @@ TEST_IMPL(open_osfhandle_valid_handle) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT, | ||||
|                  UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -3986,9 +4002,7 @@ TEST_IMPL(fs_file_pos_after_op_with_offset) { | ||||
|   loop = uv_default_loop(); | ||||
|  | ||||
|   r = uv_fs_open(loop, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT, | ||||
|                  &open_req1, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GT(r, 0); | ||||
| @@ -4060,7 +4074,7 @@ static void fs_file_pos_close_check(const char *contents, int size) { | ||||
|   uv_fs_req_cleanup(&close_req); | ||||
|  | ||||
|   /* Confirm file contents */ | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY, 0, NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
|   ASSERT_GE(open_req1.result, 0); | ||||
|   uv_fs_req_cleanup(&open_req1); | ||||
| @@ -4088,7 +4102,7 @@ static void fs_file_pos_write(int add_flags) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_TRUNC | O_CREAT | O_RDWR | add_flags, | ||||
|                  UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_RDWR | add_flags, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GT(r, 0); | ||||
| @@ -4126,7 +4140,7 @@ static void fs_file_pos_append(int add_flags) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_APPEND | O_CREAT | O_RDWR | add_flags, | ||||
|                  UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_RDWR | add_flags, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GT(r, 0); | ||||
| @@ -4273,7 +4287,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) { | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req1, | ||||
|                  "test_file", | ||||
|                  O_RDWR | O_CREAT | UV_FS_O_EXLOCK, | ||||
|                  UV_FS_O_RDWR | UV_FS_O_CREAT | UV_FS_O_EXLOCK, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -4282,8 +4296,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) { | ||||
|  | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req2, | ||||
|                  "test_file", | ||||
|                  O_RDONLY | UV_FS_O_EXLOCK, | ||||
|                  "test_file", UV_FS_O_RDONLY | UV_FS_O_EXLOCK, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_LT(r, 0); | ||||
| @@ -4297,8 +4310,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) { | ||||
|  | ||||
|   r = uv_fs_open(NULL, | ||||
|                  &open_req2, | ||||
|                  "test_file", | ||||
|                  O_RDONLY | UV_FS_O_EXLOCK, | ||||
|                  "test_file", UV_FS_O_RDONLY | UV_FS_O_EXLOCK, | ||||
|                  S_IWUSR | S_IRUSR, | ||||
|                  NULL); | ||||
|   ASSERT_GE(r, 0); | ||||
| @@ -4405,7 +4417,7 @@ TEST_IMPL(fs_open_readonly_acl) { | ||||
|     r = uv_fs_open(loop, | ||||
|                    &open_req1, | ||||
|                    "test_file_icacls", | ||||
|                    O_RDONLY | O_CREAT, | ||||
|                    UV_FS_O_RDONLY | UV_FS_O_CREAT, | ||||
|                    S_IRUSR, | ||||
|                    NULL); | ||||
|     ASSERT_GE(r, 0); | ||||
| @@ -4428,7 +4440,8 @@ TEST_IMPL(fs_open_readonly_acl) { | ||||
|     } | ||||
|  | ||||
|     /* Try opening the file */ | ||||
|     r = uv_fs_open(NULL, &open_req1, "test_file_icacls", O_RDONLY, 0, NULL); | ||||
|     r = uv_fs_open(NULL, &open_req1, "test_file_icacls", UV_FS_O_RDONLY, 0, | ||||
|                    NULL); | ||||
|     if (r < 0) { | ||||
|         goto acl_cleanup; | ||||
|     } | ||||
| @@ -4461,9 +4474,7 @@ TEST_IMPL(fs_fchmod_archive_readonly) { | ||||
|     /* Setup*/ | ||||
|     unlink("test_file"); | ||||
|     r = uv_fs_open(NULL, | ||||
|                    &req, | ||||
|                    "test_file", | ||||
|                    O_WRONLY | O_CREAT, | ||||
|                    &req, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|                    S_IWUSR | S_IRUSR, | ||||
|                    NULL); | ||||
|     ASSERT_GE(r, 0); | ||||
| @@ -4478,7 +4489,7 @@ TEST_IMPL(fs_fchmod_archive_readonly) { | ||||
|     ASSERT(r); | ||||
|     check_permission("test_file", 0400); | ||||
|     /* Try fchmod */ | ||||
|     r = uv_fs_open(NULL, &req, "test_file", O_RDONLY, 0, NULL); | ||||
|     r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDONLY, 0, NULL); | ||||
|     ASSERT_GE(r, 0); | ||||
|     ASSERT_GE(req.result, 0); | ||||
|     file = req.result; | ||||
|   | ||||
							
								
								
									
										4
									
								
								deps/libuv/test/test-getters-setters.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								deps/libuv/test/test-getters-setters.c
									
									
									
									
										vendored
									
									
								
							| @@ -24,6 +24,10 @@ | ||||
| #include <string.h> | ||||
| #include <sys/stat.h> | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| # define S_IFDIR _S_IFDIR | ||||
| #endif | ||||
|  | ||||
| int cookie1; | ||||
| int cookie2; | ||||
| int cookie3; | ||||
|   | ||||
							
								
								
									
										7
									
								
								deps/libuv/test/test-idna.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								deps/libuv/test/test-idna.c
									
									
									
									
										vendored
									
									
								
							| @@ -100,6 +100,7 @@ TEST_IMPL(utf8_decode1) { | ||||
| TEST_IMPL(utf8_decode1_overrun) { | ||||
|   const char* p; | ||||
|   char b[1]; | ||||
|   char c[1]; | ||||
|  | ||||
|   /* Single byte. */ | ||||
|   p = b; | ||||
| @@ -113,6 +114,10 @@ TEST_IMPL(utf8_decode1_overrun) { | ||||
|   ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1)); | ||||
|   ASSERT_PTR_EQ(p, b + 1); | ||||
|  | ||||
|   b[0] = 0x7F; | ||||
|   ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 0, c, c + 1)); | ||||
|   ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1)); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| @@ -146,8 +151,8 @@ TEST_IMPL(idna_toascii) { | ||||
|   /* Illegal inputs. */ | ||||
|   F("\xC0\x80\xC1\x80", UV_EINVAL);  /* Overlong UTF-8 sequence. */ | ||||
|   F("\xC0\x80\xC1\x80.com", UV_EINVAL);  /* Overlong UTF-8 sequence. */ | ||||
|   F("", UV_EINVAL); | ||||
|   /* No conversion. */ | ||||
|   T("", ""); | ||||
|   T(".", "."); | ||||
|   T(".com", ".com"); | ||||
|   T("example", "example"); | ||||
|   | ||||
							
								
								
									
										8
									
								
								deps/libuv/test/test-list.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								deps/libuv/test/test-list.h
									
									
									
									
										vendored
									
									
								
							| @@ -227,6 +227,7 @@ TEST_DECLARE   (timer_init) | ||||
| TEST_DECLARE   (timer_again) | ||||
| TEST_DECLARE   (timer_start_twice) | ||||
| TEST_DECLARE   (timer_order) | ||||
| TEST_DECLARE   (timer_zero_timeout) | ||||
| TEST_DECLARE   (timer_huge_timeout) | ||||
| TEST_DECLARE   (timer_huge_repeat) | ||||
| TEST_DECLARE   (timer_run_once) | ||||
| @@ -468,6 +469,7 @@ TEST_DECLARE   (thread_rwlock_trylock) | ||||
| TEST_DECLARE   (thread_create) | ||||
| TEST_DECLARE   (thread_equal) | ||||
| TEST_DECLARE   (thread_affinity) | ||||
| TEST_DECLARE   (thread_priority) | ||||
| TEST_DECLARE   (dlerror) | ||||
| #if (defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))) && \ | ||||
|     !defined(__sun) | ||||
| @@ -505,6 +507,8 @@ TEST_DECLARE   (listen_no_simultaneous_accepts) | ||||
| TEST_DECLARE   (fs_stat_root) | ||||
| TEST_DECLARE   (spawn_with_an_odd_path) | ||||
| TEST_DECLARE   (spawn_no_path) | ||||
| TEST_DECLARE   (spawn_no_ext) | ||||
| TEST_DECLARE   (spawn_path_no_ext) | ||||
| TEST_DECLARE   (ipc_listen_after_bind_twice) | ||||
| TEST_DECLARE   (win32_signum_number) | ||||
| #else | ||||
| @@ -848,6 +852,7 @@ TASK_LIST_START | ||||
|   TEST_ENTRY  (timer_again) | ||||
|   TEST_ENTRY  (timer_start_twice) | ||||
|   TEST_ENTRY  (timer_order) | ||||
|   TEST_ENTRY  (timer_zero_timeout) | ||||
|   TEST_ENTRY  (timer_huge_timeout) | ||||
|   TEST_ENTRY  (timer_huge_repeat) | ||||
|   TEST_ENTRY  (timer_run_once) | ||||
| @@ -1024,6 +1029,8 @@ TASK_LIST_START | ||||
|   TEST_ENTRY  (fs_stat_root) | ||||
|   TEST_ENTRY  (spawn_with_an_odd_path) | ||||
|   TEST_ENTRY  (spawn_no_path) | ||||
|   TEST_ENTRY  (spawn_no_ext) | ||||
|   TEST_ENTRY  (spawn_path_no_ext) | ||||
|   TEST_ENTRY  (ipc_listen_after_bind_twice) | ||||
|   TEST_ENTRY  (win32_signum_number) | ||||
| #else | ||||
| @@ -1165,6 +1172,7 @@ TASK_LIST_START | ||||
|   TEST_ENTRY  (thread_create) | ||||
|   TEST_ENTRY  (thread_equal) | ||||
|   TEST_ENTRY  (thread_affinity) | ||||
|   TEST_ENTRY  (thread_priority) | ||||
|   TEST_ENTRY  (dlerror) | ||||
|   TEST_ENTRY  (ip4_addr) | ||||
|   TEST_ENTRY  (ip6_addr_link_local) | ||||
|   | ||||
							
								
								
									
										6
									
								
								deps/libuv/test/test-metrics.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								deps/libuv/test/test-metrics.c
									
									
									
									
										vendored
									
									
								
							| @@ -217,7 +217,7 @@ static void prepare_cb(uv_prepare_t* handle) { | ||||
|   ASSERT_OK(uv_fs_open(uv_default_loop(), | ||||
|                        &fs_reqs.open_req, | ||||
|                        "test_file", | ||||
|                        O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR, | ||||
|                        UV_FS_O_WRONLY | UV_FS_O_CREAT, S_IRUSR | S_IWUSR, | ||||
|                        create_cb)); | ||||
| } | ||||
|  | ||||
| @@ -329,9 +329,7 @@ TEST_IMPL(metrics_pool_events) { | ||||
|  | ||||
|   pool_events_counter = 0; | ||||
|   fd = uv_fs_open(NULL, | ||||
|                   &open_req, | ||||
|                   "test_file", | ||||
|                   O_WRONLY | O_CREAT, | ||||
|                   &open_req, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, | ||||
|                   S_IRUSR | S_IWUSR, | ||||
|                   NULL); | ||||
|   ASSERT_GT(fd, 0); | ||||
|   | ||||
							
								
								
									
										26
									
								
								deps/libuv/test/test-pipe-bind-error.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								deps/libuv/test/test-pipe-bind-error.c
									
									
									
									
										vendored
									
									
								
							| @@ -33,6 +33,7 @@ | ||||
|  | ||||
|  | ||||
| static int close_cb_called = 0; | ||||
| static int connect_cb_called = 0; | ||||
|  | ||||
|  | ||||
| static void close_cb(uv_handle_t* handle) { | ||||
| @@ -154,13 +155,23 @@ TEST_IMPL(pipe_bind_or_listen_error_after_close) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void connect_overlong_cb(uv_connect_t* connect_req, int status) { | ||||
|   ASSERT_EQ(status, UV_EINVAL); | ||||
|   connect_cb_called++; | ||||
|   uv_close((uv_handle_t*) connect_req->handle, close_cb); | ||||
| } | ||||
|  | ||||
|  | ||||
| TEST_IMPL(pipe_overlong_path) { | ||||
|   char path[512]; | ||||
|   uv_pipe_t pipe; | ||||
|   uv_connect_t req; | ||||
|  | ||||
|   memset(path, '@', sizeof(path)); | ||||
|   ASSERT_OK(uv_pipe_init(uv_default_loop(), &pipe, 0)); | ||||
|  | ||||
| #ifndef _WIN32 | ||||
|   char path[512]; | ||||
|   memset(path, '@', sizeof(path)); | ||||
|   ASSERT_EQ(UV_EINVAL, | ||||
|             uv_pipe_bind2(&pipe, path, sizeof(path), UV_PIPE_NO_TRUNCATE)); | ||||
|   ASSERT_EQ(UV_EINVAL, | ||||
| @@ -170,8 +181,17 @@ TEST_IMPL(pipe_overlong_path) { | ||||
|                              sizeof(path), | ||||
|                              UV_PIPE_NO_TRUNCATE, | ||||
|                              (uv_connect_cb) abort)); | ||||
|   uv_close((uv_handle_t*) &pipe, NULL); | ||||
|   ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT)); | ||||
| #endif | ||||
|  | ||||
|   ASSERT_EQ(UV_EINVAL, uv_pipe_bind(&pipe, "")); | ||||
|   uv_pipe_connect(&req, | ||||
|                   &pipe, | ||||
|                   "", | ||||
|                   (uv_connect_cb) connect_overlong_cb); | ||||
|   ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT)); | ||||
|   ASSERT_EQ(1, connect_cb_called); | ||||
|   ASSERT_EQ(1, close_cb_called); | ||||
|  | ||||
|   MAKE_VALGRIND_HAPPY(uv_default_loop()); | ||||
|   return 0; | ||||
|   | ||||
							
								
								
									
										33
									
								
								deps/libuv/test/test-pipe-getsockname.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								deps/libuv/test/test-pipe-getsockname.c
									
									
									
									
										vendored
									
									
								
							| @@ -60,8 +60,8 @@ static void pipe_client_connect_cb(uv_connect_t* req, int status) { | ||||
|  | ||||
|   if (*buf == '\0') {  /* Linux abstract socket. */ | ||||
|     const char expected[] = "\0" TEST_PIPENAME; | ||||
|     ASSERT_GE(len, sizeof(expected)); | ||||
|     ASSERT_MEM_EQ(buf, expected, sizeof(expected)); | ||||
|     ASSERT_EQ(len, sizeof(expected) - 1); | ||||
|     ASSERT_MEM_EQ(buf, expected, len); | ||||
|   } else { | ||||
|     ASSERT_NE(0, buf[len - 1]); | ||||
|     ASSERT_MEM_EQ(buf, TEST_PIPENAME, len); | ||||
| @@ -91,16 +91,24 @@ TEST_IMPL(pipe_getsockname) { | ||||
|   RETURN_SKIP(NO_SELF_CONNECT); | ||||
| #endif | ||||
|   uv_loop_t* loop; | ||||
|   char namebuf[256]; | ||||
|   char buf[1024]; | ||||
|   size_t namelen; | ||||
|   size_t len; | ||||
|   int r; | ||||
|  | ||||
|   snprintf(namebuf, sizeof(namebuf), "%s-oob", TEST_PIPENAME); | ||||
|   namelen = sizeof(TEST_PIPENAME) - 1; | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|   ASSERT_NOT_NULL(loop); | ||||
|  | ||||
|   r = uv_pipe_init(loop, &pipe_server, 0); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   r = uv_pipe_bind2(&pipe_server, "bad\0path", 8, 0); | ||||
|   ASSERT_EQ(r, UV_EINVAL); | ||||
|  | ||||
|   len = sizeof buf; | ||||
|   r = uv_pipe_getsockname(&pipe_server, buf, &len); | ||||
|   ASSERT_EQ(r, UV_EBADF); | ||||
| @@ -109,9 +117,13 @@ TEST_IMPL(pipe_getsockname) { | ||||
|   r = uv_pipe_getpeername(&pipe_server, buf, &len); | ||||
|   ASSERT_EQ(r, UV_EBADF); | ||||
|  | ||||
|   r = uv_pipe_bind(&pipe_server, TEST_PIPENAME); | ||||
|   r = uv_pipe_bind2(&pipe_server, namebuf, namelen, 0); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
| #ifndef _WIN32 | ||||
|   ASSERT_STR_EQ(pipe_server.pipe_fname, TEST_PIPENAME); | ||||
| #endif | ||||
|  | ||||
|   len = sizeof buf; | ||||
|   r = uv_pipe_getsockname(&pipe_server, buf, &len); | ||||
|   ASSERT_OK(r); | ||||
| @@ -138,7 +150,13 @@ TEST_IMPL(pipe_getsockname) { | ||||
|   r = uv_pipe_getpeername(&pipe_client, buf, &len); | ||||
|   ASSERT_EQ(r, UV_EBADF); | ||||
|  | ||||
|   uv_pipe_connect(&connect_req, &pipe_client, TEST_PIPENAME, pipe_client_connect_cb); | ||||
|   r = uv_pipe_connect2(&connect_req, | ||||
|                        &pipe_client, | ||||
|                        namebuf, | ||||
|                        namelen, | ||||
|                        0, | ||||
|                        pipe_client_connect_cb); | ||||
|   ASSERT_OK(r); | ||||
|  | ||||
|   len = sizeof buf; | ||||
|   r = uv_pipe_getsockname(&pipe_client, buf, &len); | ||||
| @@ -171,9 +189,10 @@ TEST_IMPL(pipe_getsockname_abstract) { | ||||
|   buflen = sizeof(buf); | ||||
|   memset(buf, 0, sizeof(buf)); | ||||
|   ASSERT_OK(uv_pipe_init(uv_default_loop(), &pipe_server, 0)); | ||||
|   ASSERT_OK(uv_pipe_bind2(&pipe_server, name, sizeof(name), 0)); | ||||
|   ASSERT_OK(uv_pipe_bind2(&pipe_server, name, sizeof(name) - 1, 0)); | ||||
|   ASSERT_OK(uv_pipe_getsockname(&pipe_server, buf, &buflen)); | ||||
|   ASSERT_MEM_EQ(name, buf, sizeof(name)); | ||||
|   ASSERT_UINT64_EQ(sizeof(name) - 1, buflen); | ||||
|   ASSERT_MEM_EQ(name, buf, buflen); | ||||
|   ASSERT_OK(uv_listen((uv_stream_t*) &pipe_server, | ||||
|                       0, | ||||
|                       pipe_server_connection_cb)); | ||||
| @@ -181,7 +200,7 @@ TEST_IMPL(pipe_getsockname_abstract) { | ||||
|   ASSERT_OK(uv_pipe_connect2(&connect_req, | ||||
|                              &pipe_client, | ||||
|                              name, | ||||
|                              sizeof(name), | ||||
|                              sizeof(name) - 1, | ||||
|                              0, | ||||
|                              pipe_client_connect_cb)); | ||||
|   ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT)); | ||||
|   | ||||
							
								
								
									
										5
									
								
								deps/libuv/test/test-poll.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								deps/libuv/test/test-poll.c
									
									
									
									
										vendored
									
									
								
							| @@ -23,6 +23,7 @@ | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| # include <fcntl.h> | ||||
| # define close _close | ||||
| #else | ||||
| # include <sys/socket.h> | ||||
| # include <unistd.h> | ||||
| @@ -638,9 +639,9 @@ TEST_IMPL(poll_bad_fdtype) { | ||||
|   int fd; | ||||
|  | ||||
| #if defined(_WIN32) | ||||
|   fd = open("test/fixtures/empty_file", O_RDONLY); | ||||
|   fd = _open("test/fixtures/empty_file", UV_FS_O_RDONLY); | ||||
| #else | ||||
|   fd = open(".", O_RDONLY); | ||||
|   fd = open(".", UV_FS_O_RDONLY); | ||||
| #endif | ||||
|   ASSERT_NE(fd, -1); | ||||
|   ASSERT_NE(0, uv_poll_init(uv_default_loop(), &poll_handle, fd)); | ||||
|   | ||||
							
								
								
									
										70
									
								
								deps/libuv/test/test-spawn.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								deps/libuv/test/test-spawn.c
									
									
									
									
										vendored
									
									
								
							| @@ -32,6 +32,9 @@ | ||||
| # include <shellapi.h> | ||||
| # include <wchar.h> | ||||
|   typedef BOOL (WINAPI *sCompareObjectHandles)(_In_ HANDLE, _In_ HANDLE); | ||||
| # define unlink _unlink | ||||
| # define putenv _putenv | ||||
| # define close _close | ||||
| #else | ||||
| # include <unistd.h> | ||||
| # include <sys/wait.h> | ||||
| @@ -322,7 +325,7 @@ TEST_IMPL(spawn_stdout_to_file) { | ||||
|  | ||||
|   init_process_options("spawn_helper2", exit_cb); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR, | ||||
|   r = uv_fs_open(NULL, &fs_req, "stdout_file", UV_FS_O_CREAT | UV_FS_O_RDWR, | ||||
|       S_IRUSR | S_IWUSR, NULL); | ||||
|   ASSERT_NE(r, -1); | ||||
|   uv_fs_req_cleanup(&fs_req); | ||||
| @@ -376,7 +379,7 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file) { | ||||
|  | ||||
|   init_process_options("spawn_helper6", exit_cb); | ||||
|  | ||||
|   r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR, | ||||
|   r = uv_fs_open(NULL, &fs_req, "stdout_file", UV_FS_O_CREAT | UV_FS_O_RDWR, | ||||
|       S_IRUSR | S_IWUSR, NULL); | ||||
|   ASSERT_NE(r, -1); | ||||
|   uv_fs_req_cleanup(&fs_req); | ||||
| @@ -1394,6 +1397,67 @@ TEST_IMPL(spawn_no_path) { | ||||
|   MAKE_VALGRIND_HAPPY(uv_default_loop()); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| TEST_IMPL(spawn_no_ext) { | ||||
|   char new_exepath[1024]; | ||||
|  | ||||
|   init_process_options("spawn_helper1", exit_cb); | ||||
|   options.flags |= UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME; | ||||
|   snprintf(new_exepath, sizeof(new_exepath), "%.*s_no_ext", | ||||
|            (int) (exepath_size - sizeof(".exe") + 1), | ||||
|            exepath); | ||||
|   options.file = options.args[0] = new_exepath; | ||||
|  | ||||
|   ASSERT_OK(uv_spawn(uv_default_loop(), &process, &options)); | ||||
|   ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT)); | ||||
|  | ||||
|   ASSERT_EQ(1, exit_cb_called); | ||||
|   ASSERT_EQ(1, close_cb_called); | ||||
|  | ||||
|   MAKE_VALGRIND_HAPPY(uv_default_loop()); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| TEST_IMPL(spawn_path_no_ext) { | ||||
|   int r; | ||||
|   int len; | ||||
|   int file_len; | ||||
|   char file[64]; | ||||
|   char path[1024]; | ||||
|   char* env[2]; | ||||
|  | ||||
|   /* Set up the process, but make sure that the file to run is relative and | ||||
|    * requires a lookup into PATH. */ | ||||
|   init_process_options("spawn_helper1", exit_cb); | ||||
|   options.flags |= UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME; | ||||
|  | ||||
|   /* Set up the PATH env variable */ | ||||
|   for (len = strlen(exepath), file_len = 0; | ||||
|        exepath[len - 1] != '/' && exepath[len - 1] != '\\'; | ||||
|        len--, file_len++); | ||||
|   snprintf(file, sizeof(file), "%.*s_no_ext", | ||||
|            (int) (file_len - sizeof(".exe") + 1), | ||||
|            exepath + len); | ||||
|   exepath[len] = 0; | ||||
|   snprintf(path, sizeof(path), "PATH=%s", exepath); | ||||
|  | ||||
|   env[0] = path; | ||||
|   env[1] = NULL; | ||||
|  | ||||
|   options.file = options.args[0] = file; | ||||
|   options.env = env; | ||||
|  | ||||
|   r = uv_spawn(uv_default_loop(), &process, &options); | ||||
|   ASSERT(r == UV_ENOENT || r == UV_EACCES); | ||||
|   ASSERT_OK(uv_is_active((uv_handle_t*) &process)); | ||||
|   uv_close((uv_handle_t*) &process, NULL); | ||||
|   ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT)); | ||||
|  | ||||
|   MAKE_VALGRIND_HAPPY(uv_default_loop()); | ||||
|   return 0; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #ifndef _WIN32 | ||||
| @@ -1621,7 +1685,7 @@ TEST_IMPL(spawn_fs_open) { | ||||
|   const char dev_null[] = "/dev/null"; | ||||
| #endif | ||||
|  | ||||
|   r = uv_fs_open(NULL, &fs_req, dev_null, O_RDWR, 0, NULL); | ||||
|   r = uv_fs_open(NULL, &fs_req, dev_null, UV_FS_O_RDWR, 0, NULL); | ||||
|   ASSERT_NE(r, -1); | ||||
|   fd = uv_get_osfhandle((uv_file) fs_req.result); | ||||
|   uv_fs_req_cleanup(&fs_req); | ||||
|   | ||||
							
								
								
									
										17
									
								
								deps/libuv/test/test-tcp-connect6-error.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								deps/libuv/test/test-tcp-connect6-error.c
									
									
									
									
										vendored
									
									
								
							| @@ -23,6 +23,7 @@ | ||||
| #include "task.h" | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| static int connect_cb_called = 0; | ||||
| @@ -75,9 +76,13 @@ TEST_IMPL(tcp_connect6_error_fault) { | ||||
|  | ||||
|  | ||||
| TEST_IMPL(tcp_connect6_link_local) { | ||||
|   uv_interface_address_t* ifs; | ||||
|   uv_interface_address_t* p; | ||||
|   struct sockaddr_in6 addr; | ||||
|   uv_connect_t req; | ||||
|   uv_tcp_t server; | ||||
|   int ok; | ||||
|   int n; | ||||
|  | ||||
|   if (!can_ipv6()) | ||||
|     RETURN_SKIP("IPv6 not supported"); | ||||
| @@ -90,6 +95,18 @@ TEST_IMPL(tcp_connect6_link_local) { | ||||
|   RETURN_SKIP("Test does not currently work in QEMU"); | ||||
| #endif  /* defined(__QEMU__) */ | ||||
|  | ||||
|   /* Check there's an interface that routes link-local (fe80::/10) traffic. */ | ||||
|   ASSERT_OK(uv_interface_addresses(&ifs, &n)); | ||||
|   for (p = ifs; p < &ifs[n]; p++) | ||||
|     if (p->address.address6.sin6_family == AF_INET6) | ||||
|       if (!memcmp(&p->address.address6.sin6_addr, "\xfe\x80", 2)) | ||||
|         break; | ||||
|   ok = (p < &ifs[n]); | ||||
|   uv_free_interface_addresses(ifs, n); | ||||
|  | ||||
|   if (!ok) | ||||
|     RETURN_SKIP("IPv6 link-local traffic not supported"); | ||||
|  | ||||
|   ASSERT_OK(uv_ip6_addr("fe80::0bad:babe", 1337, &addr)); | ||||
|   ASSERT_OK(uv_tcp_init(uv_default_loop(), &server)); | ||||
|  | ||||
|   | ||||
							
								
								
									
										3
									
								
								deps/libuv/test/test-tcp-write-in-a-row.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								deps/libuv/test/test-tcp-write-in-a-row.c
									
									
									
									
										vendored
									
									
								
							| @@ -114,8 +114,9 @@ static void start_server(void) { | ||||
| TEST_IMPL(tcp_write_in_a_row) { | ||||
| #if defined(_WIN32) | ||||
|   RETURN_SKIP("tcp_write_in_a_row does not work on Windows"); | ||||
| #elif defined(__PASE__) | ||||
|   RETURN_SKIP("tcp_write_in_a_row does not work on IBM i PASE"); | ||||
| #else | ||||
|  | ||||
|   uv_connect_t connect_req; | ||||
|   struct sockaddr_in addr; | ||||
|  | ||||
|   | ||||
							
								
								
									
										5
									
								
								deps/libuv/test/test-tcp-writealot.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								deps/libuv/test/test-tcp-writealot.c
									
									
									
									
										vendored
									
									
								
							| @@ -149,8 +149,9 @@ TEST_IMPL(tcp_writealot) { | ||||
|   uv_tcp_t client; | ||||
|   int r; | ||||
|  | ||||
| #ifdef __TSAN__ | ||||
|   RETURN_SKIP("Test is too slow to run under ThreadSanitizer"); | ||||
| #if defined(__MSAN__) || defined(__TSAN__) | ||||
|   RETURN_SKIP("Test is too slow to run under " | ||||
|               "MemorySanitizer or ThreadSanitizer"); | ||||
| #endif | ||||
|  | ||||
|   ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); | ||||
|   | ||||
							
								
								
									
										105
									
								
								deps/libuv/test/test-thread-priority.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								deps/libuv/test/test-thread-priority.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,105 @@ | ||||
| /* Copyright libuv contributors. All rights reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  * of this software and associated documentation files (the "Software"), to | ||||
|  * deal in the Software without restriction, including without limitation the | ||||
|  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||||
|  * sell copies of the Software, and to permit persons to whom the Software is | ||||
|  * furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||||
|  * IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| #include "uv.h" | ||||
| #include "task.h" | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> /* memset */ | ||||
|  | ||||
| #ifdef __POSIX__ | ||||
| #include <pthread.h> | ||||
| #include <errno.h> | ||||
| #endif | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #include <windows.h> | ||||
| #else | ||||
| #include <unistd.h> | ||||
| #endif | ||||
|  | ||||
| uv_sem_t sem; | ||||
|  | ||||
| static void simple_task(void *args) { | ||||
|   uv_sem_wait(&sem); | ||||
|   printf("in simple_task\n"); | ||||
| } | ||||
|  | ||||
| TEST_IMPL(thread_priority) { | ||||
|   int priority; | ||||
| #ifndef _WIN32 | ||||
|   int min; | ||||
|   int max; | ||||
|   int policy; | ||||
|   struct sched_param param; | ||||
| #endif | ||||
|   uv_thread_t task_id; | ||||
|  | ||||
|   /* Verify that passing a NULL pointer returns UV_EINVAL. */ | ||||
|   ASSERT_EQ(UV_EINVAL, uv_thread_getpriority(0, NULL)); | ||||
|   ASSERT_OK(uv_sem_init(&sem, 1)); | ||||
|   uv_sem_wait(&sem); | ||||
|   ASSERT_OK(uv_thread_create(&task_id, simple_task, NULL)); | ||||
|   ASSERT_OK(uv_thread_getpriority(task_id, &priority)); | ||||
|  | ||||
| #ifdef _WIN32 | ||||
|   ASSERT_EQ(priority, THREAD_PRIORITY_NORMAL); | ||||
| #else | ||||
|   ASSERT_OK(pthread_getschedparam(task_id, &policy, ¶m)); | ||||
| #ifdef __PASE__ | ||||
|   min = 1; | ||||
|   max = 127; | ||||
| #else | ||||
|   min = sched_get_priority_min(policy); | ||||
|   max = sched_get_priority_max(policy); | ||||
| #endif | ||||
|   ASSERT(priority >= min && priority <= max); | ||||
| #endif | ||||
|  | ||||
|   ASSERT_OK(uv_thread_setpriority(task_id, UV_THREAD_PRIORITY_LOWEST)); | ||||
|   ASSERT_OK(uv_thread_getpriority(task_id, &priority)); | ||||
|  | ||||
| #ifdef _WIN32 | ||||
|   ASSERT_EQ(priority, THREAD_PRIORITY_LOWEST); | ||||
| #else | ||||
|   ASSERT_EQ(priority, min); | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * test set nice value for the calling thread with default schedule policy | ||||
| */ | ||||
| #ifdef __linux__ | ||||
|   ASSERT_OK(uv_thread_getpriority(pthread_self(), &priority)); | ||||
|   ASSERT_EQ(priority, 0); | ||||
|   ASSERT_OK(uv_thread_setpriority(pthread_self(), UV_THREAD_PRIORITY_LOWEST)); | ||||
|   ASSERT_OK(uv_thread_getpriority(pthread_self(), &priority)); | ||||
|   ASSERT_EQ(priority, (0 - UV_THREAD_PRIORITY_LOWEST * 2)); | ||||
| #endif | ||||
|  | ||||
|   uv_sem_post(&sem); | ||||
|  | ||||
|   ASSERT_OK(uv_thread_join(&task_id)); | ||||
|  | ||||
|   uv_sem_destroy(&sem); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
							
								
								
									
										4
									
								
								deps/libuv/test/test-threadpool-cancel.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								deps/libuv/test/test-threadpool-cancel.c
									
									
									
									
										vendored
									
									
								
							| @@ -22,6 +22,10 @@ | ||||
| #include "uv.h" | ||||
| #include "task.h" | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| # define putenv _putenv | ||||
| #endif | ||||
|  | ||||
| #define INIT_CANCEL_INFO(ci, what)                                            \ | ||||
|   do {                                                                        \ | ||||
|     (ci)->reqs = (what);                                                      \ | ||||
|   | ||||
							
								
								
									
										26
									
								
								deps/libuv/test/test-timer.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								deps/libuv/test/test-timer.c
									
									
									
									
										vendored
									
									
								
							| @@ -31,6 +31,7 @@ static int repeat_cb_called = 0; | ||||
| static int repeat_close_cb_called = 0; | ||||
| static int order_cb_called = 0; | ||||
| static int timer_check_double_call_called = 0; | ||||
| static int zero_timeout_cb_calls = 0; | ||||
| static uint64_t start_time; | ||||
| static uv_timer_t tiny_timer; | ||||
| static uv_timer_t huge_timer1; | ||||
| @@ -242,6 +243,31 @@ TEST_IMPL(timer_order) { | ||||
| } | ||||
|  | ||||
|  | ||||
| static void zero_timeout_cb(uv_timer_t* handle) { | ||||
|   ASSERT_OK(uv_timer_start(handle, zero_timeout_cb, 0, 0)); | ||||
|   uv_stop(handle->loop); | ||||
|   zero_timeout_cb_calls++; | ||||
| } | ||||
|  | ||||
|  | ||||
| TEST_IMPL(timer_zero_timeout) { | ||||
|   uv_timer_t timer; | ||||
|   uv_loop_t* loop; | ||||
|  | ||||
|   loop = uv_default_loop(); | ||||
|   ASSERT_OK(uv_timer_init(loop, &timer)); | ||||
|   ASSERT_OK(uv_timer_start(&timer, zero_timeout_cb, 0, 0)); | ||||
|   ASSERT_EQ(1, uv_run(loop, UV_RUN_DEFAULT));  /* because of uv_stop() */ | ||||
|   ASSERT_EQ(1, zero_timeout_cb_calls); | ||||
|   uv_close((uv_handle_t*) &timer, NULL); | ||||
|   ASSERT_OK(uv_run(loop, UV_RUN_DEFAULT)); | ||||
|   ASSERT_EQ(1, zero_timeout_cb_calls); | ||||
|  | ||||
|   MAKE_VALGRIND_HAPPY(loop); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void tiny_timer_cb(uv_timer_t* handle) { | ||||
|   ASSERT_PTR_EQ(handle, &tiny_timer); | ||||
|   uv_close((uv_handle_t*) &tiny_timer, NULL); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user