test: add a functional test suite - #1
Open
amineau wants to merge 1 commit into
Open
Conversation
The project had no tests, which made any change to the protocol handling a matter of trusting a manual session. This adds a suite that starts a real server against a fixture root and drives it over a socket, plus end-to-end cases through the client binary. Run it with `make test`. Driving the protocol directly rather than through ./client is what lets the suite send deliberately malformed input and assert on exact reply codes; the client exits on the first unexpected reply, so it cannot express those cases. Cases covering behaviour the server does not have yet are marked as expected failures rather than left out. They run on every invocation and document the intended behaviour, and fixing the code reports them as unexpected successes, which fails the run and prompts removing the marker. Four defects surfaced while writing this and are encoded as expected failures: - A rejected password does not end the session. The credentials are checked and refused, but the outcome is never recorded, so the next command is served as though the login had succeeded. - The working directory leaks between sessions. Workers chdir() the process and never reset, so a client can start in whatever directory the previous one left behind. Which directory depends on which worker accepts the connection, so the symptom is intermittent. - ft_indexof cannot report "not found": it returns -1 only for a NULL haystack, and otherwise reads past the end of the array until it meets a matching byte. TYPE, MODE and STRU accept junk arguments as a result. - TYPE, MODE and STRU dereference their argument without checking it, so a bare verb kills the worker handling the connection. The harness pins the working directory when opening a connection so that the second of these does not make execution order significant; a dedicated case covers the defect itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWMoXxqX1CdGZ7FKW5bsk7
amineau
force-pushed
the
claude/tests-8m4ax9
branch
from
August 2, 2026 14:54
a8a7dc7 to
896c870
Compare
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.
The project had no tests, which made any change to the protocol handling a
matter of trusting a manual session. This adds a suite that starts a real
server against a fixture root and drives it over a socket, plus end-to-end
cases through the client binary. Run it with
make test.Driving the protocol directly rather than through ./client is what lets the
suite send deliberately malformed input and assert on exact reply codes; the
client exits on the first unexpected reply, so it cannot express those cases.
Cases covering behaviour the server does not have yet are marked as expected
failures rather than left out. They run on every invocation and document the
intended behaviour, and fixing the code reports them as unexpected successes,
which fails the run and prompts removing the marker.
Three defects surfaced while writing this and are encoded as expected
failures:
and never reset, so a client can start in whatever directory the previous
one left behind. Which directory depends on which worker accepts the
connection, so the symptom is intermittent.
haystack, and otherwise reads past the end of the array until it meets a
matching byte. TYPE, MODE and STRU accept junk arguments as a result.
bare verb kills the worker handling the connection.
The harness pins the working directory when opening a connection so that the
first of these does not make execution order significant; a dedicated case
covers the defect itself.