Choose the right check
Run from the repository root. The book has two kinds of evidence: independent observation of your executable, and CTest fixtures you write against your own core. A green result in one column does not imply the other.
| Stages | Command | Evidence |
|---|---|---|
| 0–3, desktop | python3 course/check.py window-close --previous |
The course builds from a source snapshot and independently observes X11. Select setup-build for the earlier greeting alone. |
| 4–5, native pixels | python3 course/native_preview.py resize-frame |
Reads pixels from the app on a private server. Select present-frame for the initial upload. |
| 5–19, core through apps | python3 course/check_core.py reuse-api --previous |
Builds your configured project and runs the named CTest fixtures you authored with the book’s cases. --previous covers later-book tests only, not the pilot. |
For the rendering prerequisites, also register present-frame as a CTest fixture that checks your pure pixel serialization (for example 24 68 b0 with the two byte orders). That gives --previous something stable to rerun after the early native demo evolves. Do not ask that one test to claim a window was actually painted.
An external X11 check uses Xvfb with a temporary authority cookie and no TCP. It never injects into your own desktop. A missing dependency is BLOCKED (exit 2), a failed contract is FAIL (exit 1), and a passing check returns 0. --xvfb PATH is available on the two external tools. A window manager's close button is a separate manual capstone check; bare Xvfb has no window manager.
Add the first CTest test
When you reach Stage 5, build a tiny test executable that exercises your implementation in-process. Don’t create a second resize or clipping code path just for testing. Link the same library target, or compile the same implementation .cpp into the test until you extract the core. Do not link src/main.cpp, which already has its own entry point.
For example, this is the shape of an addition to CMakeLists.txt after creating your library and one test source. Substitute your actual source file and library name.
include(CTest)
if(BUILD_TESTING)
add_executable(test_resize_frame tests/resize_frame.cpp)
target_link_libraries(test_resize_frame PRIVATE gpui_cc_core)
add_test(NAME resize-frame COMMAND test_resize_frame)
endif()
CMake resolves an executable target name to its actual path in add_test, even with your target/ output directory. Name each CTest exactly as the chapter's command names it. Register the pure present-frame test the same way. Confirm that tests are enabled with cmake -S . -B build -DBUILD_TESTING=ON (add -G "Unix Makefiles" when configuring a fresh tree).
If useful, test-support.hpp contains a small non-disappearing assertion helper. Include it from tests/ using ../course/examples/test-support.hpp (or set the test target’s include path). A fixture’s main constructs test input, calls the feature you built, and uses checks.expect(actual == expected, "describe the mismatch") for each case. Return checks.status(). For image fixtures, compare all expected pixels and sentinel padding, not only a hand-picked center pixel. The helper’s checks remain enabled even when C/C++'s assert might be compiled out.
cmake -S . -B build -DBUILD_TESTING=ON
python3 course/check_core.py --list
python3 course/check_core.py resize-frame
Test the test: deliberately make one expectation false and verify a useful failure, then restore it. Also run the test against a plausible wrong implementation where possible: wrong stride, missing cancellation, or a redraw on every idle turn. The runner rejects missing/duplicate CTest names, build failures, nonzero exits, and timeouts; it cannot tell if the assertions you wrote are meaningful. Read the acceptance table in each lesson.
Rehearse the final app
Keep a deterministic headless trace of inputs and observed model, focus, layout bounds, and presented frames. Use the exact same runtime and renderer as the native app with a different presenter. Test counts and state transitions rather than guessing a timer frequency. Run the separate native smoke observations in the capstone on your own desktop; do not send synthesized input to arbitrary displays. Preserve evidence such as expected/observed logs and exact build commands.
The early external checker snapshots only CMakeLists.txt and src/ and assumes target/debug/gpui_cc; its isolation contract is for Chapters 1 and 2 before extracting capstone layout and tests. When later restructuring adds inputs outside those paths, keep historical working commits for the early external checks, and verify equivalent behavior through the capstone tests and native smoke. Do not copy obsolete outputs into a test just to make an old greeting pass.
What has been verified in this workspace
The author compiled and ran the teaching examples, checked their documented observations (including the XKB and format examples on private X11), and tested the native pixel observer with disposable good and stale-resize fixtures. The CTest dispatcher was tested with a passing test, failing test, missing test, and absent build. See Chapter 1 verification for its independent native checks.
The later CTest command does not come with hidden graders or a completed framework. You write its fixtures using the specified cases. The author has not run your eventual framework through the complete capstone, and a separate beginner rehearsal of the full course has not been completed.