test: coverage uplift for v0.1.1 diff (regalloc, M7 profiles, CLI)#92
Merged
Conversation
Adds 37 focused unit/integration tests covering the patch-coverage gaps introduced by #86 (commit 5c7ef0c). The same coverage gate would block the next stacked PR (#87, RISC-V skeleton); this lands the backfill so the threshold clears without waivers. * synth-core/target.rs (+5 tests): - imxrt1062() / stm32h743() constructor coverage (arch, MPU regions, FPU precision, flash/ram, target_triple/cpu_name/has_hardware_fp). - Regression guard: M4-class parts must report 8 regions, M7-class parts must report 16, and FPU precision must match part class. * synth-synthesis/instruction_selector.rs (+15 tests): - compute_local_layout: no-locals, single i32, single i64, mixed i32+i64 with 8-byte alignment, param-index skipping. - infer_i64_locals: LocalSet, LocalTee, i32 propagation, i64 arith propagation. - alloc_consecutive_pair: basic consecutiveness, extra_avoid skip, implicit-hi-of-stack-i64 reservation (the bug-class the PR fixed). - select_with_stack: emits sub/add SP for i64 locals, omits frame when only params used, i32 locals use Str/Ldr to SP-relative slots. * synth-synthesis/optimizer_bridge.rs (+6 tests): - ir_to_arm I64Const with num_params=4: Movw/Movt do NOT target R0..R3. - ir_to_arm I64Const with num_params=2: Movw/Movt do NOT target R0/R1. - ir_to_arm I64Const with num_params=0: callee-saved pair is used. - ir_to_arm I64Add: emits Adds + Adc on operand registers (not hardcoded R0:R1/R2:R3 from the buggy pre-fix path). - ir_to_arm I64Sub: emits Subs + Sbc. - ir_to_arm I64Or: emits two ORR instructions. * synth-cli/main.rs (+9 tests): - target_info_command for imxrt1062 + stm32h743 success paths. - target_info_command unknown-target error message advertises all four supported names (regression: error string was hand-edited). - synthesize_command --hardware string→ctor dispatch covered. - resolve_target_spec: default (Arm32 ISA), --cortex-m flag (M3), explicit target wins, unknown triple errors with help text. * synth-cli/tests/wast_compile.rs (+2 integration tests): - --relocatable forces ET_REL on import-free wasm. - default (no flag, no imports) still produces ET_EXEC. Verified locally: cargo test --workspace passes (no regressions), cargo clippy --workspace --all-targets -- -D warnings clean, cargo fmt --check clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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
Backfills patch coverage for the v0.1.1 diff that landed as #86 (commit 5c7ef0c). The same codecov/patch threshold would block the next stacked PR (#87, RISC-V skeleton) — this PR lands the missing tests so the gate clears without waivers.
37 new tests, no production-code changes.
What's covered
imxrt1062()andstm32h743()constructors (5 tests): arch enum, MPU region count, FPU precision, flash/ram sizing, target_triple/cpu_name/has_hardware_fp, plus a regression guard that M4 reports 8 regions while M7-class reports 16.compute_local_layout: zero-frame for params-only; single i32; single i64; mixed i32+i64 with 8-byte alignment edge case; param-index skipping.infer_i64_locals: LocalSet, LocalTee, no-flag-on-i32, propagation through i64 arith.alloc_consecutive_pair: basic consecutiveness contract,extra_avoidskip, implicit-hi-of-stack-i64 reservation (the bug class the PR fixed).select_with_stack: emits matchingsub sp/add spframe ops for i64 locals; omits frame when only params used; i32 locals useStr/Ldrto SP-relative slots.ir_to_arm):I64Constwithnum_params=4does NOT target R0..R3 via Movw/Movt (the AAPCS-clobber bug).I64Constwithnum_params=2does NOT target R0/R1.I64Constwithnum_params=0uses a callee-saved pair.I64AddemitsAdds + Adcfrom the operand regs (not hardcoded R0:R1/R2:R3).I64SubemitsSubs + Sbc.I64Oremits twoOrrinstructions.target_info_commandforimxrt1062andstm32h743success paths.target_info_commandunknown-target error advertises all four supported names.synthesize_command--hardware string→ctor dispatch covered.resolve_target_spec: default (Arm32 ISA),--cortex-mflag (M3), explicit target wins, unknown triple errors with help text.--relocatableforcesET_RELon import-free wasm.ET_EXEC.Test plan
cargo test --workspace— passes locally (no regressions across the 1000+ existing tests; 37 new tests added).cargo clippy --workspace --all-targets -- -D warnings— clean.cargo fmt --check— clean.🤖 Generated with Claude Code