• Home
  • Raw
  • Download

Lines Matching +full:qemu +full:- +full:user +full:- +full:static

69 static int dummy_cb_count;
70 static int close_cb_count;
71 static int create_cb_count;
72 static int open_cb_count;
73 static int read_cb_count;
74 static int write_cb_count;
75 static int unlink_cb_count;
76 static int mkdir_cb_count;
77 static int mkdtemp_cb_count;
78 static int mkstemp_cb_count;
79 static int rmdir_cb_count;
80 static int scandir_cb_count;
81 static int stat_cb_count;
82 static int rename_cb_count;
83 static int fsync_cb_count;
84 static int fdatasync_cb_count;
85 static int ftruncate_cb_count;
86 static int sendfile_cb_count;
87 static int fstat_cb_count;
88 static int access_cb_count;
89 static int chmod_cb_count;
90 static int fchmod_cb_count;
91 static int chown_cb_count;
92 static int fchown_cb_count;
93 static int lchown_cb_count;
94 static int link_cb_count;
95 static int symlink_cb_count;
96 static int readlink_cb_count;
97 static int realpath_cb_count;
98 static int utime_cb_count;
99 static int futime_cb_count;
100 static int lutime_cb_count;
101 static int statfs_cb_count;
103 static uv_loop_t* loop;
105 static uv_fs_t open_req1;
106 static uv_fs_t open_req2;
107 static uv_fs_t read_req;
108 static uv_fs_t write_req;
109 static uv_fs_t unlink_req;
110 static uv_fs_t close_req;
111 static uv_fs_t mkdir_req;
112 static uv_fs_t mkdtemp_req1;
113 static uv_fs_t mkdtemp_req2;
114 static uv_fs_t mkstemp_req1;
115 static uv_fs_t mkstemp_req2;
116 static uv_fs_t mkstemp_req3;
117 static uv_fs_t rmdir_req;
118 static uv_fs_t scandir_req;
119 static uv_fs_t stat_req;
120 static uv_fs_t rename_req;
121 static uv_fs_t fsync_req;
122 static uv_fs_t fdatasync_req;
123 static uv_fs_t ftruncate_req;
124 static uv_fs_t sendfile_req;
125 static uv_fs_t utime_req;
126 static uv_fs_t futime_req;
128 static char buf[32];
129 static char buf2[32];
130 static char test_buf[] = "test-buffer\n";
131 static char test_buf2[] = "second-buffer\n";
132 static uv_buf_t iov;
143 static int iovmax = -1; in uv_test_getiovmax()
144 if (iovmax == -1) { in uv_test_getiovmax()
146 /* On some embedded devices (arm-linux-uclibc based ip camera), in uv_test_getiovmax()
148 * value is -1 and the errno is EINPROGRESS. Degrade the value to 1. in uv_test_getiovmax()
150 if (iovmax == -1) iovmax = 1; in uv_test_getiovmax()
164 static unsigned REPARSE_TAG = 0x9913;
165 static GUID REPARSE_GUID = {
170 static void check_permission(const char* filename, unsigned int mode) { in check_permission()
185 ASSERT((s->st_mode & 0777) & mode); in check_permission()
187 ASSERT((s->st_mode & 0777) == mode); in check_permission()
194 static void dummy_cb(uv_fs_t* req) { in dummy_cb()
200 static void link_cb(uv_fs_t* req) { in link_cb()
201 ASSERT_EQ(req->fs_type, UV_FS_LINK); in link_cb()
202 ASSERT_OK(req->result); in link_cb()
208 static void symlink_cb(uv_fs_t* req) { in symlink_cb()
209 ASSERT_EQ(req->fs_type, UV_FS_SYMLINK); in symlink_cb()
210 ASSERT_OK(req->result); in symlink_cb()
215 static void readlink_cb(uv_fs_t* req) { in readlink_cb()
216 ASSERT_EQ(req->fs_type, UV_FS_READLINK); in readlink_cb()
217 ASSERT_OK(req->result); in readlink_cb()
218 ASSERT_OK(strcmp(req->ptr, "test_file_symlink2")); in readlink_cb()
224 static void realpath_cb(uv_fs_t* req) { in realpath_cb()
227 ASSERT_EQ(req->fs_type, UV_FS_REALPATH); in realpath_cb()
228 ASSERT_OK(req->result); in realpath_cb()
233 ASSERT_OK(_stricmp(req->ptr, test_file_abs_buf)); in realpath_cb()
236 ASSERT_OK(strcmp(req->ptr, test_file_abs_buf)); in realpath_cb()
243 static void access_cb(uv_fs_t* req) { in access_cb()
244 ASSERT_EQ(req->fs_type, UV_FS_ACCESS); in access_cb()
250 static void fchmod_cb(uv_fs_t* req) { in fchmod_cb()
251 ASSERT_EQ(req->fs_type, UV_FS_FCHMOD); in fchmod_cb()
252 ASSERT_OK(req->result); in fchmod_cb()
255 check_permission("test_file", *(int*)req->data); in fchmod_cb()
259 static void chmod_cb(uv_fs_t* req) { in chmod_cb()
260 ASSERT_EQ(req->fs_type, UV_FS_CHMOD); in chmod_cb()
261 ASSERT_OK(req->result); in chmod_cb()
264 check_permission("test_file", *(int*)req->data); in chmod_cb()
268 static void fchown_cb(uv_fs_t* req) { in fchown_cb()
269 ASSERT_EQ(req->fs_type, UV_FS_FCHOWN); in fchown_cb()
270 ASSERT_OK(req->result); in fchown_cb()
276 static void chown_cb(uv_fs_t* req) { in chown_cb()
277 ASSERT_EQ(req->fs_type, UV_FS_CHOWN); in chown_cb()
278 ASSERT_OK(req->result); in chown_cb()
283 static void lchown_cb(uv_fs_t* req) { in lchown_cb()
284 ASSERT_EQ(req->fs_type, UV_FS_LCHOWN); in lchown_cb()
285 ASSERT_OK(req->result); in lchown_cb()
290 static void chown_root_cb(uv_fs_t* req) { in chown_root_cb()
291 ASSERT_EQ(req->fs_type, UV_FS_CHOWN); in chown_root_cb()
293 /* On windows, chown is a no-op and always succeeds. */ in chown_root_cb()
294 ASSERT_OK(req->result); in chown_root_cb()
296 /* On unix, chown'ing the root directory is not allowed - in chown_root_cb()
300 ASSERT_OK(req->result); in chown_root_cb()
304 ASSERT_EQ(req->result, UV_EINVAL); in chown_root_cb()
306 /* On IBMi PASE, there is no root user. uid 0 is user qsecofr. in chown_root_cb()
307 * User may grant qsecofr's privileges, including changing in chown_root_cb()
310 ASSERT(req->result == 0 || req->result == UV_EPERM); in chown_root_cb()
312 ASSERT_EQ(req->result, UV_EPERM); in chown_root_cb()
319 static void unlink_cb(uv_fs_t* req) { in unlink_cb()
321 ASSERT_EQ(req->fs_type, UV_FS_UNLINK); in unlink_cb()
322 ASSERT_OK(req->result); in unlink_cb()
327 static void fstat_cb(uv_fs_t* req) { in fstat_cb()
328 uv_stat_t* s = req->ptr; in fstat_cb()
329 ASSERT_EQ(req->fs_type, UV_FS_FSTAT); in fstat_cb()
330 ASSERT_OK(req->result); in fstat_cb()
331 ASSERT_EQ(s->st_size, sizeof(test_buf)); in fstat_cb()
337 static void statfs_cb(uv_fs_t* req) { in statfs_cb()
340 ASSERT_EQ(req->fs_type, UV_FS_STATFS); in statfs_cb()
341 ASSERT_OK(req->result); in statfs_cb()
342 ASSERT_NOT_NULL(req->ptr); in statfs_cb()
343 stats = req->ptr; in statfs_cb()
347 ASSERT_OK(stats->f_type); in statfs_cb()
349 ASSERT_UINT64_GT(stats->f_type, 0); in statfs_cb()
352 ASSERT_GT(stats->f_bsize, 0); in statfs_cb()
353 ASSERT_GT(stats->f_blocks, 0); in statfs_cb()
354 ASSERT_LE(stats->f_bfree, stats->f_blocks); in statfs_cb()
355 ASSERT_LE(stats->f_bavail, stats->f_bfree); in statfs_cb()
358 ASSERT_OK(stats->f_files); in statfs_cb()
359 ASSERT_OK(stats->f_ffree); in statfs_cb()
361 /* There is no assertion for stats->f_files that makes sense, so ignore it. */ in statfs_cb()
362 ASSERT_LE(stats->f_ffree, stats->f_files); in statfs_cb()
365 ASSERT_NULL(req->ptr); in statfs_cb()
370 static void close_cb(uv_fs_t* req) { in close_cb()
373 ASSERT_EQ(req->fs_type, UV_FS_CLOSE); in close_cb()
374 ASSERT_OK(req->result); in close_cb()
384 static void ftruncate_cb(uv_fs_t* req) { in ftruncate_cb()
387 ASSERT_EQ(req->fs_type, UV_FS_FTRUNCATE); in ftruncate_cb()
388 ASSERT_OK(req->result); in ftruncate_cb()
395 static void fail_cb(uv_fs_t* req) { in fail_cb()
399 static void read_cb(uv_fs_t* req) { in read_cb()
402 ASSERT_EQ(req->fs_type, UV_FS_READ); in read_cb()
403 ASSERT_GE(req->result, 0); /* FIXME(bnoordhuis) Check if requested size? */ in read_cb()
411 ASSERT_OK(strcmp(buf, "test-bu")); in read_cb()
418 static void open_cb(uv_fs_t* req) { in open_cb()
421 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in open_cb()
422 if (req->result < 0) { in open_cb()
423 fprintf(stderr, "async open error: %d\n", (int) req->result); in open_cb()
427 ASSERT(req->path); in open_cb()
428 ASSERT_OK(memcmp(req->path, "test_file2\0", 11)); in open_cb()
432 r = uv_fs_read(loop, &read_req, open_req1.result, &iov, 1, -1, in open_cb()
438 static void open_cb_simple(uv_fs_t* req) { in open_cb_simple()
439 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in open_cb_simple()
440 if (req->result < 0) { in open_cb_simple()
441 fprintf(stderr, "async open error: %d\n", (int) req->result); in open_cb_simple()
445 ASSERT(req->path); in open_cb_simple()
450 static void fsync_cb(uv_fs_t* req) { in fsync_cb()
453 ASSERT_EQ(req->fs_type, UV_FS_FSYNC); in fsync_cb()
454 ASSERT_OK(req->result); in fsync_cb()
462 static void fdatasync_cb(uv_fs_t* req) { in fdatasync_cb()
465 ASSERT_EQ(req->fs_type, UV_FS_FDATASYNC); in fdatasync_cb()
466 ASSERT_OK(req->result); in fdatasync_cb()
474 static void write_cb(uv_fs_t* req) { in write_cb()
477 ASSERT_EQ(req->fs_type, UV_FS_WRITE); in write_cb()
478 ASSERT_GE(req->result, 0); /* FIXME(bnoordhuis) Check if requested size? */ in write_cb()
486 static void create_cb(uv_fs_t* req) { in create_cb()
489 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in create_cb()
490 ASSERT_GE(req->result, 0); in create_cb()
494 r = uv_fs_write(loop, &write_req, req->result, &iov, 1, -1, write_cb); in create_cb()
499 static void rename_cb(uv_fs_t* req) { in rename_cb()
501 ASSERT_EQ(req->fs_type, UV_FS_RENAME); in rename_cb()
502 ASSERT_OK(req->result); in rename_cb()
508 static void mkdir_cb(uv_fs_t* req) { in mkdir_cb()
510 ASSERT_EQ(req->fs_type, UV_FS_MKDIR); in mkdir_cb()
511 ASSERT_OK(req->result); in mkdir_cb()
513 ASSERT(req->path); in mkdir_cb()
514 ASSERT_OK(memcmp(req->path, "test_dir\0", 9)); in mkdir_cb()
519 static void check_mkdtemp_result(uv_fs_t* req) { in check_mkdtemp_result()
522 ASSERT_EQ(req->fs_type, UV_FS_MKDTEMP); in check_mkdtemp_result()
523 ASSERT_OK(req->result); in check_mkdtemp_result()
524 ASSERT(req->path); in check_mkdtemp_result()
525 ASSERT_EQ(15, strlen(req->path)); in check_mkdtemp_result()
526 ASSERT_OK(memcmp(req->path, "test_dir_", 9)); in check_mkdtemp_result()
527 ASSERT_NE(0, memcmp(req->path + 9, "XXXXXX", 6)); in check_mkdtemp_result()
528 check_permission(req->path, 0700); in check_mkdtemp_result()
530 /* Check if req->path is actually a directory */ in check_mkdtemp_result()
531 r = uv_fs_stat(NULL, &stat_req, req->path, NULL); in check_mkdtemp_result()
533 ASSERT(((uv_stat_t*)stat_req.ptr)->st_mode & S_IFDIR); in check_mkdtemp_result()
538 static void mkdtemp_cb(uv_fs_t* req) { in mkdtemp_cb()
545 static void check_mkstemp_result(uv_fs_t* req) { in check_mkstemp_result()
548 ASSERT_EQ(req->fs_type, UV_FS_MKSTEMP); in check_mkstemp_result()
549 ASSERT_GE(req->result, 0); in check_mkstemp_result()
550 ASSERT(req->path); in check_mkstemp_result()
551 ASSERT_EQ(16, strlen(req->path)); in check_mkstemp_result()
552 ASSERT_OK(memcmp(req->path, "test_file_", 10)); in check_mkstemp_result()
553 ASSERT_NE(0, memcmp(req->path + 10, "XXXXXX", 6)); in check_mkstemp_result()
554 check_permission(req->path, 0600); in check_mkstemp_result()
556 /* Check if req->path is actually a file */ in check_mkstemp_result()
557 r = uv_fs_stat(NULL, &stat_req, req->path, NULL); in check_mkstemp_result()
564 static void mkstemp_cb(uv_fs_t* req) { in mkstemp_cb()
571 static void rmdir_cb(uv_fs_t* req) { in rmdir_cb()
573 ASSERT_EQ(req->fs_type, UV_FS_RMDIR); in rmdir_cb()
574 ASSERT_OK(req->result); in rmdir_cb()
576 ASSERT(req->path); in rmdir_cb()
577 ASSERT_OK(memcmp(req->path, "test_dir\0", 9)); in rmdir_cb()
582 static void assert_is_file_type(uv_dirent_t dent) { in assert_is_file_type()
590 * http://man7.org/linux/man-pages/man2/getdents.2.html in assert_is_file_type()
604 static void scandir_cb(uv_fs_t* req) { in scandir_cb()
607 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR); in scandir_cb()
608 ASSERT_EQ(2, req->result); in scandir_cb()
609 ASSERT(req->ptr); in scandir_cb()
616 ASSERT(req->path); in scandir_cb()
617 ASSERT_OK(memcmp(req->path, "test_dir\0", 9)); in scandir_cb()
619 ASSERT(!req->ptr); in scandir_cb()
623 static void empty_scandir_cb(uv_fs_t* req) { in empty_scandir_cb()
627 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR); in empty_scandir_cb()
628 ASSERT_OK(req->result); in empty_scandir_cb()
629 ASSERT_NULL(req->ptr); in empty_scandir_cb()
635 static void non_existent_scandir_cb(uv_fs_t* req) { in non_existent_scandir_cb()
639 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR); in non_existent_scandir_cb()
640 ASSERT_EQ(req->result, UV_ENOENT); in non_existent_scandir_cb()
641 ASSERT_NULL(req->ptr); in non_existent_scandir_cb()
648 static void file_scandir_cb(uv_fs_t* req) { in file_scandir_cb()
650 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR); in file_scandir_cb()
651 ASSERT_EQ(req->result, UV_ENOTDIR); in file_scandir_cb()
652 ASSERT_NULL(req->ptr); in file_scandir_cb()
658 static void stat_cb(uv_fs_t* req) { in stat_cb()
660 ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT); in stat_cb()
661 ASSERT_OK(req->result); in stat_cb()
662 ASSERT(req->ptr); in stat_cb()
665 ASSERT(!req->ptr); in stat_cb()
668 static void stat_batch_cb(uv_fs_t* req) { in stat_batch_cb()
669 ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT); in stat_batch_cb()
670 ASSERT_OK(req->result); in stat_batch_cb()
671 ASSERT(req->ptr); in stat_batch_cb()
674 ASSERT(!req->ptr); in stat_batch_cb()
678 static void sendfile_cb(uv_fs_t* req) { in sendfile_cb()
680 ASSERT_EQ(req->fs_type, UV_FS_SENDFILE); in sendfile_cb()
681 ASSERT_EQ(65545, req->result); in sendfile_cb()
687 static void sendfile_nodata_cb(uv_fs_t* req) { in sendfile_nodata_cb()
689 ASSERT_EQ(req->fs_type, UV_FS_SENDFILE); in sendfile_nodata_cb()
690 ASSERT_OK(req->result); in sendfile_nodata_cb()
696 static void open_noent_cb(uv_fs_t* req) { in open_noent_cb()
697 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in open_noent_cb()
698 ASSERT_EQ(req->result, UV_ENOENT); in open_noent_cb()
703 static void open_nametoolong_cb(uv_fs_t* req) { in open_nametoolong_cb()
704 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in open_nametoolong_cb()
705 ASSERT_EQ(req->result, UV_ENAMETOOLONG); in open_nametoolong_cb()
710 static void open_loop_cb(uv_fs_t* req) { in open_loop_cb()
711 ASSERT_EQ(req->fs_type, UV_FS_OPEN); in open_loop_cb()
712 ASSERT_EQ(req->result, UV_ELOOP); in open_loop_cb()
811 static void check_utime(const char* path, in check_utime()
829 if (s->st_atim.tv_nsec == 0 && s->st_mtim.tv_nsec == 0) { in check_utime()
831 * Test sub-second timestamps only when supported (such as Windows with in check_utime()
832 * NTFS). Some other platforms support sub-second timestamps, but that in check_utime()
833 * support is filesystem-dependent. Notably OS X (HFS Plus) does NOT in check_utime()
834 * support sub-second timestamps. But kernels may round or truncate in in check_utime()
842 ASSERT_EQ(s->st_atim.tv_sec, (long) atime); in check_utime()
844 ASSERT_EQ(s->st_mtim.tv_sec, (long) mtime); in check_utime()
845 ASSERT_GE(s->st_atim.tv_sec, (long) atime - 1); in check_utime()
846 ASSERT_GE(s->st_mtim.tv_sec, (long) mtime - 1); in check_utime()
847 ASSERT_LE(s->st_atim.tv_sec, (long) atime); in check_utime()
848 ASSERT_LE(s->st_mtim.tv_sec, (long) mtime); in check_utime()
854 ASSERT_DOUBLE_GE(s->st_atim.tv_nsec, 0); in check_utime()
855 ASSERT_DOUBLE_GE(s->st_mtim.tv_nsec, 0); in check_utime()
857 st_atim = s->st_atim.tv_sec + s->st_atim.tv_nsec / 1e9; in check_utime()
858 st_mtim = s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9; in check_utime()
872 static void utime_cb(uv_fs_t* req) { in utime_cb()
876 ASSERT_OK(req->result); in utime_cb()
877 ASSERT_EQ(req->fs_type, UV_FS_UTIME); in utime_cb()
879 c = req->data; in utime_cb()
880 check_utime(c->path, c->atime, c->mtime, /* test_lutime */ 0); in utime_cb()
887 static void futime_cb(uv_fs_t* req) { in futime_cb()
891 ASSERT_OK(req->result); in futime_cb()
892 ASSERT_EQ(req->fs_type, UV_FS_FUTIME); in futime_cb()
894 c = req->data; in futime_cb()
895 check_utime(c->path, c->atime, c->mtime, /* test_lutime */ 0); in futime_cb()
902 static void lutime_cb(uv_fs_t* req) { in lutime_cb()
905 ASSERT_OK(req->result); in lutime_cb()
906 ASSERT_EQ(req->fs_type, UV_FS_LUTIME); in lutime_cb()
908 c = req->data; in lutime_cb()
909 check_utime(c->path, c->atime, c->mtime, /* test_lutime */ 1); in lutime_cb()
979 static void fs_file_sync(int add_flags) { in fs_file_sync()
996 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_sync()
1013 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_sync()
1042 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_sync()
1045 ASSERT_OK(strcmp(buf, "test-bu")); in fs_file_sync()
1071 static void fs_file_write_null_buffer(int add_flags) { in fs_file_write_null_buffer()
1087 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_write_null_buffer()
1205 static int test_sendfile(void (*setup)(int), uv_fs_cb cb, size_t expected_size) { in test_sendfile()
1218 ASSERT_NE(f, -1); in test_sendfile()
1267 r = uv_fs_read(NULL, &req, open_req1.result, &iov, 1, -1, NULL); in test_sendfile()
1285 static void sendfile_setup(int f) { in sendfile_setup()
1365 r = uv_fs_write(NULL, &req, mkstemp_req1.result, &iov, 1, -1, NULL); in TEST_IMPL()
1382 r = uv_fs_read(NULL, &req, fd, &iov, 1, -1, NULL); in TEST_IMPL()
1411 /* qemu-user-s390x has this weird bug where statx() reports nanoseconds in TEST_IMPL()
1414 RETURN_SKIP("Test does not currently work in QEMU"); in TEST_IMPL()
1436 ASSERT_EQ(s->st_birthtim.tv_sec, t.st_birthtimespec.tv_sec); in TEST_IMPL()
1437 ASSERT_EQ(s->st_birthtim.tv_nsec, t.st_birthtimespec.tv_nsec); in TEST_IMPL()
1442 ASSERT(s->st_birthtim.tv_sec == 0 || in TEST_IMPL()
1443 s->st_birthtim.tv_sec == t.st_ctim.tv_sec); in TEST_IMPL()
1444 ASSERT(s->st_birthtim.tv_nsec == 0 || in TEST_IMPL()
1445 s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec); in TEST_IMPL()
1450 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
1460 ASSERT_EQ(s->st_size, sizeof(test_buf)); in TEST_IMPL()
1466 ASSERT_EQ(s->st_dev, (uint64_t) t.st_dev); in TEST_IMPL()
1467 ASSERT_EQ(s->st_mode, (uint64_t) t.st_mode); in TEST_IMPL()
1468 ASSERT_EQ(s->st_nlink, (uint64_t) t.st_nlink); in TEST_IMPL()
1469 ASSERT_EQ(s->st_uid, (uint64_t) t.st_uid); in TEST_IMPL()
1470 ASSERT_EQ(s->st_gid, (uint64_t) t.st_gid); in TEST_IMPL()
1471 ASSERT_EQ(s->st_rdev, (uint64_t) t.st_rdev); in TEST_IMPL()
1472 ASSERT_EQ(s->st_ino, (uint64_t) t.st_ino); in TEST_IMPL()
1473 ASSERT_EQ(s->st_size, (uint64_t) t.st_size); in TEST_IMPL()
1474 ASSERT_EQ(s->st_blksize, (uint64_t) t.st_blksize); in TEST_IMPL()
1475 ASSERT_EQ(s->st_blocks, (uint64_t) t.st_blocks); in TEST_IMPL()
1477 ASSERT_EQ(s->st_atim.tv_sec, t.st_atimespec.tv_sec); in TEST_IMPL()
1478 ASSERT_EQ(s->st_atim.tv_nsec, t.st_atimespec.tv_nsec); in TEST_IMPL()
1479 ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtimespec.tv_sec); in TEST_IMPL()
1480 ASSERT_EQ(s->st_mtim.tv_nsec, t.st_mtimespec.tv_nsec); in TEST_IMPL()
1481 ASSERT_EQ(s->st_ctim.tv_sec, t.st_ctimespec.tv_sec); in TEST_IMPL()
1482 ASSERT_EQ(s->st_ctim.tv_nsec, t.st_ctimespec.tv_nsec); in TEST_IMPL()
1485 ASSERT_EQ(s->st_atim.tv_sec, t.st_atime); in TEST_IMPL()
1486 ASSERT_OK(s->st_atim.tv_nsec); in TEST_IMPL()
1487 ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtime); in TEST_IMPL()
1488 ASSERT_OK(s->st_mtim.tv_nsec); in TEST_IMPL()
1489 ASSERT_EQ(s->st_ctim.tv_sec, t.st_ctime); in TEST_IMPL()
1490 ASSERT_OK(s->st_ctim.tv_nsec); in TEST_IMPL()
1492 ASSERT_EQ(s->st_atim.tv_sec, t.st_atime); in TEST_IMPL()
1493 ASSERT_EQ(s->st_atim.tv_nsec, t.st_atimensec); in TEST_IMPL()
1494 ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtime); in TEST_IMPL()
1495 ASSERT_EQ(s->st_mtim.tv_nsec, t.st_mtimensec); in TEST_IMPL()
1496 ASSERT_EQ(s->st_ctim.tv_sec, t.st_ctime); in TEST_IMPL()
1497 ASSERT_EQ(s->st_ctim.tv_nsec, t.st_ctimensec); in TEST_IMPL()
1508 ASSERT_EQ(s->st_atim.tv_sec, t.st_atim.tv_sec); in TEST_IMPL()
1509 ASSERT_EQ(s->st_atim.tv_nsec, t.st_atim.tv_nsec); in TEST_IMPL()
1510 ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtim.tv_sec); in TEST_IMPL()
1511 ASSERT_EQ(s->st_mtim.tv_nsec, t.st_mtim.tv_nsec); in TEST_IMPL()
1512 ASSERT_EQ(s->st_ctim.tv_sec, t.st_ctim.tv_sec); in TEST_IMPL()
1513 ASSERT_EQ(s->st_ctim.tv_nsec, t.st_ctim.tv_nsec); in TEST_IMPL()
1516 ASSERT_EQ(s->st_birthtim.tv_sec, t.st_birthtim.tv_sec); in TEST_IMPL()
1517 ASSERT_EQ(s->st_birthtim.tv_nsec, t.st_birthtim.tv_nsec); in TEST_IMPL()
1520 ASSERT_EQ(s->st_atim.tv_sec, t.st_atime); in TEST_IMPL()
1521 ASSERT_OK(s->st_atim.tv_nsec); in TEST_IMPL()
1522 ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtime); in TEST_IMPL()
1523 ASSERT_OK(s->st_mtim.tv_nsec); in TEST_IMPL()
1524 ASSERT_EQ(s->st_ctim.tv_sec, t.st_ctime); in TEST_IMPL()
1525 ASSERT_OK(s->st_ctim.tv_nsec); in TEST_IMPL()
1530 ASSERT_EQ(s->st_flags, t.st_flags); in TEST_IMPL()
1531 ASSERT_EQ(s->st_gen, t.st_gen); in TEST_IMPL()
1533 ASSERT_OK(s->st_flags); in TEST_IMPL()
1534 ASSERT_OK(s->st_gen); in TEST_IMPL()
1585 ASSERT_EQ(st->st_mode, (ft == UV_TTY ? S_IFCHR : S_IFIFO)); in TEST_IMPL()
1586 ASSERT_EQ(1, st->st_nlink); in TEST_IMPL()
1587 ASSERT_EQ(st->st_rdev, in TEST_IMPL()
1698 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
1704 /* Make the file write-only */ in TEST_IMPL()
1713 /* Make the file read-only */ in TEST_IMPL()
1732 static int mode = 0200; in TEST_IMPL()
1744 static int mode = 0400; in TEST_IMPL()
1754 static int mode = 0600; in TEST_IMPL()
1798 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
1805 /* Make the file read-only */ in TEST_IMPL()
1855 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
1862 /* Make the file read-only and clear archive flag */ in TEST_IMPL()
1910 r = uv_fs_chown(NULL, &req, "test_file", -1, -1, NULL); in TEST_IMPL()
1916 r = uv_fs_fchown(NULL, &req, file, -1, -1, NULL); in TEST_IMPL()
1922 r = uv_fs_chown(loop, &req, "test_file", -1, -1, chown_cb); in TEST_IMPL()
1937 r = uv_fs_fchown(loop, &req, file, -1, -1, fchown_cb); in TEST_IMPL()
1951 r = uv_fs_lchown(NULL, &req, "test_file_link", -1, -1, NULL); in TEST_IMPL()
1957 r = uv_fs_lchown(loop, &req, "test_file_link", -1, -1, lchown_cb); in TEST_IMPL()
2005 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
2089 /* Must return UV_EINVAL on a non-symlink file */ in TEST_IMPL()
2097 /* Create a non-symlink file */ in TEST_IMPL()
2178 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); in TEST_IMPL()
2318 static char test_dir_abs_buf[PATHMAX]; in test_symlink_dir_impl()
2321 /* set-up */ in test_symlink_dir_impl()
2360 ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFDIR); in test_symlink_dir_impl()
2368 ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFLNK); in test_symlink_dir_impl()
2370 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen(test_dir + 4)); in test_symlink_dir_impl()
2374 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen("test_dir_symlink")); in test_symlink_dir_impl()
2376 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen(test_dir)); in test_symlink_dir_impl()
2393 ASSERT_EQ(strlen(req.ptr), test_dir_abs_size - 5); in test_symlink_dir_impl()
2394 ASSERT_OK(_strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5)); in test_symlink_dir_impl()
2449 /* clean-up */ in test_symlink_dir_impl()
2476 /* set-up */ in TEST_IMPL()
2531 uv_fs_stat and uv_fs_lstat can only work on non-symlink reparse in TEST_IMPL()
2551 /* uv_fs_scandir incorrectly identifies non-symlink reparse points in TEST_IMPL()
2553 point tag. The PowerShell Get-ChildItem command shares this in TEST_IMPL()
2560 /* clean-up */ in TEST_IMPL()
2640 atime = mtime = 400497753.25; /* 1982-09-10 11:22:33.25 */ in TEST_IMPL()
2649 atime = mtime = 1291404900.25; /* 2010-12-03 20:35:00.25 - mees <3 */ in TEST_IMPL()
2686 atime = mtime = -14245440.25; /* 1969-07-20T02:56:00.25Z */ in TEST_IMPL()
2696 …RETURN_SKIP("utime on some OS (z/OS, IBM i PASE, AIX) or filesystems may reject pre-epoch timestam… in TEST_IMPL()
2765 atime = mtime = 400497753.25; /* 1982-09-10 11:22:33.25 */ in TEST_IMPL()
2785 atime = mtime = 1291404900; /* 2010-12-03 20:35:00 - mees <3 */ in TEST_IMPL()
2844 atime = mtime = 400497753.25; /* 1982-09-10 11:22:33.25 */ in TEST_IMPL()
2862 atime = mtime = 1291404900; /* 2010-12-03 20:35:00 */ in TEST_IMPL()
3039 static void fs_file_open_append(int add_flags) { in fs_file_open_append()
3055 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_open_append()
3072 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_open_append()
3089 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_open_append()
3094 "test-buffer\n\0test-buffer\n\0", in fs_file_open_append()
3095 sizeof("test-buffer\n\0test-buffer\n\0") - 1)); in fs_file_open_append()
3131 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in TEST_IMPL()
3164 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in TEST_IMPL()
3184 static void fs_read_bufs(int add_flags) { in fs_read_bufs()
3223 ASSERT_EQ(read_req.result, /* 446 - 256 */ 190); in fs_read_bufs()
3227 ASSERT_OK(memcmp(bufs[1].base + 128, bufs[3].base, 190 - 128)); in fs_read_bufs()
3242 static void fs_read_file_eof(int add_flags) { in fs_read_file_eof()
3261 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_read_file_eof()
3279 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_read_file_eof()
3309 static void fs_write_multiple_bufs(int add_flags) { in fs_write_multiple_bufs()
3349 r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, -1, NULL); in fs_write_multiple_bufs()
3357 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_write_multiple_bufs()
3404 static void fs_write_alotof_bufs(int add_flags) { in fs_write_alotof_bufs()
3441 -1, in fs_write_alotof_bufs()
3466 r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, -1, NULL); in fs_write_alotof_bufs()
3488 -1, in fs_write_alotof_bufs()
3512 static void fs_write_alotof_bufs_with_offset(int add_flags) { in fs_write_alotof_bufs_with_offset()
3547 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_write_alotof_bufs_with_offset()
3594 ASSERT_EQ((int64_t)((uv_stat_t*)stat_req.ptr)->st_size, in fs_write_alotof_bufs_with_offset()
3703 static void thread_main(void* arg) { in thread_main()
3709 size = ctx->size; in thread_main()
3710 data = ctx->data; in thread_main()
3715 nbytes = size < ctx->interval ? size : ctx->interval; in thread_main()
3716 if (ctx->doread) { in thread_main()
3717 result = write(ctx->fd, data, nbytes); in thread_main()
3721 result = read(ctx->fd, data, nbytes); in thread_main()
3728 pthread_kill(ctx->pid, SIGUSR1); in thread_main()
3729 size -= result; in thread_main()
3734 static void sig_func(uv_signal_t* handle, int signum) { in sig_func()
3738 static size_t uv_test_fs_buf_offset(uv_buf_t* bufs, size_t size) { in uv_test_fs_buf_offset()
3742 size -= bufs[offset].len; in uv_test_fs_buf_offset()
3747 bufs[offset].len -= size; in uv_test_fs_buf_offset()
3752 static void test_fs_partial(int doread) { in test_fs_partial()
3796 result = uv_fs_read(loop, &read_req, pipe_fds[0], read_iovs, iovcount, -1, NULL); in test_fs_partial()
3801 iovcount -= read_iovcount; in test_fs_partial()
3810 result = uv_fs_write(loop, &write_req, pipe_fds[1], iovs, iovcount, -1, NULL); in test_fs_partial()
3827 result = uv_fs_read(loop, &read_req, pipe_fds[0], iovs, 1, -1, NULL); in test_fs_partial()
3855 r = uv_fs_read(NULL, &read_req, 0, NULL, 0, -1, NULL); in TEST_IMPL()
3859 r = uv_fs_write(NULL, &write_req, 0, NULL, 0, -1, NULL); in TEST_IMPL()
3876 r = uv_fs_read(NULL, &read_req, 0, &iov, 0, -1, NULL); in TEST_IMPL()
3881 r = uv_fs_write(NULL, &write_req, 0, &iov, 0, -1, NULL); in TEST_IMPL()
3888 r = uv_fs_read(loop, &read_req, 0, NULL, 0, -1, fail_cb); in TEST_IMPL()
3893 r = uv_fs_write(loop, &write_req, 0, NULL, 0, -1, fail_cb); in TEST_IMPL()
3899 r = uv_fs_read(loop, &read_req, 0, &iov, 0, -1, fail_cb); in TEST_IMPL()
3905 r = uv_fs_write(loop, &write_req, 0, &iov, 0, -1, fail_cb); in TEST_IMPL()
4036 static void fs_file_pos_common(void) { in fs_file_pos_common()
4040 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_common()
4052 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_common()
4058 r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_common()
4063 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_common()
4068 static void fs_file_pos_close_check(const char *contents, int size) { in fs_file_pos_close_check()
4083 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_close_check()
4096 static void fs_file_pos_write(int add_flags) { in fs_file_pos_write()
4120 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_write()
4134 static void fs_file_pos_append(int add_flags) { in fs_file_pos_append()
4159 r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); in fs_file_pos_append()
4185 r = uv_fs_read(NULL, NULL, 0, NULL, 0, -1, NULL); in TEST_IMPL()
4188 r = uv_fs_write(NULL, NULL, 0, NULL, 0, -1, NULL); in TEST_IMPL()
4272 /* This should be a no-op. */ in TEST_IMPL()
4403 attrib -r test_file_icacls in TEST_IMPL()
4407 /* Setup - clear the ACL and remove the file */ in TEST_IMPL()
4472 /* Test clearing read-only flag from files with Archive flag cleared */ in TEST_IMPL()
4487 /* Make the file read-only and clear archive flag */ in TEST_IMPL()
4598 static char test_file_buf[PATHMAX]; in TEST_IMPL()
4600 /* set-up */ in TEST_IMPL()
4635 /* clean-up */ in TEST_IMPL()