Skip to content

Instantly share code, notes, and snippets.

@anarazel
Created October 19, 2022 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anarazel/680b2d264fe6c02d6372fa4161f2ae8c to your computer and use it in GitHub Desktop.
Save anarazel/680b2d264fe6c02d6372fa4161f2ae8c to your computer and use it in GitHub Desktop.
ok 1 - traditional Windows unlink semantics detected: O_EXCL -> EEXIST
ok 2 - symlink fails on missing parent
ok 3 - errno == ENOENT
could not set junction for "\??\y:\testdata\dir1\my_subdir": Access is denied.
not ok 4 - create symlink (at ../src/port/t/001_filesystem.c:204), error: Permission denied
not ok 5 - readlink succeeds (at ../src/port/t/001_filesystem.c:207), error: No such file or directory
not ok 6 - readlink reports expected size: -1 != 26 (at ../src/port/t/001_filesystem.c:208)
not ok 7 - readlink reports expected target: "y:\testdata\dir1\my_subdir" vs "" (at ../src/port/t/001_filesystem.c:214)
ok 8 - readlink fails on missing path
ok 9 - errno == ENOENT
could not set junction for "\??\c:\foo": Access is denied.
not ok 10 - symlink("c:\\foo", path2) == 0 (at ../src/port/t/001_filesystem.c:230), error: Permission denied
not ok 11 - readlink succeeds (at ../src/port/t/001_filesystem.c:232), error: No such file or directory
not ok 12 - size == 6: -1 != 6 (at ../src/port/t/001_filesystem.c:233)
not ok 13 - path3 matches "c:\\foo": "" vs "c:\foo" (at ../src/port/t/001_filesystem.c:235)
not ok 14 - unlink(path2) == 0 (at ../src/port/t/001_filesystem.c:236), error: No such file or directory
could not set junction for "\??\c:\foo": Access is denied.
not ok 15 - symlink("\\??\\c:\\foo", path2) == 0 (at ../src/port/t/001_filesystem.c:243), error: Permission denied
not ok 16 - readlink succeeds (at ../src/port/t/001_filesystem.c:245), error: No such file or directory
not ok 17 - size == 6: -1 != 6 (at ../src/port/t/001_filesystem.c:248)
not ok 18 - path3 matches "c:\\foo": "" vs "c:\foo" (at ../src/port/t/001_filesystem.c:249)
not ok 19 - unlink(path2) == 0 (at ../src/port/t/001_filesystem.c:254), error: No such file or directory
could not set junction for "\??\Volume1234": Access is denied.
not ok 20 - symlink("\\??\\Volume1234", path2) == 0 (at ../src/port/t/001_filesystem.c:262), error: Permission denied
not ok 21 - readlink succeeds (at ../src/port/t/001_filesystem.c:264), error: No such file or directory
not ok 22 - size == 14: -1 != 14 (at ../src/port/t/001_filesystem.c:265)
not ok 23 - path3 matches "\\??\\Volume1234": "" vs "\??\Volume1234" (at ../src/port/t/001_filesystem.c:267)
not ok 24 - unlink(path2) == 0 (at ../src/port/t/001_filesystem.c:268), error: No such file or directory
ok 25 - fstat regular file
ok 26 - S_ISREG(statbuf.st_mode)
ok 27 - statbuf.st_size == 12
ok 28 - statbuf.st_nlink == 1
ok 29 - stat missing file fails
ok 30 - errno == ENOENT
ok 31 - stat regular file
ok 32 - S_ISREG(statbuf.st_mode)
ok 33 - statbuf.st_size == 12
ok 34 - statbuf.st_nlink == 1
ok 35 - stat directory
ok 36 - S_ISDIR(statbuf.st_mode)
not ok 37 - stat symlink (at ../src/port/t/001_filesystem.c:301)
not ok 38 - S_ISDIR(statbuf.st_mode) (at ../src/port/t/001_filesystem.c:302)
could not set junction for "\??\y:\testdata\dir1": Access is denied.
not ok 39 - sym001 -> dir1 (at ../src/port/t/001_filesystem.c:307), error: Permission denied
could not set junction for "\??\y:\testdata\sym001": Access is denied.
not ok 40 - sym002 -> sym001 (at ../src/port/t/001_filesystem.c:310), error: Permission denied
could not set junction for "\??\y:\testdata\sym002": Access is denied.
not ok 41 - sym003 -> sym002 (at ../src/port/t/001_filesystem.c:313), error: Permission denied
could not set junction for "\??\y:\testdata\sym003": Access is denied.
not ok 42 - sym004 -> sym003 (at ../src/port/t/001_filesystem.c:316), error: Permission denied
could not set junction for "\??\y:\testdata\sym004": Access is denied.
not ok 43 - sym005 -> sym004 (at ../src/port/t/001_filesystem.c:319), error: Permission denied
could not set junction for "\??\y:\testdata\sym005": Access is denied.
not ok 44 - sym006 -> sym005 (at ../src/port/t/001_filesystem.c:322), error: Permission denied
could not set junction for "\??\y:\testdata\sym006": Access is denied.
not ok 45 - sym007 -> sym006 (at ../src/port/t/001_filesystem.c:325), error: Permission denied
could not set junction for "\??\y:\testdata\sym007": Access is denied.
not ok 46 - sym008 -> sym007 (at ../src/port/t/001_filesystem.c:328), error: Permission denied
could not set junction for "\??\y:\testdata\sym008": Access is denied.
not ok 47 - sym009 -> sym008 (at ../src/port/t/001_filesystem.c:331), error: Permission denied
not ok 48 - stat sym008 (at ../src/port/t/001_filesystem.c:336), error: No such file or directory
not ok 49 - S_ISDIR(statbuf.st_mode) (at ../src/port/t/001_filesystem.c:337)
ok 50 - Windows: stat sym009 fails
not ok 51 - errno == ELOOP: 2 != 114 (at ../src/port/t/001_filesystem.c:348)
not ok 52 - unlink(path) == 0 (at ../src/port/t/001_filesystem.c:353), error: No such file or directory
ok 53 - stat broken symlink chain fails
ok 54 - errno == ENOENT
ok 55 - lstat missing file fails
ok 56 - errno == ENOENT
ok 57 - lstat regular file
ok 58 - S_ISREG(statbuf.st_mode)
ok 59 - statbuf.st_size == 12
ok 60 - statbuf.st_nlink == 1
ok 61 - lstat directory
ok 62 - S_ISDIR(statbuf.st_mode)
not ok 63 - lstat symlink (at ../src/port/t/001_filesystem.c:378)
not ok 64 - S_ISLNK(statbuf.st_mode) (at ../src/port/t/001_filesystem.c:379)
not ok 65 - got expected symlink size: 0 != 26 (at ../src/port/t/001_filesystem.c:380)
could not set junction for "\??\y:\testdata\does-not-exist": Access is denied.
not ok 66 - make a broken symlink (at ../src/port/t/001_filesystem.c:384), error: Permission denied
not ok 67 - lstat broken symlink (at ../src/port/t/001_filesystem.c:385), error: No such file or directory
not ok 68 - S_ISLNK(statbuf.st_mode) (at ../src/port/t/001_filesystem.c:386)
not ok 69 - unlink(path) == 0 (at ../src/port/t/001_filesystem.c:387), error: No such file or directory
ok 70 - link missing file fails
ok 71 - errno == ENOENT
ok 72 - link succeeds
ok 73 - lstat link 1 succeeds
ok 74 - S_ISREG(statbuf.st_mode)
ok 75 - statbuf.st_size == 12
ok 76 - statbuf.st_nlink == 2
ok 77 - lstat link 2 succeeds
ok 78 - S_ISREG(statbuf.st_mode)
ok 79 - statbuf.st_size == 12
ok 80 - statbuf.st_nlink == 2
ok 81 - unlink succeeds
ok 82 - lstat link 1 succeeds
ok 83 - S_ISREG(statbuf.st_mode)
ok 84 - statbuf.st_size == 12
ok 85 - statbuf.st_nlink == 1
ok 86 - lstat link 2 fails
ok 87 - errno == ENOENT
could not set junction for "\??\y:\testdata\dir1": Access is denied.
not ok 88 - create symlink (at ../src/port/t/001_filesystem.c:427), error: Permission denied
not ok 89 - unlink symlink (at ../src/port/t/001_filesystem.c:428), error: No such file or directory
ok 90 - Windows: can't unlink() a directory
ok 91 - errno == EPERM
ok 92 - touch name1.txt
ok 93 - Windows: can't unlink file while non-shared handle exists
ok 94 - errno == EACCES
ok 95 - Windows: can rename file after non-shared handle asynchronously closed
ok 96 - mkdir(path, 0777) == 0
ok 97 - open dir2/test-file
ok 98 - unlink file while it's open, once
ok 99 - can't unlink again
ok 100 - Windows non-POSIX: we expect EACCES (delete already pending)
ok 101 - Windows non-POSIX: trying again fails
ok 102 - Windows non-POSIX: ... but blocked until ENOENT was reached due to asynchronous close
ok 103 - now we can remove the directory
ok 104 - touch name1.txt
ok 105 - rename name1.txt -> name2.txt
ok 106 - can't open name1.txt anymore
ok 107 - errno == ENOENT
ok 108 - touch name1.txt
ok 109 - rename name1.txt -> name2.txt, replacing it
ok 110 - touch name1.txt
ok 111 - open name2.txt
ok 112 - Windows non-POSIX: can't rename name1.txt -> name2.txt while name2.txt is open
ok 113 - errno == EACCES
ok 114 - unlink name1.txt
ok 115 - touch name1.txt
ok 116 - can rename name1.txt -> name2.txt while name1.txt is open
ok 117 - touch name1.txt
ok 118 - open name2.txt
ok 119 - unlink name2.txt while it is still open
ok 120 - Windows non-POSIX: cannot rename name1.txt -> name2.txt while unlinked file is still open
ok 121 - errno == EACCES
ok 122 - unlink(path) == 0
ok 123 - touch name1.txt
ok 124 - Windows: can't rename file while non-shared handle exists for name1
ok 125 - errno == EACCES
ok 126 - Windows: can rename file after non-shared handle asynchronously closed
ok 127 - touch name1.txt
ok 128 - Windows: can't rename file while non-shared handle exists for name2
ok 129 - errno == EACCES
ok 130 - Windows: can rename file after non-shared handle asynchronously closed
ok 131 - open(O_CREAT | O_EXCL) succeeds
ok 132 - open(O_CREAT | O_EXCL) again fails
ok 133 - errno == EEXIST
ok 134 - open(O_CREAT) succeeds
ok 135 - unlink(path) == 0
ok 136 - open(path, O_RDWR | PG_BINARY, 0777) == -1
ok 137 - errno == ENOENT
ok 138 - Windows non-POSIX: cannot create file with same name, while unlinked file is still open
ok 139 - errno == EEXIST
ok 140 - can create a file with recently unlinked name after closing
ok 141 - Windows: can't open file while non-shared handle exists
ok 142 - errno == EACCES
ok 143 - Windows: can open file after non-shared handle asynchronously closed
ok 144 - unlink(path) == 0
ok 145 - open missing directory fails
ok 146 - errno == ENOENT
ok 147 - open directory
ok 148 - ran out of dirents without error
ok 149 - . was found
ok 150 - . has type DT_UNKNOWN or DT_DIR
ok 151 - .. was found
ok 152 - .. has type DT_UNKNOWN or DT_DIR
ok 153 - my_subdir was found
ok 154 - my_subdir has type DT_UNKNOWN or DT_DIR
not ok 155 - my_symlink was found (at ../src/port/t/001_filesystem.c:773)
not ok 156 - my_symlink has type DT_UNKNOWN or DT_LNK (at ../src/port/t/001_filesystem.c:773)
ok 157 - test.txt was found
ok 158 - test.txt has type DT_UNKNOWN or DT_REG
ok 159 - open file
ok 160 - unlink file while still open
not ok 161 - Windows non-POSIX: readdir still sees it before closing (at ../src/port/t/001_filesystem.c:794)
ok 162 - readdir doesn't see it after closing
ok 163 - create a new file
ok 164 - initial file position is zero
ok 165 - pg_pwrite(fd, "llo", 3, 2) == 3
ok 166 - pg_pwrite(fd, "he", 2, 0) == 2
ok 167 - Windows: file position moved
ok 168 - pg_pread(fd, buffer, 2, 3) == 2
ok 169 - memcmp(buffer, "lo", 2) == 0
ok 170 - pg_pread(fd, buffer, 3, 0) == 3
ok 171 - memcmp(buffer, "hel", 3) == 0
ok 172 - Windows: file position moved
ok 173 - pg_pread short read
ok 174 - pg_pread EOF
ok 175 - pg_pwritev(fd, iov, 2, 5) == 5
ok 176 - Windows: file position moved
ok 177 - pg_preadv(fd, iov, 2, 1) == 8
ok 178 - Windows: file position moved
ok 179 - memcmp(buffer, "ello", 4) == 0
ok 180 - memcmp(buffer2, "worl", 4) == 0
ok 181 - pg_preadv(fd, iov, 2, 8) == 2
ok 182 - pg_preadv(fd, iov, 2, 9) == 1
ok 183 - pg_preadv(fd, iov, 2, 10) == 0
ok 184 - pg_preadv(fd, iov, 2, 11) == 0
ok 185 - pg_pread(fd, buffer, 10, 0) == 10
ok 186 - buffer matches "helloworld"
ok 187 - open file in text mode
ok 188 - write(fd, "hello world\n", 12) == 12
ok 189 - open file in binary mode
ok 190 - Windows: \n was translated
ok 191 - Windows: \n was translated to \r\n
ok 192 - open file in text mode
ok 193 - read(fd, buffer, sizeof(buffer)) == 12
ok 194 - memcmp(buffer, "hello world\n", 12) == 0
ok 195 - open file in text mode
ok 196 - pg_pwrite(fd, "hello world\n", 12, 0) == 12
ok 197 - open file in binary mode
ok 198 - \n was not translated by pg_pread()
ok 199 - fsync(fd) == 0
ok 200 - fdatasync(fd) == 0
1..200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment