test: replace custom cfg with TEST_SKIP environment variable#372
Merged
test: replace custom cfg with TEST_SKIP environment variable#372
cfg with TEST_SKIP environment variable#372Conversation
…` env var The custom cfg flag required `RUSTFLAGS` which forced full recompilation just to skip a test. The new `TEST_SKIP` env var passes `--skip` to the test binary at runtime, avoiding any recompilation. https://claude.ai/code/session_01UBzLwHNmqEC2SafFKjEqYz
Performance Regression Reportscommit: c4a33e3 --quantity=apparent-size --max-depth=1 --min-ratio=0.01
LogsJSON{
"results": [
{
"command": "pdu",
"mean": 0.12006047361217392,
"stddev": 0.013343557065973555,
"median": 0.12705781496000002,
"user": 0.08860871739130434,
"system": 0.28654005217391304,
"min": 0.09510904396,
"max": 0.13226357696000002,
"times": [
0.12774852796000002,
0.12691368096000002,
0.12205733196,
0.12771803096,
0.12698449196000003,
0.12590222896000003,
0.13226357696000002,
0.12772239096000002,
0.12743405396000002,
0.12705781496000002,
0.12684034196000002,
0.12713915596000003,
0.12754833296,
0.12750079696000002,
0.12771375496,
0.12733985696000003,
0.12743210996,
0.11984200396,
0.09606498796,
0.09659742696,
0.09530366496,
0.09515728596,
0.09510904396
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"command": "pdu-0.20.0",
"mean": 0.0958133803470968,
"stddev": 0.00044423652271469643,
"median": 0.09582443196,
"user": 0.09303498387096773,
"system": 0.28079410967741936,
"min": 0.09505560496,
"max": 0.09696005896,
"times": [
0.09518470396,
0.09599715196,
0.09564958696,
0.09586240196,
0.09598966796,
0.09640742096,
0.09532143996,
0.09547397796,
0.09531694296,
0.09532619696,
0.09600397496,
0.09598114196,
0.09696005896,
0.09505560496,
0.09534498196,
0.09585327496,
0.09608002596,
0.09582443196,
0.09615227996,
0.09627631996,
0.09563300696,
0.09543804396,
0.09588356896,
0.09559013596,
0.09546652696,
0.09611445896,
0.09582058696,
0.09662026896,
0.09549784596,
0.09561676596,
0.09647199396
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
} |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the repo’s “skip certain integration tests” workflow from compile-time custom --cfg pdu_test_skip_* flags to a runtime TEST_SKIP environment variable, aiming to avoid recompilation when skipping environment-dependent tests.
Changes:
- Add
TEST_SKIPhandling totest.sh, translating names into libtest--skiparguments. - Update the
fs_errorstest hint to referenceTEST_SKIPand remove the custom cfg-based ignore. - Remove the
Cargo.tomlunexpected_cfgsallowance and update developer/AI docs to the new mechanism.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cli_errors.rs | Removes cfg-based ignore and updates the root-run hint to use TEST_SKIP. |
| test.sh | Parses TEST_SKIP and conditionally appends libtest --skip args to cargo test. |
| template/ai-instructions/shared.md | Updates guidance to reference TEST_SKIP instead of custom cfg flags. |
| README.md | Documents the new TEST_SKIP environment variable for test.sh. |
| Cargo.toml | Removes unexpected_cfgs configuration for the deleted custom cfg. |
| CONTRIBUTING.md | Updates test-skipping guidance to prefer TEST_SKIP for runtime-environment skips. |
| CLAUDE.md | Syncs AI instructions to reference TEST_SKIP. |
| AGENTS.md | Syncs AI instructions to reference TEST_SKIP. |
| .github/copilot-instructions.md | Syncs AI instructions to reference TEST_SKIP. |
The TEST_SKIP variable is only interpreted by test.sh, not by cargo test directly. Update the hint to say "rerun via ./test.sh" so users know exactly how to invoke it. https://claude.ai/code/session_01UBzLwHNmqEC2SafFKjEqYz
The paragraph framed TEST_SKIP as a general policy for writing new tests, but there is only one such test. The test's own panic hint and the existing note in the test-running section already provide sufficient guidance. https://claude.ai/code/session_01UBzLwHNmqEC2SafFKjEqYz
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.
Summary
This PR replaces the custom
--cfg pdu_test_skip_*mechanism with a simplerTEST_SKIPenvironment variable for skipping tests at runtime. This avoids unnecessary recompilation when tests need to be skipped based on runtime conditions.Key Changes
TEST_SKIPenvironment variable that accepts space-separated test names and passes them tocargo testvia--skipflags#[cfg_attr(pdu_test_skip_fs_errors, ignore)]and updated the error hint to useTEST_SKIP='fs_errors'instead ofRUSTFLAGS='--cfg pdu_test_skip_fs_errors'[lints.rust]section that declared thepdu_test_skip_fs_errorscfg as expectedTEST_SKIPfor runtime environment conditions and removed the example using custom cfg flagsTEST_SKIPinstead ofRUSTFLAGSand custom cfg flagsImplementation Details
The
test.shscript now:TEST_SKIPenvironment variable as a space-separated list--skipargumentcargo testonly when skip arguments are presentThis approach allows tests to remain compiled on all configurations (catching type errors early) while being skipped at runtime based on environment conditions, without requiring recompilation.
https://claude.ai/code/session_01UBzLwHNmqEC2SafFKjEqYz