test: cover ArxBuilder link and link_mode paths#46
test: cover ArxBuilder link and link_mode paths#46omsherikar wants to merge 2 commits intoarxlang:mainfrom
Conversation
Exercise link=False object output, invalid link_mode, and pie/no-pie clang flags (closes codegen coverage gaps).
There was a problem hiding this comment.
Pull request overview
This PR adds targeted tests to close code coverage gaps in src/arx/codegen.py around object-only output (link=False), invalid link_mode handling, and explicit pie / no-pie linker-flag selection.
Changes:
- Add a minimal module parsing helper to reduce repetition in codegen tests.
- Add a test asserting
link=Falsewrites the emitted object bytes directly tooutput_file. - Add tests for invalid
link_modeand for forwarding-pie/-no-pieto the clang invocation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ("no-pie", "-no-pie"), | ||
| ], | ||
| ) | ||
| @pytest.mark.skipif(not HAS_CLANG, reason="clang is required for object build") |
There was a problem hiding this comment.
test_build_passes_explicit_link_flags monkeypatches arx.codegen.xh.clang, so it no longer needs a real clang binary on PATH. The current @skipif(not HAS_CLANG, ...) will unnecessarily skip this coverage in environments without clang and the skip reason is misleading; consider removing the skip or changing the condition/reason to reflect the actual prerequisite (e.g., only skip when LLVM object emission isn’t available).
| @pytest.mark.skipif(not HAS_CLANG, reason="clang is required for object build") |
Exercise link=False object output, invalid link_mode, and pie/no-pie clang flags (closes codegen coverage gaps).
solves #42