Repository navigation
test: the v1 router's CPU profile, under samply through a nextest wrapper script (test-suites PR 5) - #272
Merged
Conversation
…pper script PR 5 of the test-suites plan, the last. - crates/testing/profiling/tests/cpu.rs: prof_cpu_router runs the profiled mix 20 times on fresh worlds (6,400 requests, about 2 s in the release build), with the system allocator. It refuses to run without THRUST_PROF_SAMPLY, which only the wrapper sets, so a prof_cpu_ test selected under another profile fails instead of passing with no profile. - scripts/samply-wrapper.sh: nextest runs it as <wrapper> <test binary> <arguments>. It runs `samply record --save-only --no-open --unstable-presymbolicate` and writes target/profiling/<test>.json.gz, with a symbols sidecar so `samply load` opens it without the build. samply 0.13.1 exits with the test's status, but with 0 when the test is killed by a signal (measured): under a plain wrapper an aborting test PASSED. So a 0 counts only with libtest's pass line for one test. - .config/nextest.toml: `experimental = ["wrapper-scripts"]`, [scripts.wrapper.samply] (relative to the workspace root), and [[profile.prof.scripts]] for `test(/^prof_cpu_/)`. If the feature is renamed or dropped, nextest refuses the config (exit 96 for an unknown feature, 95 for a wrapper script without it; measured on 0.9.140), so no test runs unprofiled. - .github/scripts/tests/test-samply-wrapper.sh, run by ci-scripts: the wrapper against a fake samply that behaves as measured and a fake test binary, over every ending (pass, fail, no test, killed), samply installed or not, a profile written or not, and three test names (149 checks). Eight broken copies of the wrapper each fail it. - plan-ci.py: a change to the wrapper runs ci-scripts, not everything. Controls, against the real samply: a failing prof_cpu_ test fails (exit 100); an aborting one fails through the guard, and passes with the guard removed; the test refuses without the wrapper; the profile's symbols name thrust_api_v1, thrust_core, thrust_adapters_memory and thrust_profiling, and an unrelated binary's name none of them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AGENTS.md's commands table gains the profiles' command. The crate's description and module doc, crates/testing/README.md and docs/src/testing/techniques/performance.md describe the CPU profile and the wrapper. The plan: PR 4 merged in #267, PR 5 in review, and what PR 5 found (samply's exit status on a signal, the refusal without the wrapper, how nextest reacts if the experimental feature changes). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
aRustyDev
added a commit
that referenced
this pull request
Nov 17, 2026
PR 5 merged in #272, so all five pull requests are merged. The status table says so, gives the plan's own merge (#234), and points at what the plan left for later. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
PR 5 of the test-suites plan (
.agents/plans/test-suites/), the last: the v1 router's CPU profile, recorded by samply through a nextest wrapper script. samply was installed with the owner's OK (cargo install samply, 0.13.1).What
crates/testing/profiling/tests/cpu.rs.prof_cpu_routerruns the profiled mix 20 times on fresh worlds: 6,400 requests, about 2 s in the release build. It uses the system allocator, because under dhat a CPU profile would mostly show dhat's own work.scripts/samply-wrapper.sh. nextest runs it as<wrapper> <test binary> <arguments>.samply record --save-only --no-open --unstable-presymbolicateon the test.target/profiling/<test>.json.gzplus a symbols sidecar, sosamply load <file>opens the flame graph without the build..config/nextest.toml:experimental = ["wrapper-scripts"];[scripts.wrapper.samply], relative to the workspace root;[[profile.prof.scripts]], which applies the wrapper totest(/^prof_cpu_/). The heap tests run unwrapped, as before..github/scripts/tests/test-samply-wrapper.sh, run byci-scripts. It tests the wrapper with a fake samply that behaves as measured and a fake test binary, so CI needs no samply. The plan-ci planner (plan-ci.py) gets a rule so a change to the wrapper runsci-scripts; before, an unknown script ran everything.crates/testing/README.mdandperformance.mddescribe the CPU profile.Run it with:
Three ways the profile could pass without profiling, measured and closed
prof_cpu_test passed in nextest. So the wrapper counts a 0 only when libtest also printed its pass line for exactly one test.THRUST_PROF_SAMPLY, and the test refuses to run without it.Evidence
Every check below has a control that makes it fail (AGENTS.md rule 8). The control rows were run against the real samply on macOS.
--profile prof --cargo-profile release, CPU testthrust_api_v1,thrust_adapters_memory,thrust_coreandthrust_profilingprof_cpu_test that must failprof_cpu_test that aborts--ignore-default-filter)test-samply-wrapper.sh--profile prof(dev build)prof_tests pass; the heap tests run unwrappedprof_tests skippedcargo nextest run --profile ci --workspace --locked, after merging today'smaincargo mutants -p thrust-profilingsrc/changed only in its doc comment)plan-ci.pywith only the wrapper changedci-scriptstest_plan_ci.pyfailed until the new rule had its sample (6,993 checks now)mutate_gate.pydepsandci-scriptsjobs, shell scripts under dash, after merging today'smaindepscommands fromlint.yml, 38ci-scriptscommands fromci.yml, the same total as before #269depsintolint.yml, where my local runner, which readci.ymlonly, would have skipped it and still reported green. It now reads each job from whichever workflow holds it, and refuses if a job is missingcheck-layout.shsamply on Linux needs
/proc/sys/kernel/perf_event_paranoidat 1 or lower; I measured only on macOS. No CI job runs theprofprofile; the CI-split plan's phase 13 (Prof) owns that..config/changed, so CI runs everything.🤖 Generated with Claude Code