Skip to content

test: cover error paths in atomic, fsx, proc, logs and cli (v2) - #44

Merged
HaoZeke merged 7 commits into
mainfrom
test/error-paths-coverage-v2
Nov 19, 2026
Merged

HaoZeke merged 7 commits into
mainfrom
test/error-paths-coverage-v2

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Restack of #30 onto main ae925a3 (7 commits). zc35, zc36b and zc38 pieces dropped as already landed in #36-#41.

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.
@HaoZeke
HaoZeke merged commit 1d98b16 into main Nov 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant