Replace the single file-structure.md with a stratified layout designed
for AI/agent skill consumption: tables and concrete identifiers over
prose, files loaded on demand, content separated by churn rate.
Layers:
- architecture/ stable structural reference (overview, source-map,
test-map, data-flow)
- patterns/ memory, commands, autocomplete, events, xmpp,
encryption, ui, plugins
- testing/ unit-tests, stubs, functional-tests, bench
- build/ local, docker, ci
- playbooks/ add-command, add-test, add-autocomplete,
add-event-handler, add-encryption
- gotchas.md append-only dated entries (seven seed entries)
- wip/ branch-specific notes; deleted on merge to master
Stable layers describe cproof on master only. In-flight feature
branches (currently feat/ai) get a single file under wip/.
INDEX.md is the entry map with churn labels; SKILL.md is the
always-loaded skill hint pointing to it.
2.3 KiB
2.3 KiB
Functional tests
tests/functionaltests/ exercises a real cproof binary under a PTY against a
real (test) XMPP server.
Files
| File | Role |
|---|---|
functionaltests.c |
Runner (entry point). |
proftest.c/h |
Fixture: spawn cproof under PTY, drive XMPP server, assertions. |
test_<feature>.c |
Per-feature suites. |
Existing suites (grep for test_*.c):
- Connection / disconnection:
test_connect.c,test_disconnect.c,test_autoping.c,test_ping.c. - Messaging:
test_message.c,test_chat_session.c,test_carbons.c,test_receipts.c,test_history.c. - Presence and roster:
test_presence.c,test_roster.c,test_lastactivity.c. - Discovery:
test_disco.c,test_software.c. - MUC:
test_muc.c,test_rooms.c. - Storage:
test_export_import.c.
Prerequisites
- A test XMPP server reachable from the harness (typically a local Prosody instance configured for the tests).
- A pre-baked
.profrc(recent perf work pre-bakes this for speed — see cproof commitf84ed1bf6for context). - PTY availability (
/dev/ptmxon Linux).
Running
Functional tests are not part of make check (which runs unit tests only).
They are built and invoked via a separate target in tests/functionaltests/
— inspect tests/functionaltests/Makefile.am for the current target name and
arguments.
Recent perf work (commit f84ed1bf6) added:
- Profrc pre-baking — fixture writes a known-good
.profrconce, not per-test. - pty-close shutdown — fixture closes the PTY to terminate cproof faster than signalling.
- Parallel port pools — separate XMPP servers / ports per parallel suite.
When to add functional vs unit
| Test what | Where |
|---|---|
| Pure logic, internal API, given a state. | Unit. |
| Stanza serialization / parsing round-trip with real libstrophe. | Functional. |
| Connection state machine across multiple network events. | Functional. |
| UI rendering (visible output). | Neither (UI stubbed in unit; not asserted in functional). |
Failure-mode notes
- A leaked / orphan cproof process between suites poisons later runs. The
fixture aggressively kills children — but if you abort a test by hand,
pkill -f tests/functionaltestsfirst. - Port-pool exhaustion under parallelism: bump the pool size, do not lower
-jN.