test: cover LLGo directive comments#1834
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces test cases for llgo compiler directives, including link, skip, and skipall. Feedback indicates that the skip directive test should be adjusted to prevent dead code elimination from masking failures and that the skipall fixture requires specific build tags to be properly exercised during testing.
There was a problem hiding this comment.
Review Summary
This is a small, focused test-only PR that adds runtime tests for LLGo directive comments (//go:linkname, //llgo:link, //llgo:skip, //llgo:skipall). The //go:linkname and //llgo:link coverage is solid and provides direct, asserted verification. A few quality/consistency points worth addressing:
- Missing license headers: Other test files in
test/go/(e.g.,binop_test.go,cgo_malloc_test.go) carry the standard Apache 2.0 header; both new files omit it. - Legacy
// +buildlines: No other file in the directory uses the old-style constraint; letgo fmtmanage these or drop them for consistency. - Import grouping: The standalone
import _ "unsafe"should be folded into the grouped block — this matches the convention inpromoted_offsetof_test.go,string_slice_base_test.go, etc. - Passive skip tests:
TestLLGoDirectiveSkipis empty and the skipall fixture has no driver — both rely entirely on link-time failure as evidence. This is a valid technique but warrants explanatory comments and ideally a more active assertion. The fixture file in particular has no obvious harness invoking it with thedirective_skipall_fixturetag. - Anchor types:
directiveSkipAnchoranddirectiveSkipAllAnchorare unused; a one-line comment explaining they exist as doc-comment anchors for the directive would prevent future "dead code" cleanup.
No security or performance concerns.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1834 +/- ##
=======================================
Coverage 88.48% 88.48%
=======================================
Files 50 50
Lines 14418 14418
=======================================
Hits 12758 12758
Misses 1440 1440
Partials 220 220 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
02304a8 to
5442f6a
Compare
Summary
Tests
Notes