Repository navigation
test: cover error paths in atomic, fsx, proc, logs and cli (v2) - #44
Merged
Merged
Conversation
Add openat, write and renameat hooks to atomic.Ops so tests can inject failures. Cover atomicWrite when the disk is full (`ENOSPC`), the file system is read-only (`EROFS`) and the rename crosses devices (`EXDEV`), plus the makedirs and fsyncDir error paths.
Exercise the error returns of fstat, statAt, realpathFd, realpath, openRegular, openDir, copyTo, appendLine, readAll, moveAcross, replaceContents and deleteTree. openRegular on a directory now expects error.IsDir, matching the landed type diagnostics.
Cover the cases which rejects, groupAlive with an absent process group, the signal helpers with a zero pgid, and run with invalid arguments, an argument overflow and an exec error. The executable fixtures reuse makeExecFixture.
Check that gzipInPlace returns NotFound for a missing file, InvalidArgument for a directory, SymLink for a symlink, TooManyLinks for a hard-linked file and Exists when the .gz archive is already there.
Check that cli.put and cli.print ignore a bad file descriptor (`EBADF`) for both stack and heap-formatted messages, and pin the cli.versionLine format.
Move the PATH walk in which into one search entry that takes a directory handle and a set of lookup options, and resolves relative and absolute candidates the same way. The shutil-compatible lookup in the next commit reuses it instead of copying the split, join, access and stat loop. proc.which behaves as before, and its existing tests pass unmodified.
Callers that must match Python's shutil.which on POSIX can opt in to proc.whichShutil, and proc.which keeps its current behavior. whichShutil searches /bin:/usr/bin when PATH is unset and finds nothing when PATH is empty. An empty PATH entry resolves against the caller's working-directory handle and returns a relative candidate. Names that contain a slash are normalized the way os.path.split and join do before the direct check, so a//x matches a/x, while a/x/ still does not match a regular file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restack of #30 onto main ae925a3 (7 commits). zc35, zc36b and zc38 pieces dropped as already landed in #36-#41.